In enforce mode, the harness can take four actions at each decision boundary:
Action
Effect
allow
Proceed with the original model
switch_model
Route to a different model
deny_tool
Block a tool call
stop
Halt the run (budget exceeded, policy violation)
{"docsConfig":{"theme":"palm","$schema":"https://mintlify.com/docs.json","name":"cascadeflow","colors":{"primary":"#0E7490","light":"#22D3EE","dark":"#0E7490"},"logo":{"light":"https://mintcdn.com/cascadeflow/XBH9iEf5YbNVfBQt/logo/cascadeflow-light.svg?fit=max\u0026auto=format\u0026n=XBH9iEf5YbNVfBQt\u0026q=85\u0026s=6d5fa0dba985df928922d85669644099","dark":"https://mintcdn.com/cascadeflow/XBH9iEf5YbNVfBQt/logo/cascadeflow-dark.svg?fit=max\u0026auto=format\u0026n=XBH9iEf5YbNVfBQt\u0026q=85\u0026s=96c554bf12d4e92756d217c8fd45897c","href":"https://cascadeflow.ai"},"favicon":"https://mintcdn.com/cascadeflow/XBH9iEf5YbNVfBQt/favicon.svg?fit=max\u0026auto=format\u0026n=XBH9iEf5YbNVfBQt\u0026q=85\u0026s=d87c83822db83e73da36af845a48af11","navbar":{"links":[{"href":"https://cascadeflow.ai","label":"Home"},{"href":"https://pypi.org/project/cascadeflow/","label":"PyPI"},{"href":"https://www.npmjs.com/package/@cascadeflow/core","label":"npm"}],"primary":{"type":"github","href":"https://github.com/lemony-ai/cascadeflow"}},"footer":{"socials":{"website":"https://cascadeflow.ai","github":"https://github.com/lemony-ai/cascadeflow","x":"https://x.com/saschabuehrle","linkedin":"https://www.linkedin.com/company/lemony-ai"},"links":[{"header":"Packages","items":[{"label":"PyPI","href":"https://pypi.org/project/cascadeflow"},{"label":"npm","href":"https://www.npmjs.com/package/@cascadeflow/core"}]},{"header":"Resources","items":[{"label":"Changelog","href":"/changelog"},{"label":"Contributing","href":"/contributing"},{"label":"For Coding Agents","href":"/for-coding-agents"}]}]},"contextual":{"options":["copy","view","chatgpt","claude","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"Website","icon":"globe","href":"https://cascadeflow.ai"},{"anchor":"GitHub","icon":"github","href":"https://github.com/lemony-ai/cascadeflow"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"cascadeflow","hasAudioNarration":false,"actualSubdomain":"cascadeflow","customDomains":["docs.cascadeflow.ai"],"gitSource":{"type":"github","owner":"lemony-ai","repo":"cascadeflow","deployBranch":"main","contentDirectory":"docs-site","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6a904592fe5feb54075ca2a1","collectionId":"430c8883-9ae1-406f-a9a8-f2a3cab171e6","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6a904592fe5feb54075ca2a1"},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6a904592fe5feb54075ca2a1","clientVersion":"0.0.3902","searchFilterCounts":[{"language":"default","tag":"Documentation","count":39},{"language":"default","tag":"API Reference","count":27},{"language":"default","tag":"Python","count":14},{"language":"default","tag":"Examples","count":14},{"language":"default","tag":"TypeScript","count":13},{"language":"default","tag":"Integrations","count":10},{"language":"default","tag":"Getting Started","count":8},{"language":"default","tag":"Harness","count":8},{"language":"default","tag":"Guides","count":6},{"language":"default","tag":"Resources","count":3}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"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":"editor-v7-file-tree","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":"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":"pause-universal-search-reconcile","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":"per-site-search-delta","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":"editor-branches-v2-autocommit","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-branches-v2","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":"editor-private-page-search","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":"teamspace","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":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","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":"byok-sep-25","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":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"client-snapshot-docs-config","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}],"isAtlas":false,"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"api-reference/python/overview","slug":"/api-reference/python/overview","pageMetadata":{"title":"Python API","sidebarTitle":"Overview","description":"Python API reference for cascadeflow — the three-tier harness API and supporting types.","href":"/api-reference/python/overview"},"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: \"Python API reference for cascadeflow — the three-tier harness API and supporting types.\"\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={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`1`,id:`python-api-reference`,children:`Python API Reference`}),`\n`,_jsx(_components.p,{children:`cascadeflow exposes a three-tier API for Python. Each tier adds more control.`}),`\n`,_jsx(Heading,{level:`2`,id:`quick-start`,children:`Quick Start`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`14`,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:`14`,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:` cascadeflow`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Tier 1: Global activation`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`cascadeflow.init(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`mode`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"observe\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Tier 2: Scoped run with constraints`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`with`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` cascadeflow.run(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`budget`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.50`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` session:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` result `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` agent.run(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Analyze this data\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(session.summary())`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Tier 3: Per-agent policy`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`@cascadeflow.agent`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`budget`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.20`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`compliance`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"gdpr\"`}),_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:`async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` my_agent`}),_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:`):`})]}),`\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\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` llm.complete(query)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`api-surface`,children:`API Surface`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Function`}),_jsx(_components.th,{children:`Purpose`}),_jsx(_components.th,{children:`Docs`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`cascadeflow.init()`})}),_jsx(_components.td,{children:`Activate the harness globally`}),_jsx(_components.td,{children:_jsx(_components.a,{href:`/api-reference/python/init`,children:`Reference`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`cascadeflow.run()`})}),_jsx(_components.td,{children:`Create a scoped run context with constraints`}),_jsx(_components.td,{children:_jsx(_components.a,{href:`/api-reference/python/run`,children:`Reference`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`@cascadeflow.agent()`})}),_jsx(_components.td,{children:`Attach per-agent policy`}),_jsx(_components.td,{children:_jsx(_components.a,{href:`/api-reference/python/agent-decorator`,children:`Reference`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`HarnessConfig`})}),_jsx(_components.td,{children:`Full configuration dataclass`}),_jsx(_components.td,{children:_jsx(_components.a,{href:`/api-reference/python/harness-config`,children:`Reference`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`HarnessRunContext`})}),_jsxs(_components.td,{children:[`Session object with `,_jsx(_components.code,{children:`summary()`}),` and `,_jsx(_components.code,{children:`trace()`})]}),_jsx(_components.td,{children:_jsx(_components.a,{href:`/api-reference/python/run-context`,children:`Reference`})})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`install`,children:`Install`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,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:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`pip`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` cascadeflow`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`With framework extras:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`shellscript`,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:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`pip`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"cascadeflow[langchain]\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`pip`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"cascadeflow[openai-agents]\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`pip`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"cascadeflow[crewai]\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`pip`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"cascadeflow[google-adk]\"`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`modes`,children:`Modes`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Mode`}),_jsx(_components.th,{children:`Behavior`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`off`})}),_jsx(_components.td,{children:`Disabled — no tracking, no enforcement`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`observe`})}),_jsx(_components.td,{children:`Track all calls, log what would happen, enforce nothing`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`enforce`})}),_jsx(_components.td,{children:`Active control — budget caps, model switching, stop actions`})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`actions`,children:`Actions`}),`\n`,_jsx(_components.p,{children:`In enforce mode, the harness can take four actions at each decision boundary:`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Action`}),_jsx(_components.th,{children:`Effect`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`allow`})}),_jsx(_components.td,{children:`Proceed with the original model`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`switch_model`})}),_jsx(_components.td,{children:`Route to a different model`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`deny_tool`})}),_jsx(_components.td,{children:`Block a tool call`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`stop`})}),_jsx(_components.td,{children:`Halt the run (budget exceeded, policy violation)`})]})]})]})]})}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":"Python API","sidebarTitle":"Overview","description":"Python API reference for cascadeflow — the three-tier harness API and supporting types.","href":"/api-reference/python/overview"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Python API Reference","slug":"python-api-reference","depth":1,"children":[]},{"title":"Quick Start","slug":"quick-start","depth":2,"children":[]},{"title":"API Surface","slug":"api-surface","depth":2,"children":[]},{"title":"Install","slug":"install","depth":2,"children":[]},{"title":"Modes","slug":"modes","depth":2,"children":[]},{"title":"Actions","slug":"actions","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"cascadeflow","siteName":"cascadeflow","title":"Python API - cascadeflow","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-03-06T15:51:45.095Z","originalFileLocation":"api-reference/python/overview.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=\"Python API reference for cascadeflow — the three-tier harness API and supporting types.\">\u003cmeta data-mint-head name=\"application-name\" content=\"cascadeflow\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/cascadeflow/LunE6ki4gQkyanrJ/_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/cascadeflow/LunE6ki4gQkyanrJ/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/cascadeflow/LunE6ki4gQkyanrJ/_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/cascadeflow/LunE6ki4gQkyanrJ/_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/cascadeflow/LunE6ki4gQkyanrJ/_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/cascadeflow/LunE6ki4gQkyanrJ/_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/cascadeflow/LunE6ki4gQkyanrJ/_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/cascadeflow/LunE6ki4gQkyanrJ/_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/cascadeflow/LunE6ki4gQkyanrJ/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Python API - cascadeflow\">\u003cmeta data-mint-head property=\"og:description\" content=\"Python API reference for cascadeflow — the three-tier harness API and supporting types.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"cascadeflow\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.cascadeflow.ai/api-reference/python/overview\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Python API - cascadeflow\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Python API reference for cascadeflow — the three-tier harness API and supporting types.\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/cascadeflow/LunE6ki4gQkyanrJ/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"cascadeflow\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0E7490\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.cascadeflow.ai/api-reference/python/overview\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/python/overview.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.cascadeflow.ai/#organization\",\"name\":\"cascadeflow\",\"url\":\"https://docs.cascadeflow.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/cascadeflow/XBH9iEf5YbNVfBQt/logo/cascadeflow-light.svg?fit=max\u0026auto=format\u0026n=XBH9iEf5YbNVfBQt\u0026q=85\u0026s=6d5fa0dba985df928922d85669644099\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.cascadeflow.ai#website\",\"name\":\"cascadeflow\",\"url\":\"https://docs.cascadeflow.ai\",\"publisher\":{\"@id\":\"https://docs.cascadeflow.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.cascadeflow.ai/api-reference/python/overview#webpage\",\"url\":\"https://docs.cascadeflow.ai/api-reference/python/overview\",\"name\":\"Python API\",\"description\":\"Python API reference for cascadeflow — the three-tier harness API and supporting types.\",\"dateModified\":\"2026-03-06T15:51:45.095Z\",\"isPartOf\":{\"@id\":\"https://docs.cascadeflow.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.cascadeflow.ai/api-reference/python/overview#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.cascadeflow.ai/api-reference/python/overview#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"cascadeflow\",\"item\":\"https://docs.cascadeflow.ai\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python API\",\"item\":\"https://docs.cascadeflow.ai/api-reference/python/overview\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.cascadeflow.ai/api-reference/python/overview#article\",\"headline\":\"Python API\",\"name\":\"Python API\",\"description\":\"Python API reference for cascadeflow — the three-tier harness API and supporting types.\",\"url\":\"https://docs.cascadeflow.ai/api-reference/python/overview\",\"mainEntityOfPage\":{\"@id\":\"https://docs.cascadeflow.ai/api-reference/python/overview#webpage\"},\"dateModified\":\"2026-03-06T15:51:45.095Z\",\"publisher\":{\"@id\":\"https://docs.cascadeflow.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.cascadeflow.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"cascadeflow\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"cascadeflow","nav":{"global":{"anchors":[{"anchor":"Website","icon":"globe","href":"https://cascadeflow.ai"},{"anchor":"GitHub","icon":"github","href":"https://github.com/lemony-ai/cascadeflow"}]},"tabs":[{"tab":"Documentation","icon":"book-open","pages":[{"title":"Documentation","href":""}]},{"tab":"API Reference","icon":"code","groups":[{"group":"Python","pages":[{"title":"Python API","sidebarTitle":"Overview","href":"/api-reference/python/overview"},{"title":"cascadeflow.init()","description":"Activate the cascadeflow harness globally with a mode and optional configuration.","href":"/api-reference/python/init"},{"title":"cascadeflow.run()","href":"/api-reference/python/run"},{"title":"@cascadeflow.agent()","href":"/api-reference/python/agent-decorator"},{"title":"CascadeAgent","href":"/api-reference/python/cascade-agent"},{"title":"ModelConfig","href":"/api-reference/python/model-config"},{"title":"CascadeResult","href":"/api-reference/python/cascade-result"},{"title":"HarnessConfig","href":"/api-reference/python/harness-config"},{"title":"HarnessRunContext","href":"/api-reference/python/run-context"},{"title":"Tools","href":"/api-reference/python/tools"},{"title":"Streaming","href":"/api-reference/python/streaming"},{"title":"Presets","href":"/api-reference/python/presets"},{"title":"Errors","href":"/api-reference/python/errors"},{"title":"Environment Variables","href":"/api-reference/python/environment"}]},{"group":"TypeScript","pages":[{"title":"TypeScript API","sidebarTitle":"Overview","href":"/api-reference/typescript/overview"},{"title":"@cascadeflow/core","href":"/api-reference/typescript/core"},{"title":"Harness","href":"/api-reference/typescript/harness"},{"title":"CascadeAgent","href":"/api-reference/typescript/cascade-agent"},{"title":"Configuration","href":"/api-reference/typescript/configuration"},{"title":"CascadeResult","href":"/api-reference/typescript/result"},{"title":"Providers","href":"/api-reference/typescript/providers"},{"title":"Tools","href":"/api-reference/typescript/tools"},{"title":"Quality and Routing","href":"/api-reference/typescript/quality-routing"},{"title":"Streaming","href":"/api-reference/typescript/streaming"},{"title":"@cascadeflow/vercel-ai","href":"/api-reference/typescript/vercel-ai"},{"title":"@cascadeflow/langchain","href":"/api-reference/typescript/langchain"},{"title":"Python and TypeScript Parity","sidebarTitle":"Feature Parity","href":"/api-reference/typescript/feature-parity"}]}]},{"tab":"Examples","icon":"flask","pages":[{"title":"Examples","href":"/examples/catalog"}]}]},"title":"Python API - cascadeflow","buildId":"dpl_C3fsfi1EcrBns9Vx91gUSN1X3Hi4","deploymentId":"dpl_C3fsfi1EcrBns9Vx91gUSN1X3Hi4","dynamics":[],"chunks":[]}