Cache tool results to avoid redundant computation and API calls.
Tool caching stores results for previously seen arguments, so repeated calls with the same input return instantly without re-executing the function.
Enabling Caching
Set cache_results=True on the @tool decorator:
from definable.tool.decorator import tool@tool(cache_results=True)def search_database(query: str) -> str: """Search the database (expensive operation).""" # This only runs once per unique query return expensive_db_query(query)
Cache TTL
Control how long cached results remain valid:
@tool(cache_results=True, cache_ttl=1800) # 30 minutesdef get_stock_price(symbol: str) -> str: """Get the current stock price.""" return fetch_price(symbol)
bool
default:"false"
Enable result caching for this tool.
int
default:"3600"
Cache time-to-live in seconds. Results older than this are re-fetched.
str
Directory to store cache files. Defaults to a system temp directory.
How It Works
When a tool is called, the arguments are serialized to a cache key
If a cached result exists and is within the TTL, it is returned immediately
If no cache hit, the function executes and the result is stored
Cache keys are based on the function name and a hash of the serialized arguments, so different inputs always produce different cache entries.
When to Use Caching
Caching works best for:
Expensive API calls — external search, database queries, web scraping
Deterministic functions — same input always produces the same output
Frequently repeated calls — agents that search for the same thing multiple times in a conversation
Do not cache tools with side effects (sending emails, writing to databases) or tools that return time-sensitive data where staleness matters.
Example: Caching an API Call
import httpxfrom definable.tool.decorator import tool@tool(cache_results=True, cache_ttl=300) # 5-minute cachedef get_weather(city: str) -> str: """Get current weather for a city.""" resp = httpx.get(f"https://api.weather.com/current?city={city}") data = resp.json() return f"{data['temp']}°F, {data['condition']}"
The first call for each city hits the API. Subsequent calls within 5 minutes return the cached result.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Definable AI","colors":{"primary":"#FA8112","light":"#FA8112","dark":"#FA8112"},"logo":{"light":"https://mintcdn.com/definableaiprivatelimited/mDNvZulDI7LGheEl/logo/light.svg?fit=max\u0026auto=format\u0026n=mDNvZulDI7LGheEl\u0026q=85\u0026s=4b85977f6a03ffc7ceaa9b818e5d7990","dark":"https://mintcdn.com/definableaiprivatelimited/mDNvZulDI7LGheEl/logo/dark.svg?fit=max\u0026auto=format\u0026n=mDNvZulDI7LGheEl\u0026q=85\u0026s=88f4a2faa73881a1af38ae9e48f83c11"},"favicon":"/favicon.svg","background":{"color":{"light":"#FAF3E1","dark":"#222222"}},"navbar":{"links":[{"href":"https://github.com/definable-ai/definable","label":"GitHub"}]},"footer":{"socials":{"github":"https://github.com/definable-ai"}},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"GitHub","icon":"github","href":"https://github.com/definable-ai/definable"},{"anchor":"PyPI","icon":"cube","href":"https://pypi.org/project/definable-ai/"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"definableaiprivatelimited","hasAudioNarration":false,"actualSubdomain":"definableaiprivatelimited","customDomains":["docs.definable.ai"],"gitSource":{"type":"github","owner":"definableai","repo":"definable.ai","deployBranch":"main","contentDirectory":"definable/docs","isPrivate":true,"mountPath":"","label":"","_id":"6b10d3309ffae5051c40c07e"},"entitlements":{},"buildId":"6ae94795d69537c8ab6fa802:success","clientVersion":"0.0.4453","searchFilterCounts":[{"language":"default","tag":"Documentation","count":127},{"language":"default","tag":"Basics","count":48},{"language":"default","tag":"Capabilities","count":41},{"language":"default","tag":"Examples","count":36},{"language":"default","tag":"Advanced","count":34},{"language":"default","tag":"Models","count":19},{"language":"default","tag":"Usage","count":17},{"language":"default","tag":"Interfaces","count":17},{"language":"default","tag":"Tools","count":15},{"language":"default","tag":"Agents","count":12}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"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":"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":"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":"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":"turbopuffer-dual-write","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":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"auth-vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"tools/creating-tools/caching","slug":"/tools/creating-tools/caching","pageMetadata":{"title":"Tool Caching","sidebarTitle":"Caching","description":"Cache tool results to avoid redundant computation and API calls.","icon":"database","href":"/tools/creating-tools/caching","hidden":false},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Cache tool results to avoid redundant computation and API calls.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"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={code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,ParamField,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!ParamField)_missingMdxReference(`ParamField`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Tool caching stores results for previously seen arguments, so repeated calls with the same input return instantly without re-executing the function.`}),`\n`,_jsx(Heading,{level:`2`,id:`enabling-caching`,children:`Enabling Caching`}),`\n`,_jsxs(_components.p,{children:[`Set `,_jsx(_components.code,{children:`cache_results=True`}),` on the `,_jsx(_components.code,{children:`@tool`}),` decorator:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,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:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` definable.tool.decorator `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tool`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`@tool`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`cache_results`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_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:` search_database`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`query`}),_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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) -> `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"Search the database (expensive operation).\"\"\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # This only runs once per unique query`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` expensive_db_query(query)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`cache-ttl`,children:`Cache TTL`}),`\n`,_jsx(_components.p,{children:`Control how long cached results remain valid:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,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:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`@tool`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`cache_results`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`cache_ttl`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1800`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 30 minutes`})]}),`\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:` get_stock_price`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`symbol`}),_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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) -> `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"Get the current stock price.\"\"\"`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` fetch_price(symbol)`})]}),`\n`]})})}),`\n`,_jsx(ParamField,{path:`cache_results`,type:`bool`,default:`false`,id:`param-cache-results`,children:_jsx(_components.p,{children:`Enable result caching for this tool.`})}),`\n`,_jsx(ParamField,{path:`cache_ttl`,type:`int`,default:`3600`,id:`param-cache-ttl`,children:_jsx(_components.p,{children:`Cache time-to-live in seconds. Results older than this are re-fetched.`})}),`\n`,_jsx(ParamField,{path:`cache_dir`,type:`str`,id:`param-cache-dir`,children:_jsx(_components.p,{children:`Directory to store cache files. Defaults to a system temp directory.`})}),`\n`,_jsx(Heading,{level:`2`,id:`how-it-works`,children:`How It Works`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`When a tool is called, the arguments are serialized to a cache key`}),`\n`,_jsx(_components.li,{children:`If a cached result exists and is within the TTL, it is returned immediately`}),`\n`,_jsx(_components.li,{children:`If no cache hit, the function executes and the result is stored`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Cache keys are based on the function name and a hash of the serialized arguments, so different inputs always produce different cache entries.`}),`\n`,_jsx(Heading,{level:`2`,id:`when-to-use-caching`,children:`When to Use Caching`}),`\n`,_jsx(_components.p,{children:`Caching works best for:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Expensive API calls`}),` — external search, database queries, web scraping`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Deterministic functions`}),` — same input always produces the same output`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Frequently repeated calls`}),` — agents that search for the same thing multiple times in a conversation`]}),`\n`]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`Do not cache tools with side effects (sending emails, writing to databases) or tools that return time-sensitive data where staleness matters.`})}),`\n`,_jsx(Heading,{level:`2`,id:`example-caching-an-api-call`,children:`Example: Caching an API Call`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`9`,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:`9`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` httpx`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` definable.tool.decorator `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tool`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`@tool`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`cache_results`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`cache_ttl`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`300`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# 5-minute cache`})]}),`\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:` get_weather`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`city`}),_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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) -> `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"Get current weather for a city.\"\"\"`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` resp `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` httpx.get(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://api.weather.com/current?city=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`city`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` data `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` resp.json()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`data[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'temp'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`°F, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`data[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'condition'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The first call for each city hits the API. Subsequent calls within 5 minutes return the cached result.`}),`\n`,_jsx(Heading,{level:`2`,id:`custom-cache-directory`,children:`Custom Cache Directory`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,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:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`@tool`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`cache_results`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`cache_dir`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"./cache/tools\"`}),_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:` expensive_analysis`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`text`}),_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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) -> `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"Run expensive text analysis.\"\"\"`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` analyze(text)`})]}),`\n`]})})})]})}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":"Tool Caching","sidebarTitle":"Caching","description":"Cache tool results to avoid redundant computation and API calls.","icon":"database","href":"/tools/creating-tools/caching","hidden":false}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Enabling Caching","slug":"enabling-caching","depth":2,"children":[]},{"title":"Cache TTL","slug":"cache-ttl","depth":2,"children":[]},{"title":"How It Works","slug":"how-it-works","depth":2,"children":[]},{"title":"When to Use Caching","slug":"when-to-use-caching","depth":2,"children":[]},{"title":"Example: Caching an API Call","slug":"example-caching-an-api-call","depth":2,"children":[]},{"title":"Custom Cache Directory","slug":"custom-cache-directory","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"definableaiprivatelimited","siteName":"Definable AI","title":"Tool Caching - Definable AI","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-02-25T20:56:07.988Z","originalFileLocation":"tools/creating-tools/caching.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=\"description\" content=\"Cache tool results to avoid redundant computation and API calls.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Definable AI\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/definableaiprivatelimited/Kfj4AiUCcTNUUhqf/_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/definableaiprivatelimited/Kfj4AiUCcTNUUhqf/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/definableaiprivatelimited/Kfj4AiUCcTNUUhqf/_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/definableaiprivatelimited/Kfj4AiUCcTNUUhqf/_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/definableaiprivatelimited/Kfj4AiUCcTNUUhqf/_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/definableaiprivatelimited/Kfj4AiUCcTNUUhqf/_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/definableaiprivatelimited/Kfj4AiUCcTNUUhqf/_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/definableaiprivatelimited/Kfj4AiUCcTNUUhqf/_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/definableaiprivatelimited/Kfj4AiUCcTNUUhqf/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Tool Caching - Definable AI\">\u003cmeta data-mint-head property=\"og:description\" content=\"Cache tool results to avoid redundant computation and API calls.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Definable AI\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.definable.ai/tools/creating-tools/caching\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://definableaiprivatelimited.mintlify.site/_mintlify/api/og/v2?division=Tools\u0026amp;title=Tool+Caching\u0026amp;description=Cache+tool+results+to+avoid+redundant+computation+and+API+calls.\u0026amp;theme=292dbdbb8f2a2bd1ee1ab5df\u0026amp;signature=43268d0e76972ed6df147228fd8aea787783451f1544ad2dfb00fae4391ff8f2\">\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=\"Tool Caching - Definable AI\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Cache tool results to avoid redundant computation and API calls.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://definableaiprivatelimited.mintlify.site/_mintlify/api/og/v2?division=Tools\u0026amp;title=Tool+Caching\u0026amp;description=Cache+tool+results+to+avoid+redundant+computation+and+API+calls.\u0026amp;theme=292dbdbb8f2a2bd1ee1ab5df\u0026amp;signature=43268d0e76972ed6df147228fd8aea787783451f1544ad2dfb00fae4391ff8f2\">\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/definableaiprivatelimited/Kfj4AiUCcTNUUhqf/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Definable AI\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#FA8112\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.definable.ai/tools/creating-tools/caching\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/tools/creating-tools/caching.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.definable.ai/#organization\",\"name\":\"Definable AI\",\"url\":\"https://docs.definable.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/definableaiprivatelimited/mDNvZulDI7LGheEl/logo/light.svg?fit=max\u0026auto=format\u0026n=mDNvZulDI7LGheEl\u0026q=85\u0026s=4b85977f6a03ffc7ceaa9b818e5d7990\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.definable.ai#website\",\"name\":\"Definable AI\",\"url\":\"https://docs.definable.ai\",\"publisher\":{\"@id\":\"https://docs.definable.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.definable.ai/tools/creating-tools/caching#webpage\",\"url\":\"https://docs.definable.ai/tools/creating-tools/caching\",\"name\":\"Tool Caching\",\"description\":\"Cache tool results to avoid redundant computation and API calls.\",\"dateModified\":\"2026-02-25T20:56:07.988Z\",\"isPartOf\":{\"@id\":\"https://docs.definable.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.definable.ai/tools/creating-tools/caching#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.definable.ai/tools/creating-tools/caching#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Capabilities\",\"item\":\"https://docs.definable.ai/tools/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tools\",\"item\":\"https://docs.definable.ai/tools/overview\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Tool Caching\",\"item\":\"https://docs.definable.ai/tools/creating-tools/caching\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.definable.ai/tools/creating-tools/caching#article\",\"headline\":\"Tool Caching\",\"name\":\"Tool Caching\",\"description\":\"Cache tool results to avoid redundant computation and API calls.\",\"url\":\"https://docs.definable.ai/tools/creating-tools/caching\",\"mainEntityOfPage\":{\"@id\":\"https://docs.definable.ai/tools/creating-tools/caching#webpage\"},\"dateModified\":\"2026-02-25T20:56:07.988Z\",\"publisher\":{\"@id\":\"https://docs.definable.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.definable.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Definable AI\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Definable AI\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/tools/creating-tools/caching.md","siteName":"Definable AI","nav":{"global":{"anchors":[{"anchor":"GitHub","icon":"github","href":"https://github.com/definable-ai/definable"},{"anchor":"PyPI","icon":"cube","href":"https://pypi.org/project/definable-ai/"}]},"tabs":[{"tab":"Documentation","groups":[{"group":"Get Started","pages":[{"title":"Definable","sidebarTitle":"Introduction","mode":"wide","href":"/introduction","hidden":false},{"title":"Your First Agent","mode":"wide","href":"/first-agent","hidden":false},{"title":"Quickstart","icon":"bolt","href":"/quickstart","hidden":false},{"title":"Installation","href":"/installation","hidden":false}]},{"group":"Basics","pages":[{"group":"Agents","pages":[{"title":"What are Agents?","sidebarTitle":"Overview","mode":"wide","href":"/agents/overview","hidden":false},{"title":"Building Agents","sidebarTitle":"Building Agents","mode":"wide","href":"/agents/building-agents","hidden":false},{"title":"Running Agents","sidebarTitle":"Running Agents","icon":"play","href":"/agents/running-agents","hidden":false},{"title":"Agent Configuration","sidebarTitle":"Configuration","icon":"gear","href":"/agents/configuration","hidden":false},{"group":"Usage","pages":[{"title":"Agent with Tools","href":"/agents/usage/agent-with-tools","hidden":false},{"title":"Agent with Knowledge","href":"/agents/usage/agent-with-knowledge","hidden":false},{"title":"Agent with Memory","href":"/agents/usage/agent-with-memory","hidden":false},{"title":"Agent with Structured Output","href":"/agents/usage/agent-with-structured-output","hidden":false},{"title":"Agent with Streaming","href":"/agents/usage/agent-with-streaming","hidden":false}]}]},{"group":"Teams","pages":[{"title":"What are Teams?","sidebarTitle":"Overview","mode":"wide","href":"/teams/overview","hidden":false},{"title":"Building Teams","sidebarTitle":"Building Teams","mode":"wide","href":"/teams/building-teams","hidden":false},{"title":"Running Teams","sidebarTitle":"Running Teams","href":"/teams/running-teams","hidden":false},{"title":"Delegation","sidebarTitle":"Delegation","href":"/teams/delegation","hidden":false},{"group":"Usage","pages":[{"title":"Coordinate Team","href":"/teams/usage/coordinate-team","hidden":false},{"title":"Route Team","href":"/teams/usage/route-team","hidden":false},{"title":"Collaborate Team","href":"/teams/usage/collaborate-team","hidden":false},{"title":"Tasks Team","href":"/teams/usage/tasks-team","hidden":false}]}]},{"group":"Workflows","pages":[{"title":"What are Workflows?","sidebarTitle":"Overview","mode":"wide","href":"/workflows/overview","hidden":false},{"title":"Building Workflows","sidebarTitle":"Building Workflows","mode":"wide","href":"/workflows/building-workflows","hidden":false},{"title":"Running Workflows","sidebarTitle":"Running Workflows","href":"/workflows/running-workflows","hidden":false},{"group":"Patterns","pages":[{"title":"Sequential Workflow","sidebarTitle":"Sequential","href":"/workflows/patterns/sequential","hidden":false},{"title":"Parallel Workflow","sidebarTitle":"Parallel","href":"/workflows/patterns/parallel","hidden":false},{"title":"Conditional Workflow","sidebarTitle":"Conditional","href":"/workflows/patterns/conditional","hidden":false},{"title":"Loop Workflow","sidebarTitle":"Loop","href":"/workflows/patterns/loop","hidden":false},{"title":"Router Workflow","sidebarTitle":"Router","href":"/workflows/patterns/router","hidden":false}]},{"group":"Usage","pages":[{"title":"Basic Workflow","href":"/workflows/usage/basic-workflow","hidden":false},{"title":"Nested Workflows","href":"/workflows/usage/nested-workflows","hidden":false}]}]},{"group":"Input \u0026 Output","pages":[{"title":"Structured Output","sidebarTitle":"Structured Output","href":"/input-output/structured-output","hidden":false},{"title":"Streaming","sidebarTitle":"Streaming","href":"/input-output/streaming","hidden":false},{"title":"Multimodal Input","sidebarTitle":"Multimodal","href":"/input-output/multimodal","hidden":false}]},{"group":"Models","pages":[{"title":"What are Models?","sidebarTitle":"Overview","icon":"microchip","mode":"wide","href":"/models/overview","hidden":false},{"title":"Model as String","sidebarTitle":"String Shorthand","href":"/models/model-as-string","hidden":false},{"group":"Providers","pages":[{"title":"OpenAI","icon":"brain","href":"/models/openai","hidden":false},{"title":"Anthropic","href":"/models/anthropic","hidden":false},{"title":"Google Gemini","href":"/models/google","hidden":false},{"title":"DeepSeek","icon":"bolt","href":"/models/deepseek","hidden":false},{"title":"Mistral","href":"/models/mistral","hidden":false},{"title":"Moonshot","icon":"moon","href":"/models/moonshot","hidden":false},{"title":"xAI","icon":"magnifying-glass","href":"/models/xai","hidden":false},{"title":"Perplexity","href":"/models/perplexity","hidden":false},{"title":"Ollama","href":"/models/ollama","hidden":false},{"title":"OpenRouter","href":"/models/openrouter","hidden":false},{"title":"OpenAI-Like Providers","sidebarTitle":"OpenAI-Like","icon":"plug","href":"/models/openai-like","hidden":false}]},{"title":"Model Resilience","sidebarTitle":"Resilience","href":"/models/resilience","hidden":false},{"title":"Streaming","icon":"bars-staggered","href":"/models/streaming","hidden":false},{"title":"Structured Output","icon":"code","href":"/models/structured-output","hidden":false},{"title":"Vision \u0026 Audio","icon":"image","href":"/models/vision-and-audio","hidden":false},{"title":"Metrics \u0026 Pricing","icon":"chart-line","href":"/models/metrics-and-pricing","hidden":false}]}]},{"group":"Capabilities","pages":[{"group":"Tools","pages":[{"title":"What are Tools?","sidebarTitle":"Overview","mode":"wide","href":"/tools/overview","hidden":false},{"title":"Creating Tools","sidebarTitle":"Overview","href":"/tools/creating-tools/overview","hidden":false},{"title":"Tool Parameters","sidebarTitle":"Parameters","icon":"list","href":"/tools/creating-tools/parameters","hidden":false},{"title":"Tool Hooks","sidebarTitle":"Hooks","description":"Run logic before and after tool execution.","icon":"anchor","href":"/tools/creating-tools/hooks","hidden":false},{"title":"Tool Caching","sidebarTitle":"Caching","icon":"database","href":"/tools/creating-tools/caching","hidden":false},{"title":"Async Tools","sidebarTitle":"Async Tools","description":"Define asynchronous tools for non-blocking operations.","icon":"rotate","href":"/tools/creating-tools/async-tools","hidden":false},{"title":"Tool Dependencies","sidebarTitle":"Dependencies","icon":"puzzle-piece","href":"/tools/creating-tools/dependencies","hidden":false},{"group":"Toolkits","pages":[{"title":"Toolkits Overview","sidebarTitle":"Overview","icon":"toolbox","href":"/toolkits/overview","hidden":false},{"title":"KnowledgeToolkit","icon":"book","href":"/toolkits/knowledge-toolkit","hidden":false},{"title":"MCPToolkit","icon":"plug","href":"/toolkits/mcp-toolkit","hidden":false}]},{"group":"Built-in Skills","pages":[{"title":"Skills Overview","sidebarTitle":"Overview","icon":"puzzle-piece","href":"/skills/overview","hidden":false},{"title":"Built-in Skills","sidebarTitle":"Built-in Skills","icon":"toolbox","href":"/skills/built-in","hidden":false},{"title":"MacOS Skill","sidebarTitle":"MacOS","icon":"apple","href":"/skills/macos","hidden":false},{"title":"Skill Registry","sidebarTitle":"Skill Registry","icon":"book","href":"/skills/registry","hidden":false}]}]},{"group":"Knowledge \u0026 RAG","pages":[{"title":"Knowledge Overview","sidebarTitle":"Overview","icon":"book","href":"/knowledge/overview","hidden":false},{"title":"Documents","icon":"file-lines","href":"/knowledge/documents","hidden":false},{"title":"Agent Integration","sidebarTitle":"Agent Integration","icon":"robot","href":"/knowledge/agent-integration","hidden":false},{"title":"Hybrid Search \u0026 Scoring","sidebarTitle":"Hybrid Search","icon":"magnifying-glass-chart","href":"/knowledge/hybrid-search","hidden":false},{"group":"Pipeline","pages":[{"title":"Readers","icon":"file-import","href":"/knowledge/pipeline/readers","hidden":false},{"title":"Chunkers","icon":"scissors","href":"/knowledge/pipeline/chunkers","hidden":false},{"title":"Embedders","icon":"vector-square","href":"/knowledge/pipeline/embedders","hidden":false},{"title":"Rerankers","icon":"ranking-star","href":"/knowledge/pipeline/rerankers","hidden":false},{"title":"Vector Databases","sidebarTitle":"Vector Databases","icon":"database","href":"/knowledge/pipeline/vector-databases","hidden":false}]},{"group":"Usage","pages":[{"title":"Basic RAG","href":"/knowledge/usage/basic-rag","hidden":false},{"title":"Hybrid Search","href":"/knowledge/usage/hybrid-search-example","hidden":false}]}]},{"group":"Memory","pages":[{"title":"Memory Overview","sidebarTitle":"Overview","icon":"brain","href":"/memory/overview","hidden":false},{"title":"Memory Stores","sidebarTitle":"Stores","icon":"database","href":"/memory/stores","hidden":false},{"title":"Agent Integration","sidebarTitle":"Agent Integration","icon":"link","href":"/memory/agent-integration","hidden":false}]},{"group":"Reasoning","pages":[{"title":"Thinking","sidebarTitle":"Thinking","href":"/reasoning/thinking","hidden":false},{"title":"Deep Research","sidebarTitle":"Deep Research","href":"/reasoning/deep-research","hidden":false}]},{"group":"MCP","pages":[{"title":"MCP Overview","sidebarTitle":"Overview","icon":"plug","href":"/mcp/overview","hidden":false},{"title":"Getting Started with MCP","sidebarTitle":"Getting Started","icon":"rocket","href":"/mcp/getting-started","hidden":false},{"title":"MCP Configuration","sidebarTitle":"Configuration","icon":"gear","href":"/mcp/configuration","hidden":false},{"title":"MCP Resources","sidebarTitle":"Resources","icon":"folder-open","href":"/mcp/resources","hidden":false},{"title":"MCP Prompts","sidebarTitle":"Prompts","icon":"message","href":"/mcp/prompts","hidden":false},{"title":"MCP Error Handling","sidebarTitle":"Error Handling","icon":"triangle-exclamation","href":"/mcp/error-handling","hidden":false},{"title":"Mock MCP Servers","sidebarTitle":"Mock Servers","icon":"flask-vial","href":"/mcp/mock-servers","hidden":false}]},{"group":"Readers","pages":[{"title":"File Readers","sidebarTitle":"Overview","icon":"file-lines","href":"/readers/overview","hidden":false}]},{"group":"Browser","pages":[{"title":"Browser Toolkit","sidebarTitle":"Overview","icon":"globe","href":"/browser/overview","hidden":false}]},{"group":"Tracing","pages":[{"title":"Tracing","icon":"chart-gantt","href":"/agents/tracing","hidden":false}]},{"group":"Evaluation","pages":[{"title":"Evaluation","sidebarTitle":"Evaluation","icon":"chart-bar","href":"/agents/evaluation","hidden":false}]}]},{"group":"Advanced","pages":[{"group":"Interfaces","pages":[{"title":"Interfaces Overview","sidebarTitle":"Overview","icon":"message-bot","href":"/interfaces/overview","hidden":false},{"group":"Platforms","pages":[{"title":"Telegram","icon":"paper-plane","href":"/interfaces/telegram","hidden":false},{"title":"Discord","icon":"discord","href":"/interfaces/discord","hidden":false},{"title":"Slack","icon":"slack","href":"/interfaces/slack","hidden":false},{"title":"WebSocket","sidebarTitle":"WebSocket","href":"/interfaces/websocket","hidden":false},{"title":"WhatsApp","sidebarTitle":"WhatsApp","icon":"comment-dots","href":"/interfaces/whatsapp"},{"title":"Email","sidebarTitle":"Email","href":"/interfaces/email","hidden":false},{"title":"Call (Voice)","icon":"phone","href":"/interfaces/call","hidden":false},{"title":"Custom Interfaces","sidebarTitle":"Custom Interfaces","icon":"code","href":"/interfaces/custom-interfaces","hidden":false}]},{"group":"Usage","pages":[{"title":"Telegram Bot","href":"/interfaces/usage/telegram-bot","hidden":false},{"title":"Discord Bot","href":"/interfaces/usage/discord-bot","hidden":false},{"title":"Slack Bot","href":"/interfaces/usage/slack-bot","hidden":false},{"title":"Multi-Platform Agent","href":"/interfaces/usage/multi-platform","hidden":false}]},{"title":"Sessions","icon":"clock-rotate-left","href":"/interfaces/sessions","hidden":false},{"title":"Interface Hooks","sidebarTitle":"Hooks","icon":"anchor","href":"/interfaces/hooks","hidden":false},{"title":"Identity Resolution","sidebarTitle":"Identity","icon":"fingerprint","href":"/interfaces/identity","hidden":false},{"title":"Multi-Interface Serving","sidebarTitle":"Multi-Interface","icon":"server","href":"/interfaces/multi-interface","hidden":false}]},{"group":"Security","pages":[{"title":"Security","sidebarTitle":"Security","icon":"shield-halved","href":"/agents/security","hidden":false}]},{"group":"Guardrails","pages":[{"title":"Guardrails Overview","sidebarTitle":"Overview","icon":"shield","href":"/guardrails/overview","hidden":false}]},{"group":"Plugins","pages":[{"title":"Plugins","sidebarTitle":"Plugins","href":"/agents/plugins","hidden":false}]},{"group":"Scheduling","pages":[{"title":"Scheduling","sidebarTitle":"Scheduling","href":"/agents/scheduling","hidden":false}]},{"title":"Middleware","icon":"layer-group","href":"/agents/middleware","hidden":false},{"title":"Multi-Turn Conversations","sidebarTitle":"Multi-Turn","icon":"comments","href":"/agents/multi-turn","hidden":false},{"title":"Agentic Loop","sidebarTitle":"Agentic Loop","icon":"rotate","href":"/agents/agentic-loop","hidden":false},{"title":"Testing","icon":"flask-vial","href":"/agents/testing","hidden":false},{"title":"Authentication","sidebarTitle":"Authentication","icon":"lock","href":"/agents/auth","hidden":false},{"title":"Agent Runtime","sidebarTitle":"Runtime","icon":"server","href":"/agents/runtime","hidden":false},{"title":"Error Handling","icon":"shield","href":"/advanced/error-handling","hidden":false},{"title":"Cost Tracking","icon":"dollar-sign","href":"/advanced/cost-tracking","hidden":false},{"title":"Run Output \u0026 Events","sidebarTitle":"Run Output","icon":"square-poll-vertical","href":"/advanced/run-output","hidden":false},{"title":"Media Types","icon":"photo-film","href":"/advanced/media-types","hidden":false},{"title":"Replay Overview","sidebarTitle":"Overview","icon":"rotate","href":"/replay/overview","hidden":false},{"title":"Observability Dashboard","sidebarTitle":"Overview","icon":"chart-line","href":"/observability/overview","hidden":false},{"title":"Claude Code Agent","href":"/claude-code/overview","hidden":false}]}]},{"tab":"Examples","pages":[{"title":"Examples","href":"/examples/overview"}]},{"tab":"Reference","pages":[{"title":"Reference","href":"/reference/agents/agent"}]}]},"basePath":"","title":"Tool Caching - Definable AI","deploymentId":"dpl_BLZw3QngerHodH9E8mGgC4v752y3","buildId":"dpl_BLZw3QngerHodH9E8mGgC4v752y3","dynamics":[],"chunks":[]}