A decorator that uses a function signature and arguments to define an AI task.The function body executes to provide additional context. Its return value is
context for the model, not the generated result. Use an ellipsis body when
no additional context is needed.Can be used with or without parameters:
If the function does not have a return annotation, the result will be
returned as a string and attempted to be parsed as JSON.The decorated function also gains an as_task() method that returns the underlying
marvin Task without executing it.Args:
func: The function to decorate
instructions: Optional instructions to guide the prediction
agent: Optional custom agent to use
thread: Optional thread for maintaining conversation context
prompt: Optional prompt to use for the task. If not provided, the default
prompt will be used.
Returns:
A wrapped function that returns the model-generated resultParent Module:fns
⌘I
{"docsConfig":{"theme":"maple","$schema":"https://mintlify.com/docs.json","name":"Marvin","colors":{"primary":"#2D6DF6"},"logo":{"light":"https://mintcdn.com/marvin/ztPIIT7lOnW7ZsRP/assets/brand/marvin_mascot.jpeg?fit=max\u0026auto=format\u0026n=ztPIIT7lOnW7ZsRP\u0026q=85\u0026s=5793480b0b6ab2f5d05939e51b02f135","dark":"https://mintcdn.com/marvin/ztPIIT7lOnW7ZsRP/assets/brand/marvin_mascot.jpeg?fit=max\u0026auto=format\u0026n=ztPIIT7lOnW7ZsRP\u0026q=85\u0026s=5793480b0b6ab2f5d05939e51b02f135"},"favicon":"https://mintcdn.com/marvin/ztPIIT7lOnW7ZsRP/assets/brand/marvin_mascot.jpeg?fit=max\u0026auto=format\u0026n=ztPIIT7lOnW7ZsRP\u0026q=85\u0026s=5793480b0b6ab2f5d05939e51b02f135","navbar":{"primary":{"type":"github","href":"https://github.com/PrefectHQ/marvin"}},"footer":{"socials":{"github":"https://github.com/PrefectHQ/marvin","slack":"https://communityinviter.com/apps/prefect-community/prefect-community"}},"search":{"prompt":"Ask Marvin..."},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"marvin","hasAudioNarration":false,"actualSubdomain":"marvin","customDomains":["askmarvin.ai"],"gitSource":{"type":"github","owner":"prefecthq","repo":"marvin","deployBranch":"main","contentDirectory":"docs","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae10a675ecac0fee57e9113","collectionId":"ed7aa1aa-021f-469c-a3ac-0d7cbe6709f0","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae10a675ecac0fee57e9113"},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ae10a675ecac0fee57e9113","clientVersion":"0.0.4067","searchFilterCounts":[{"language":"default","tag":"API Reference","count":60},{"language":"default","tag":"Documentation","count":31},{"language":"default","tag":"fns","count":10},{"language":"default","tag":"utilities","count":9},{"language":"default","tag":"Functions","count":9},{"language":"default","tag":"Guides","count":8},{"language":"default","tag":"memory","count":7},{"language":"default","tag":"engine","count":6},{"language":"default","tag":"agents","count":5},{"language":"default","tag":"cli","count":5}]},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"assets/code.css","content":".namespace{opacity:0.7}.token.doctype .token.doctype-tag{color:#79c0ff}.token.doctype .token.name{color:#d2a8ff}.token.comment,.token.prolog{color:#8b949e}.token.punctuation,.language-html .language-css .token.punctuation,.language-html .language-javascript .token.punctuation{color:#c9d1d9}.token.property,.token.tag,.token.boolean,.token.number,.token.constant,.token.symbol,.token.inserted,.token.unit{color:#79c0ff}.token.selector,.token.attr-name,.token.string,.token.char,.token.builtin,.token.deleted{color:#79c0ff}.token.plain-text{color:#fafafa}.language-css .token.string.url{text-decoration:underline}.token.operator,.token.entity{color:#79c0ff}.token.operator.arrow{color:#ff7b72}.token.atrule{color:#79c0ff}.token.atrule .token.rule{color:#d2a8ff}.token.atrule .token.url{color:#79c0ff}.token.atrule .token.url .token.function{color:#79c0ff}.token.atrule .token.url .token.punctuation{color:#d4d4d4}.token.keyword{color:#ff7b72}.token.keyword.module,.token.keyword.control-flow{color:#c586c0}.token.function,.token.function .token.maybe-class-name{color:#d2a8ff}.token.regex{color:#a5d6ff}.token.important{color:#ff7b72}.token.italic{font-style:italic;color:#c9d1d9}.token.constant{color:#79c0ff}.token.class-name,.token.maybe-class-name{color:#d2a8ff}.token.console{color:#9cdcfe}.token.parameter{color:#79c0ff}.token.interpolation{color:#79c0ff}.token.punctuation.interpolation-punctuation{color:#569cd6}.token.boolean{color:#ff7b72}.token.property,.token.variable,.token.imports .token.maybe-class-name,.token.exports .token.maybe-class-name{color:#79c0ff}.token.selector{color:#7ee787}.token.escape{color:#7ee787}.token.tag{color:#7ee787}.token.tag .token.punctuation{color:#808080}.token.cdata{color:#808080}.token.attr-name{color:#79c0ff}.token.attr-value,.token.attr-value .token.punctuation{color:#a5d6ff}.token.attr-value .token.punctuation.attr-equals{color:#d4d4d4}.token.entity{color:#79c0ff}.token.namespace{color:#7ee787}.token.operator{color:#94a3b8}pre[class*=\"language-javascript\"],code[class*=\"language-javascript\"],pre[class*=\"language-jsx\"],code[class*=\"language-jsx\"],pre[class*=\"language-typescript\"],code[class*=\"language-typescript\"],pre[class*=\"language-tsx\"],code[class*=\"language-tsx\"]{color:#79c0ff}pre[class*=\"language-css\"],code[class*=\"language-css\"]{color:#a5d6ff}pre[class*=\"language-html\"],code[class*=\"language-html\"]{color:#c9d1d9}.language-regex .token.anchor{color:#dcdcaa}.language-html .token.punctuation{color:#808080}span.language-json .token.punctuation{color:#4b5563}:is(.dark span.language-json .token.punctuation){color:#d1d5db}span.language-json .token.property{color:#0284c7}:is(.dark span.language-json .token.property){color:9cdcfe}span.language-json .token.string{color:#d97706}:is(.dark span.language-json .token.string){color:#ce9178}span.language-json .token.number{color:#16a34a}:is(.dark span.language-json .token.number){color:#b5cea8}.line-highlight.line-highlight{background:#f7ebc6;box-shadow:inset 5px 0 0 #f7d87c;z-index:0}"},{"filePath":"style.css","content":".version-badge{display:inline-block;padding:0.2em 0.5em;font-size:0.75em;font-weight:bold;color:#e44bf4;background-color:#fce8fd;border:1px solid #f2a5f9;border-radius:4px;vertical-align:middle}.dark .version-badge{color:#f17afc;background-color:rgba(228, 75, 244, 0.2);border-color:#783d7e}"}],"page":{"pagePath":"api-reference/marvin-fns-fn","slug":"/api-reference/marvin-fns-fn","pageMetadata":{"title":"fn","description":null,"href":"/api-reference/marvin-fns-fn"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,hr:`hr`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`1`,id:`marvin-fns-fn`,children:_jsx(_components.code,{children:`marvin.fns.fn`})}),`\n`,_jsx(Heading,{level:`2`,id:`functions`,children:`Functions`}),`\n`,_jsx(Heading,{level:`3`,id:`fn`,children:_jsx(_components.code,{children:`fn`})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fn`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`func`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: Callable[P, T] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`|`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`instructions`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`agent`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: Agent `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`|`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`thread`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: Thread `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`|`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` str`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`prompt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) -> Callable[P, T]`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`A decorator that uses a function signature and arguments to define an AI task.`}),`\n`,_jsx(_components.p,{children:`The function body executes to provide additional context. Its return value is\ncontext for the model, not the generated result. Use an ellipsis body when\nno additional context is needed.`}),`\n`,_jsx(_components.p,{children:`Can be used with or without parameters:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`@fn`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` my_function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(): `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`...`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`@fn`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`instructions`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Be precise\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` my_function`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(): `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`...`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The decorated function accepts additional kwargs:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`_agent: Override the agent at call time`}),`\n`,_jsx(_components.li,{children:`_thread: Override the thread at call time`}),`\n`]}),`\n`,_jsx(_components.p,{children:`If the function does not have a return annotation, the result will be\nreturned as a string and attempted to be parsed as JSON.`}),`\n`,_jsx(_components.p,{children:`The decorated function also gains an as_task() method that returns the underlying\nmarvin Task without executing it.`}),`\n`,_jsx(_components.p,{children:`Args:\nfunc: The function to decorate\ninstructions: Optional instructions to guide the prediction\nagent: Optional custom agent to use\nthread: Optional thread for maintaining conversation context\nprompt: Optional prompt to use for the task. If not provided, the default\nprompt will be used.\nReturns:\nA wrapped function that returns the model-generated result`}),`\n`,_jsx(_components.hr,{}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Parent Module:`}),` `,_jsx(_components.a,{href:`marvin-fns`,children:_jsx(_components.code,{children:`fns`})})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"fn","description":null,"href":"/api-reference/marvin-fns-fn"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"marvin.fns.fn","slug":"marvin-fns-fn","depth":1,"children":[]},{"title":"Functions","slug":"functions","depth":2,"children":[{"title":"fn","slug":"fn","depth":3,"children":[]}]}],"codeExamples":{}},"jsLinks":[],"subdomain":"marvin","siteName":"Marvin","title":"fn - Marvin","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-27T20:33:12.071Z","originalFileLocation":"api-reference/marvin-fns-fn.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"Marvin\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/marvin/R24SIpPkASpChheR/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/marvin/R24SIpPkASpChheR/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/marvin/R24SIpPkASpChheR/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/marvin/R24SIpPkASpChheR/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/marvin/R24SIpPkASpChheR/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/marvin/R24SIpPkASpChheR/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/marvin/R24SIpPkASpChheR/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/marvin/R24SIpPkASpChheR/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/marvin/R24SIpPkASpChheR/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"fn - Marvin\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Marvin\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://askmarvin.ai/api-reference/marvin-fns-fn\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://marvin.mintlify.app/_mintlify/api/og/v2?division=fns\u0026amp;title=fn\u0026amp;theme=5d8cf43aab2d60350cef9ebe\u0026amp;signature=690a9840e0b0e8ec6a69544bcf3e6b95ca4fa8f507b9aa60f18001185409f07b\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"fn - Marvin\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://marvin.mintlify.app/_mintlify/api/og/v2?division=fns\u0026amp;title=fn\u0026amp;theme=5d8cf43aab2d60350cef9ebe\u0026amp;signature=690a9840e0b0e8ec6a69544bcf3e6b95ca4fa8f507b9aa60f18001185409f07b\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/marvin/R24SIpPkASpChheR/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Marvin\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#2D6DF6\">\u003clink data-mint-head rel=\"canonical\" href=\"https://askmarvin.ai/api-reference/marvin-fns-fn\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/marvin-fns-fn.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://askmarvin.ai/#organization\",\"name\":\"Marvin\",\"url\":\"https://askmarvin.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/marvin/ztPIIT7lOnW7ZsRP/assets/brand/marvin_mascot.jpeg?fit=max\u0026auto=format\u0026n=ztPIIT7lOnW7ZsRP\u0026q=85\u0026s=5793480b0b6ab2f5d05939e51b02f135\"}},{\"@type\":\"WebSite\",\"@id\":\"https://askmarvin.ai#website\",\"name\":\"Marvin\",\"url\":\"https://askmarvin.ai\",\"publisher\":{\"@id\":\"https://askmarvin.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://askmarvin.ai/api-reference/marvin-fns-fn#webpage\",\"url\":\"https://askmarvin.ai/api-reference/marvin-fns-fn\",\"name\":\"fn\",\"dateModified\":\"2026-10-27T20:33:12.071Z\",\"isPartOf\":{\"@id\":\"https://askmarvin.ai#website\"},\"breadcrumb\":{\"@id\":\"https://askmarvin.ai/api-reference/marvin-fns-fn#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://askmarvin.ai/api-reference/marvin-fns-fn#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"fns\",\"item\":\"https://askmarvin.ai/api-reference/marvin-fns\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"fn\",\"item\":\"https://askmarvin.ai/api-reference/marvin-fns-fn\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://askmarvin.ai/api-reference/marvin-fns-fn#article\",\"headline\":\"fn\",\"name\":\"fn\",\"url\":\"https://askmarvin.ai/api-reference/marvin-fns-fn\",\"mainEntityOfPage\":{\"@id\":\"https://askmarvin.ai/api-reference/marvin-fns-fn#webpage\"},\"dateModified\":\"2026-10-27T20:33:12.071Z\",\"publisher\":{\"@id\":\"https://askmarvin.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://askmarvin.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Marvin\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Marvin","nav":{"global":null,"anchors":[{"anchor":"Documentation","pages":[{"title":"Documentation","href":"/welcome"}]},{"anchor":"API Reference","groups":[{"group":"top level","pages":[{"title":"marvin","href":"/api-reference/marvin"}]},{"group":"agents","pages":[{"title":"agents","sidebarTitle":"Overview","href":"/api-reference/marvin-agents"},{"title":"actor","href":"/api-reference/marvin-agents-actor"},{"title":"agent","href":"/api-reference/marvin-agents-agent"},{"title":"names","href":"/api-reference/marvin-agents-names"},{"title":"team","href":"/api-reference/marvin-agents-team"}]},{"group":"beta","pages":[{"title":"beta","sidebarTitle":"Overview","href":"/api-reference/marvin-beta"},{"title":"observability","sidebarTitle":"Overview","href":"/api-reference/marvin-beta-observability"},{"title":"openai","href":"/api-reference/marvin-beta-observability-openai"}]},{"group":"cli","pages":[{"title":"cli","sidebarTitle":"Overview","href":"/api-reference/marvin-cli"},{"title":"config","href":"/api-reference/marvin-cli-config"},{"title":"dev","href":"/api-reference/marvin-cli-dev"},{"title":"main","href":"/api-reference/marvin-cli-main"},{"title":"migrations","href":"/api-reference/marvin-cli-migrations"}]},{"group":"database","pages":[{"title":"database","href":"/api-reference/marvin-database"}]},{"group":"defaults","pages":[{"title":"defaults","href":"/api-reference/marvin-defaults"}]},{"group":"engine","pages":[{"title":"engine","sidebarTitle":"Overview","href":"/api-reference/marvin-engine"},{"title":"end_turn","href":"/api-reference/marvin-engine-end_turn"},{"title":"events","href":"/api-reference/marvin-engine-events"},{"title":"llm","href":"/api-reference/marvin-engine-llm"},{"title":"orchestrator","href":"/api-reference/marvin-engine-orchestrator"},{"title":"streaming","href":"/api-reference/marvin-engine-streaming"}]},{"group":"fns","pages":[{"title":"fns","sidebarTitle":"Overview","href":"/api-reference/marvin-fns"},{"title":"cast","href":"/api-reference/marvin-fns-cast"},{"title":"classify","href":"/api-reference/marvin-fns-classify"},{"title":"extract","description":null,"href":"/api-reference/marvin-fns-extract"},{"title":"fn","href":"/api-reference/marvin-fns-fn"},{"title":"generate","description":null,"href":"/api-reference/marvin-fns-generate"},{"title":"plan","href":"/api-reference/marvin-fns-plan"},{"title":"run","href":"/api-reference/marvin-fns-run"},{"title":"say","href":"/api-reference/marvin-fns-say"},{"title":"summarize","href":"/api-reference/marvin-fns-summarize"}]},{"group":"handlers","pages":[{"title":"handlers","sidebarTitle":"Overview","href":"/api-reference/marvin-handlers"},{"title":"handlers","href":"/api-reference/marvin-handlers-handlers"},{"title":"print_handler","href":"/api-reference/marvin-handlers-print_handler"},{"title":"queue_handler","href":"/api-reference/marvin-handlers-queue_handler"}]},{"group":"instructions","pages":[{"title":"instructions","href":"/api-reference/marvin-instructions"}]},{"group":"memory","pages":[{"title":"memory","sidebarTitle":"Overview","href":"/api-reference/marvin-memory"},{"title":"memory","href":"/api-reference/marvin-memory-memory"},{"title":"providers","sidebarTitle":"Overview","href":"/api-reference/marvin-memory-providers"},{"title":"chroma","href":"/api-reference/marvin-memory-providers-chroma"},{"title":"lance","href":"/api-reference/marvin-memory-providers-lance"},{"title":"postgres","href":"/api-reference/marvin-memory-providers-postgres"},{"title":"qdrant","href":"/api-reference/marvin-memory-providers-qdrant"}]},{"group":"prompts","pages":[{"title":"prompts","href":"/api-reference/marvin-prompts"}]},{"group":"settings","pages":[{"title":"settings","href":"/api-reference/marvin-settings"}]},{"group":"tasks","pages":[{"title":"tasks","sidebarTitle":"Overview","href":"/api-reference/marvin-tasks"},{"title":"task","href":"/api-reference/marvin-tasks-task"}]},{"group":"thread","pages":[{"title":"thread","href":"/api-reference/marvin-thread"}]},{"group":"tools","pages":[{"title":"tools","sidebarTitle":"Overview","href":"/api-reference/marvin-tools"},{"title":"thread","href":"/api-reference/marvin-tools-thread"}]},{"group":"utilities","pages":[{"title":"utilities","sidebarTitle":"Overview","href":"/api-reference/marvin-utilities"},{"title":"asyncio","href":"/api-reference/marvin-utilities-asyncio"},{"title":"jinja","href":"/api-reference/marvin-utilities-jinja"},{"title":"jsonschema","href":"/api-reference/marvin-utilities-jsonschema"},{"title":"logging","href":"/api-reference/marvin-utilities-logging"},{"title":"models","href":"/api-reference/marvin-utilities-models"},{"title":"testing","href":"/api-reference/marvin-utilities-testing"},{"title":"tools","href":"/api-reference/marvin-utilities-tools"},{"title":"types","href":"/api-reference/marvin-utilities-types"}]}]}]},"basePath":"","title":"fn - Marvin","buildId":"dpl_9VVk5y1P8k1ATeJguVngy9Q3cmbD","deploymentId":"dpl_9VVk5y1P8k1ATeJguVngy9Q3cmbD","dynamics":[],"chunks":[]}