Brane gives AI agents policy control by evaluating Python policies before and after capability execution.
Policy control for AI agents means enforcing explicit rules when an agent attempts to act. Brane provides policy control by evaluating Python policy functions before and after capability execution.Policies receive a structured PolicyContext and return a structured Decision.
After policies run after execution and can inspect output. Use them to detect oversized outputs, unexpected schemas, PII, secrets, or policy violations after the capability returns.
@runtime.after_capability("call_model")def block_secret_leak(ctx): if "SECRET_KEY" in str(ctx.output or ""): return Decision(type="deny", reason="Possible secret in output") return Decision(type="allow")
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Brane","description":"Runtime control for AI agents. Write Python policies that govern tool calls, model calls, memory, retrieval, MCP tools, and other agent actions.","colors":{"primary":"#315bdc","light":"#315bdc","dark":"#2347b8"},"logo":{"light":"https://mintcdn.com/agl-89d5dad7/pIrZ3N8MXbSA2YaT/images/membrane.png?fit=max\u0026auto=format\u0026n=pIrZ3N8MXbSA2YaT\u0026q=85\u0026s=af60e279b079710c0f70afe7b88578cf","dark":"https://mintcdn.com/agl-89d5dad7/pIrZ3N8MXbSA2YaT/images/membrane.png?fit=max\u0026auto=format\u0026n=pIrZ3N8MXbSA2YaT\u0026q=85\u0026s=af60e279b079710c0f70afe7b88578cf","href":"https://membranelabs.org/brane"},"favicon":"https://mintlify.s3.us-west-1.amazonaws.com/agl-89d5dad7/favicon.ico","appearance":{"default":"light","strict":false},"navbar":{"links":[{"href":"https://membranelabs.org","label":"Membrane Labs"},{"href":"https://membranelabs.org/research","label":"Research"},{"href":"https://github.com/MembraneLabs","type":"github"}],"primary":{"type":"button","label":"Private beta","href":"https://membranelabs.org/brane/private-beta"}},"footer":{"socials":{"github":"https://github.com/MembraneLabs","x":"https://x.com/MLabsResearch","website":"https://membranelabs.org"},"links":[{"header":"Product","items":[{"label":"Brane","href":"https://membranelabs.org/brane"},{"label":"Private beta","href":"https://membranelabs.org/brane/private-beta"}]},{"header":"Company","items":[{"label":"People","href":"https://membranelabs.org/people"},{"label":"Research","href":"https://membranelabs.org/research"}]}]},"search":{"prompt":"Search Brane docs..."},"seo":{"metatags":{"keywords":"Brane, Membrane Labs, AI agent guardrails, AI agent governance, policy-as-code for AI agents, agent runtime control, tool call governance, MCP tool governance, OpenAI Agents SDK guardrails, LangGraph guardrails, CrewAI guardrails","og:site_name":"Brane Documentation","twitter:site":"@MLabsResearch","twitter:creator":"@MLabsResearch"},"indexing":"navigable"},"icons":{"library":"lucide"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"agl-89d5dad7","hasAudioNarration":false,"actualSubdomain":"agl-89d5dad7","customDomains":["docs.brane.membranelabs.org"],"gitSource":{"type":"github","owner":"membranelabs","repo":"brane-core","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6a21ebd77fd5f14b8ebb27fd","collectionId":"f7bf3a6d-b04b-443e-b510-8de849979a44","schemaVersion":"v2"},"feedback":{"thumbs":true,"edits":false,"issues":false,"agentFeedback":true},"entitlements":{},"buildId":"6a21ebd77fd5f14b8ebb27fd:success","clientVersion":"0.0.4043","searchFilterCounts":[{"language":"default","tag":"Answer Guides","count":9},{"language":"default","tag":"Core Model","count":5},{"language":"default","tag":"Build With Python","count":4},{"language":"default","tag":"Start Here","count":3},{"language":"default","tag":"Recipes","count":2},{"language":"default","tag":"Reference","count":1}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":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":"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":"byok-sep-25","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":"billing-updated-9-15","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}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"guides/policy-control-for-ai-agents","slug":"/guides/policy-control-for-ai-agents","pageMetadata":{"title":"Policy Control For AI Agents","description":"Brane gives AI agents policy control by evaluating Python policies before and after capability execution.","href":"/guides/policy-control-for-ai-agents"},"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: \"Brane gives AI agents policy control by evaluating Python policies before and after capability execution.\"\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`,li:`li`,p:`p`,pre:`pre`,span:`span`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._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(_components.p,{children:`Policy control for AI agents means enforcing explicit rules when an agent attempts to act. Brane provides policy control by evaluating Python policy functions before and after capability execution.`}),`\n`,_jsxs(_components.p,{children:[`Policies receive a structured `,_jsx(_components.a,{href:`/concepts/policy-context`,children:`PolicyContext`}),` and return a structured `,_jsx(_components.a,{href:`/concepts/decision`,children:`Decision`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`policy-control-loop`,children:`Policy Control Loop`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`text`,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:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Capability + AgentAction + PolicyContext -> Policy -> Decision`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`This loop lets teams decide what an agent can do based on:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Agent identity`}),`\n`,_jsx(_components.li,{children:`Principal identity`}),`\n`,_jsx(_components.li,{children:`Tenant`}),`\n`,_jsx(_components.li,{children:`Environment`}),`\n`,_jsx(_components.li,{children:`Capability risk`}),`\n`,_jsx(_components.li,{children:`Input arguments`}),`\n`,_jsx(_components.li,{children:`Output`}),`\n`,_jsx(_components.li,{children:`Runtime metadata`}),`\n`,_jsx(_components.li,{children:`Application-specific policy data`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`before-policies`,children:`Before Policies`}),`\n`,_jsx(_components.p,{children:`Before policies run before the action executes. Use them to prevent unsafe side effects.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,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:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`@runtime.before_capability`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"refund_customer\"`}),_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:` refund_limit`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ctx`}),_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:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ctx.arg(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"amount_usd\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_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:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 100`}),_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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Decision(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"deny\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`reason`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Refund exceeds tenant limit\"`}),_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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Decision(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"allow\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`after-policies`,children:`After Policies`}),`\n`,_jsx(_components.p,{children:`After policies run after execution and can inspect output. Use them to detect oversized outputs, unexpected schemas, PII, secrets, or policy violations after the capability returns.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,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:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`@runtime.after_capability`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"call_model\"`}),_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:` block_secret_leak`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ctx`}),_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:` if`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"SECRET_KEY\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` in`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(ctx.output `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`or`}),_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:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Decision(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"deny\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`reason`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Possible secret in output\"`}),_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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Decision(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"allow\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`policy-control-categories`,children:`Policy Control Categories`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Category`}),_jsx(_components.th,{children:`Example policy`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Financial control`}),_jsx(_components.td,{children:`Deny refunds above a tenant limit`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Data control`}),_jsx(_components.td,{children:`Allow only SELECT queries`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Tenant control`}),_jsx(_components.td,{children:`Block cross-tenant actions`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Environment control`}),_jsx(_components.td,{children:`Block high-risk capabilities in prod`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Tool control`}),_jsx(_components.td,{children:`Deny destructive tools without approval`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Output control`}),_jsx(_components.td,{children:`Deny responses containing secrets or PII`})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`related-pages`,children:`Related Pages`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/policy/writing-policies`,children:`Writing Policies`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/policy/before-capability`,children:`Before Capability Policies`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/policy/after-capability`,children:`After Capability Policies`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/guides/policy-as-code-for-ai-agents`,children:`Policy-as-Code For AI Agents`})}),`\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":"Policy Control For AI Agents","description":"Brane gives AI agents policy control by evaluating Python policies before and after capability execution.","href":"/guides/policy-control-for-ai-agents"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Policy Control Loop","slug":"policy-control-loop","depth":2,"children":[]},{"title":"Before Policies","slug":"before-policies","depth":2,"children":[]},{"title":"After Policies","slug":"after-policies","depth":2,"children":[]},{"title":"Policy Control Categories","slug":"policy-control-categories","depth":2,"children":[]},{"title":"Related Pages","slug":"related-pages","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"agl-89d5dad7","siteName":"Brane","title":"Policy Control For AI Agents - Brane","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-05-21T11:18:24.997Z","originalFileLocation":"guides/policy-control-for-ai-agents.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=\"light\"}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=\"Brane gives AI agents policy control by evaluating Python policies before and after capability execution.\">\u003cmeta data-mint-head name=\"keywords\" content=\"Brane, Membrane Labs, AI agent guardrails, AI agent governance, policy-as-code for AI agents, agent runtime control, tool call governance, MCP tool governance, OpenAI Agents SDK guardrails, LangGraph guardrails, CrewAI guardrails\">\u003cmeta data-mint-head name=\"application-name\" content=\"Brane\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/x-icon\" sizes=\"180x180\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/agl-89d5dad7/favicon.ico\">\u003clink data-mint-head rel=\"icon\" type=\"image/x-icon\" sizes=\"32x32\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/agl-89d5dad7/favicon.ico\">\u003clink data-mint-head rel=\"icon\" type=\"image/x-icon\" sizes=\"16x16\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/agl-89d5dad7/favicon.ico\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/agl-89d5dad7/favicon.ico\">\u003cmeta data-mint-head property=\"og:title\" content=\"Policy Control For AI Agents - Brane\">\u003cmeta data-mint-head property=\"og:description\" content=\"Brane gives AI agents policy control by evaluating Python policies before and after capability execution.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Brane Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.brane.membranelabs.org/guides/policy-control-for-ai-agents\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://agl-89d5dad7.mintlify.app/_mintlify/api/og/v2?division=Answer+Guides\u0026amp;title=Policy+Control+For+AI+Agents\u0026amp;description=Brane+gives+AI+agents+policy+control+by+evaluating+Python+policies+before+and+after+capability+execution.\u0026amp;theme=b1b3cdec92baef2bba6f9612\u0026amp;signature=43c90b11447ac16b64a50803e363d27f8ea70ca5b129b4601e0d39592b771069\">\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=\"Policy Control For AI Agents - Brane\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Brane gives AI agents policy control by evaluating Python policies before and after capability execution.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://agl-89d5dad7.mintlify.app/_mintlify/api/og/v2?division=Answer+Guides\u0026amp;title=Policy+Control+For+AI+Agents\u0026amp;description=Brane+gives+AI+agents+policy+control+by+evaluating+Python+policies+before+and+after+capability+execution.\u0026amp;theme=b1b3cdec92baef2bba6f9612\u0026amp;signature=43c90b11447ac16b64a50803e363d27f8ea70ca5b129b4601e0d39592b771069\">\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=\"https://mintlify.s3.us-west-1.amazonaws.com/agl-89d5dad7/_generated/favicon/browserconfig.xml?v=3\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Brane\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#315bdc\">\u003cmeta data-mint-head name=\"twitter:creator\" content=\"@MLabsResearch\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.brane.membranelabs.org/guides/policy-control-for-ai-agents\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/guides/policy-control-for-ai-agents.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.brane.membranelabs.org/#organization\",\"name\":\"Brane\",\"url\":\"https://docs.brane.membranelabs.org\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/agl-89d5dad7/pIrZ3N8MXbSA2YaT/images/membrane.png?fit=max\u0026auto=format\u0026n=pIrZ3N8MXbSA2YaT\u0026q=85\u0026s=af60e279b079710c0f70afe7b88578cf\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.brane.membranelabs.org#website\",\"name\":\"Brane\",\"url\":\"https://docs.brane.membranelabs.org\",\"publisher\":{\"@id\":\"https://docs.brane.membranelabs.org/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.brane.membranelabs.org/guides/policy-control-for-ai-agents#webpage\",\"url\":\"https://docs.brane.membranelabs.org/guides/policy-control-for-ai-agents\",\"name\":\"Policy Control For AI Agents\",\"description\":\"Brane gives AI agents policy control by evaluating Python policies before and after capability execution.\",\"dateModified\":\"2026-05-21T11:18:24.997Z\",\"isPartOf\":{\"@id\":\"https://docs.brane.membranelabs.org#website\"},\"breadcrumb\":{\"@id\":\"https://docs.brane.membranelabs.org/guides/policy-control-for-ai-agents#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.brane.membranelabs.org/guides/policy-control-for-ai-agents#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Answer Guides\",\"item\":\"https://docs.brane.membranelabs.org/guides/agent-guardrails\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Policy Control For AI Agents\",\"item\":\"https://docs.brane.membranelabs.org/guides/policy-control-for-ai-agents\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.brane.membranelabs.org/guides/policy-control-for-ai-agents#article\",\"headline\":\"Policy Control For AI Agents\",\"name\":\"Policy Control For AI Agents\",\"description\":\"Brane gives AI agents policy control by evaluating Python policies before and after capability execution.\",\"url\":\"https://docs.brane.membranelabs.org/guides/policy-control-for-ai-agents\",\"mainEntityOfPage\":{\"@id\":\"https://docs.brane.membranelabs.org/guides/policy-control-for-ai-agents#webpage\"},\"dateModified\":\"2026-05-21T11:18:24.997Z\",\"publisher\":{\"@id\":\"https://docs.brane.membranelabs.org/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.brane.membranelabs.org#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Brane\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Brane","nav":{"global":null,"groups":[{"group":"Start Here","icon":"rocket","pages":[{"title":"Brane Documentation","href":"/index"},{"title":"Quickstart","href":"/quickstart"},{"title":"Current Status","href":"/current-status"}]},{"group":"Core Model","icon":"network","pages":[{"title":"Mental Model","href":"/concepts/mental-model"},{"title":"Capability","href":"/concepts/capability"},{"title":"AgentAction","href":"/concepts/agent-action"},{"title":"PolicyContext","href":"/concepts/policy-context"},{"title":"Decision","href":"/concepts/decision"}]},{"group":"Answer Guides","icon":"message-circle-question","pages":[{"title":"AI Agent Guardrails","href":"/guides/agent-guardrails"},{"title":"AI Agent Safety","href":"/guides/agent-safety"},{"title":"Capability Control For AI Agents","description":"Capability control is the Brane model for governing everything an AI agent can use, including tools, models, databases, memory, retrieval, MCP tools, files, secrets, and other agents.","href":"/guides/capability-control"},{"title":"Policy Control For AI Agents","href":"/guides/policy-control-for-ai-agents"},{"title":"Policy-as-Code For AI Agents","description":"Brane lets developers write Python policy functions that govern AI agent actions before capabilities execute.","href":"/guides/policy-as-code-for-ai-agents"},{"title":"AI Agent Tool Call Governance","href":"/guides/tool-call-governance"},{"title":"MCP Tool Governance","href":"/guides/mcp-tool-governance"},{"title":"OpenAI Agents SDK Guardrails","href":"/guides/openai-agents-sdk-guardrails"},{"title":"Brane vs Prompt Guardrails","href":"/guides/brane-vs-guardrails"}]},{"group":"Build With Python","icon":"terminal","pages":[{"title":"Runtime","href":"/sdk/runtime"},{"title":"Writing Policies","href":"/policy/writing-policies"},{"title":"Before Capability Policies","href":"/policy/before-capability"},{"title":"After Capability Policies","href":"/policy/after-capability"}]},{"group":"Recipes","icon":"book-open","pages":[{"title":"SQL Read-Only Policy","href":"/recipes/sql-read-only"},{"title":"Refund Limit Policy","href":"/recipes/refund-limit"}]},{"group":"Reference","icon":"map","pages":[{"title":"Roadmap","href":"/roadmap"}]}]},"basePath":"","title":"Policy Control For AI Agents - Brane","buildId":"dpl_G9nrg4qeJSZtah1Ziwbc2n6WkLch","deploymentId":"dpl_G9nrg4qeJSZtah1Ziwbc2n6WkLch","dynamics":[],"chunks":[]}