Compile YAML, JSON, or plain-English policy descriptions into the platform’s policy IR.
The platform exposes POST /api/v1/policies/compile — a stateless adapter that turns YAML, JSON, Markdown, or English prose into a PolicyCreate-shaped object that the regular CRUD endpoints accept. Prose and Markdown are routed through Gemini (gemini-2.5-flash); YAML/JSON skip the LLM and validate directly.The compiler never raises — every parse failure, schema mismatch, or missing field is returned as a structured errors array so the UI can render them inline.
Endpoint
POST /api/v1/policies/compileContent-Type: application/json{ "source": "Refunds over $200 must be approved by a manager. Block deletes on production tables.", "source_format": "prose"}
source_format is one of yaml, yml, json, prose, markdown, md.Response:
{ "ok": true, "policy": { "name": "refund-approval-and-prod-deletes", "denied_actions": ["delete_production_database"], "require_approval": true, "approval_actions": ["issue_refund"], "approval_threshold_usd": 200.0 }, "warnings": [ "policy compiled from prose by an LLM — review every field before activating" ], "errors": []}
ok is true only when errors is empty. The returned policy slot is not persisted — POST it to /api/v1/policies/ to save.
YAML / JSON
Validated against the same Pydantic schema (PolicyCreate) used by the create/update endpoints, then re-serialized with sorted keys. Unknown top-level keys become warnings (so you can compile a partial extract from a larger document) and contradictions surface as soft warnings:
allowed_actions and denied_actions overlap (deny wins at runtime).
approval_* fields set with require_approval=False (approvals will not fire).
Prose / Markdown
Prose is compiled by an LLM instructed to:
Maps verbs to fields (block/deny/forbid → denied_actions; only allow → allowed_actions; require approval → require_approval=True).
Converts amounts ($500 → 500.0).
Maps prerequisites (must look up before refunding) into evidence_requirements.
Refuses to invent action names not present in the source.
The model output is then run through the same PolicyCreate validator as YAML/JSON, so a hallucinated field cannot produce an invalid policy — it surfaces as a structured error.If prose compilation is temporarily unavailable, the endpoint returns "ok": false with an explanatory entry in errors. YAML and JSON compiles are unaffected.
Round-trip serialization
The companion helper policy_to_yaml(policy) (importable from app.services.policy_compiler) renders any policy dict back to canonical YAML — sorted keys, None stripped, block style. Useful for showing policies in the UI or exporting them.
Console integration
The console policy editor calls this endpoint directly:
Author types/pastes prose, YAML, or JSON.
Editor POSTs to /api/v1/policies/compile on every paste/blur.
errors render as red squiggles inline; warnings show as yellow callouts.
On commit, the compiled policy is sent to POST /api/v1/policies/.
Always review prose-compiled policies before activating them. The model occasionally invents fields the author did not request — the warning string above is your prompt to audit every key.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Agent Sentinel","colors":{"primary":"#319165","light":"#4abf89","dark":"#2d8059"},"logo":{"light":"https://mintcdn.com/agentsentinel/B1Psb0ktqAcV0f6k/logo/light.svg?fit=max\u0026auto=format\u0026n=B1Psb0ktqAcV0f6k\u0026q=85\u0026s=c3b2e0f29a496f48c8f7c50f2acccc32","dark":"https://mintcdn.com/agentsentinel/B1Psb0ktqAcV0f6k/logo/dark.svg?fit=max\u0026auto=format\u0026n=B1Psb0ktqAcV0f6k\u0026q=85\u0026s=8b61e50f3f15526e26fb1fad9cb27cc8","href":"https://agentsentinel.dev"},"favicon":"https://mintcdn.com/agentsentinel/B1Psb0ktqAcV0f6k/favicon.svg?fit=max\u0026auto=format\u0026n=B1Psb0ktqAcV0f6k\u0026q=85\u0026s=52d30475fb54d414fa922f4d0536e184","appearance":{"default":"light","strict":true},"background":{"color":{"light":"#fbfaf6","dark":"#0d0f12"}},"navbar":{"links":[{"href":"mailto:hello@agentsentinel.dev","label":"Support"}],"primary":{"type":"button","label":"API Reference","href":"/platform/overview"}},"footer":{"socials":{"github":"https://github.com/agent-sentinel/agent-sentinel-sdk","website":"https://agentsentinel.dev"}},"fonts":{"family":"Inter"},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":true},"navigation":{"global":{"anchors":[{"anchor":"GitHub","icon":"github","href":"https://github.com/agent-sentinel/agent-sentinel-sdk"},{"anchor":"PyPI","icon":"python","href":"https://pypi.org/project/agentsentinel-sdk/"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"agentsentinel","hasAudioNarration":false,"actualSubdomain":"agentsentinel","customDomains":["docs.agentsentinel.dev"],"gitSource":{"type":"github","owner":"agent-sentinel","repo":"agent-sentinel","deployBranch":"main","contentDirectory":"docs","isPrivate":true,"mountPath":"","label":""},"entitlements":{},"buildId":"6ae1afb657e72f17a84ac220","clientVersion":"0.0.4128","searchFilterCounts":[{"language":"default","tag":"Guides","count":55},{"language":"default","tag":"Platform API","count":18},{"language":"default","tag":"SDK (Python)","count":16},{"language":"default","tag":"Web Console","count":14},{"language":"default","tag":"Concepts","count":3},{"language":"default","tag":"AI tools","count":2},{"language":"default","tag":"Getting started","count":2}]},"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":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"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":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"code,pre,kbd,samp,.code-block,.code-block code,.code-group code,.request-example code,.response-example code{font-family:\"JetBrains Mono\",\n ui-monospace,\n SFMono-Regular,\n Menlo,\n Monaco,\n Consolas,\n \"Liberation Mono\",\n \"Courier New\",\n monospace!important}"}],"page":{"pagePath":"sdk/python/prose-policies","slug":"/sdk/python/prose-policies","pageMetadata":{"title":"Prose policies","description":"Compile YAML, JSON, or plain-English policy descriptions into the platform's policy IR.","href":"/sdk/python/prose-policies"},"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: \"Compile YAML, JSON, or plain-English policy descriptions into the platform’s policy IR.\"\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`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`The platform exposes `,_jsx(_components.code,{children:`POST /api/v1/policies/compile`}),` — a stateless adapter that turns YAML, JSON, Markdown, or English prose into a `,_jsx(_components.code,{children:`PolicyCreate`}),`-shaped object that the regular CRUD endpoints accept. Prose and Markdown are routed through Gemini (`,_jsx(_components.code,{children:`gemini-2.5-flash`}),`); YAML/JSON skip the LLM and validate directly.`]}),`\n`,_jsxs(_components.p,{children:[`The compiler `,_jsx(_components.strong,{children:`never raises`}),` — every parse failure, schema mismatch, or missing field is returned as a structured `,_jsx(_components.code,{children:`errors`}),` array so the UI can render them inline.`]}),`\n`,_jsx(Heading,{level:`2`,id:`endpoint`,children:`Endpoint`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`http`,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:`http`,children:_jsxs(_components.code,{language:`http`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`POST`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` /api/v1/policies/compile`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#569CD6`},children:`Content-Type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` application/json`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"source\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Refunds over $200 must be approved by a manager. Block deletes on production tables.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"source_format\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"prose\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`source_format`}),` is one of `,_jsx(_components.code,{children:`yaml`}),`, `,_jsx(_components.code,{children:`yml`}),`, `,_jsx(_components.code,{children:`json`}),`, `,_jsx(_components.code,{children:`prose`}),`, `,_jsx(_components.code,{children:`markdown`}),`, `,_jsx(_components.code,{children:`md`}),`.`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Response:`})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`14`,language:`json`,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:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`14`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"ok\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"policy\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"refund-approval-and-prod-deletes\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"denied_actions\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"delete_production_database\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"require_approval\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"approval_actions\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"issue_refund\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"approval_threshold_usd\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`200.0`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"warnings\"`}),_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:` \"policy compiled from prose by an LLM — review every field before activating\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"errors\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: []`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`ok`}),` is `,_jsx(_components.code,{children:`true`}),` only when `,_jsx(_components.code,{children:`errors`}),` is empty. The returned `,_jsx(_components.code,{children:`policy`}),` slot is `,_jsx(_components.strong,{children:`not`}),` persisted — POST it to `,_jsx(_components.code,{children:`/api/v1/policies/`}),` to save.`]}),`\n`,_jsx(Heading,{level:`2`,id:`yaml-/-json`,children:`YAML / JSON`}),`\n`,_jsxs(_components.p,{children:[`Validated against the same Pydantic schema (`,_jsx(_components.code,{children:`PolicyCreate`}),`) used by the create/update endpoints, then re-serialized with sorted keys. Unknown top-level keys become warnings (so you can compile a partial extract from a larger document) and contradictions surface as soft warnings:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`allowed_actions`}),` and `,_jsx(_components.code,{children:`denied_actions`}),` overlap (deny wins at runtime).`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`approval_*`}),` fields set with `,_jsx(_components.code,{children:`require_approval=False`}),` (approvals will not fire).`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`prose-/-markdown`,children:`Prose / Markdown`}),`\n`,_jsx(_components.p,{children:`Prose is compiled by an LLM instructed to:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Maps verbs to fields (`,_jsx(_components.code,{children:`block`}),`/`,_jsx(_components.code,{children:`deny`}),`/`,_jsx(_components.code,{children:`forbid`}),` → `,_jsx(_components.code,{children:`denied_actions`}),`; `,_jsx(_components.code,{children:`only allow`}),` → `,_jsx(_components.code,{children:`allowed_actions`}),`; `,_jsx(_components.code,{children:`require approval`}),` → `,_jsx(_components.code,{children:`require_approval=True`}),`).`]}),`\n`,_jsxs(_components.li,{children:[`Converts amounts (`,_jsx(_components.code,{children:`$500`}),` → `,_jsx(_components.code,{children:`500.0`}),`).`]}),`\n`,_jsxs(_components.li,{children:[`Maps prerequisites (`,_jsx(_components.code,{children:`must look up before refunding`}),`) into `,_jsx(_components.code,{children:`evidence_requirements`}),`.`]}),`\n`,_jsx(_components.li,{children:`Refuses to invent action names not present in the source.`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`The model output is then run through the same `,_jsx(_components.code,{children:`PolicyCreate`}),` validator as YAML/JSON, so a hallucinated field cannot produce an invalid policy — it surfaces as a structured error.`]}),`\n`,_jsxs(_components.p,{children:[`If prose compilation is temporarily unavailable, the endpoint returns `,_jsx(_components.code,{children:`\"ok\": false`}),` with an explanatory entry in `,_jsx(_components.code,{children:`errors`}),`. YAML and JSON compiles are unaffected.`]}),`\n`,_jsx(Heading,{level:`2`,id:`round-trip-serialization`,children:`Round-trip serialization`}),`\n`,_jsxs(_components.p,{children:[`The companion helper `,_jsx(_components.code,{children:`policy_to_yaml(policy)`}),` (importable from `,_jsx(_components.code,{children:`app.services.policy_compiler`}),`) renders any policy dict back to canonical YAML — sorted keys, `,_jsx(_components.code,{children:`None`}),` stripped, block style. Useful for showing policies in the UI or exporting them.`]}),`\n`,_jsx(Heading,{level:`2`,id:`console-integration`,children:`Console integration`}),`\n`,_jsx(_components.p,{children:`The console policy editor calls this endpoint directly:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Author types/pastes prose, YAML, or JSON.`}),`\n`,_jsxs(_components.li,{children:[`Editor POSTs to `,_jsx(_components.code,{children:`/api/v1/policies/compile`}),` on every paste/blur.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`errors`}),` render as red squiggles inline; `,_jsx(_components.code,{children:`warnings`}),` show as yellow callouts.`]}),`\n`,_jsxs(_components.li,{children:[`On commit, the compiled `,_jsx(_components.code,{children:`policy`}),` is sent to `,_jsx(_components.code,{children:`POST /api/v1/policies/`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`See `,_jsx(_components.a,{href:`/console/settings`,children:`Console → Settings → Policies`}),` for the UI-side workflow and `,_jsx(_components.a,{href:`/concepts/policies`,children:`Concepts → Policies`}),` for the underlying IR.`]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`Always review prose-compiled policies before activating them. The model occasionally invents fields the author did not request — the warning string above is your prompt to audit every key.`})}),`\n`,_jsx(Heading,{level:`2`,id:`see-also`,children:`See also`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/concepts/policies`,children:`Concepts → Policies`}),` — what a policy can express`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/platform/policies`,children:`Platform → Policies API`}),` — CRUD + sync endpoints`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/console/settings`,children:`Console → Settings`}),` — version history, diff, rollback`]}),`\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":"Prose policies","description":"Compile YAML, JSON, or plain-English policy descriptions into the platform's policy IR.","href":"/sdk/python/prose-policies"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Endpoint","slug":"endpoint","depth":2,"children":[]},{"title":"YAML / JSON","slug":"yaml-/-json","depth":2,"children":[]},{"title":"Prose / Markdown","slug":"prose-/-markdown","depth":2,"children":[]},{"title":"Round-trip serialization","slug":"round-trip-serialization","depth":2,"children":[]},{"title":"Console integration","slug":"console-integration","depth":2,"children":[]},{"title":"See also","slug":"see-also","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"agentsentinel","siteName":"Agent Sentinel","title":"Prose policies - Agent Sentinel","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-27T11:03:58.527Z","originalFileLocation":"sdk/python/prose-policies.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=\"light\";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=\"Compile YAML, JSON, or plain-English policy descriptions into the platform\u0026#x27;s policy IR.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Agent Sentinel\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/agentsentinel/dvQBrORHNLFI1x08/_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/agentsentinel/dvQBrORHNLFI1x08/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/agentsentinel/dvQBrORHNLFI1x08/_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/agentsentinel/dvQBrORHNLFI1x08/_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/agentsentinel/dvQBrORHNLFI1x08/_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/agentsentinel/dvQBrORHNLFI1x08/_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/agentsentinel/dvQBrORHNLFI1x08/_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/agentsentinel/dvQBrORHNLFI1x08/_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/agentsentinel/dvQBrORHNLFI1x08/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Prose policies - Agent Sentinel\">\u003cmeta data-mint-head property=\"og:description\" content=\"Compile YAML, JSON, or plain-English policy descriptions into the platform\u0026#x27;s policy IR.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Agent Sentinel\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.agentsentinel.dev/sdk/python/prose-policies\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://agentsentinel.mintlify.site/_mintlify/api/og/v2?division=SDK+%28Python%29\u0026amp;title=Prose+policies\u0026amp;description=Compile+YAML%2C+JSON%2C+or+plain-English+policy+descriptions+into+the+platform%27s+policy+IR.\u0026amp;theme=4d2fad853b271edd6d74c3a5\u0026amp;signature=014803889fc92fb7311f374d4b2ac23f2384bfb577c3c29c14d0d1f1dfe9c832\">\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=\"Prose policies - Agent Sentinel\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Compile YAML, JSON, or plain-English policy descriptions into the platform\u0026#x27;s policy IR.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://agentsentinel.mintlify.site/_mintlify/api/og/v2?division=SDK+%28Python%29\u0026amp;title=Prose+policies\u0026amp;description=Compile+YAML%2C+JSON%2C+or+plain-English+policy+descriptions+into+the+platform%27s+policy+IR.\u0026amp;theme=4d2fad853b271edd6d74c3a5\u0026amp;signature=014803889fc92fb7311f374d4b2ac23f2384bfb577c3c29c14d0d1f1dfe9c832\">\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/agentsentinel/dvQBrORHNLFI1x08/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Agent Sentinel\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#319165\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.agentsentinel.dev/sdk/python/prose-policies\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/sdk/python/prose-policies.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.agentsentinel.dev/#organization\",\"name\":\"Agent Sentinel\",\"url\":\"https://docs.agentsentinel.dev\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/agentsentinel/B1Psb0ktqAcV0f6k/logo/light.svg?fit=max\u0026auto=format\u0026n=B1Psb0ktqAcV0f6k\u0026q=85\u0026s=c3b2e0f29a496f48c8f7c50f2acccc32\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.agentsentinel.dev#website\",\"name\":\"Agent Sentinel\",\"url\":\"https://docs.agentsentinel.dev\",\"publisher\":{\"@id\":\"https://docs.agentsentinel.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.agentsentinel.dev/sdk/python/prose-policies#webpage\",\"url\":\"https://docs.agentsentinel.dev/sdk/python/prose-policies\",\"name\":\"Prose policies\",\"description\":\"Compile YAML, JSON, or plain-English policy descriptions into the platform's policy IR.\",\"dateModified\":\"2026-10-27T11:03:58.527Z\",\"isPartOf\":{\"@id\":\"https://docs.agentsentinel.dev#website\"},\"breadcrumb\":{\"@id\":\"https://docs.agentsentinel.dev/sdk/python/prose-policies#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.agentsentinel.dev/sdk/python/prose-policies#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"SDK (Python)\",\"item\":\"https://docs.agentsentinel.dev/sdk/python/installation\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Prose policies\",\"item\":\"https://docs.agentsentinel.dev/sdk/python/prose-policies\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.agentsentinel.dev/sdk/python/prose-policies#article\",\"headline\":\"Prose policies\",\"name\":\"Prose policies\",\"description\":\"Compile YAML, JSON, or plain-English policy descriptions into the platform's policy IR.\",\"url\":\"https://docs.agentsentinel.dev/sdk/python/prose-policies\",\"mainEntityOfPage\":{\"@id\":\"https://docs.agentsentinel.dev/sdk/python/prose-policies#webpage\"},\"dateModified\":\"2026-10-27T11:03:58.527Z\",\"publisher\":{\"@id\":\"https://docs.agentsentinel.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.agentsentinel.dev#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Agent Sentinel\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Agent Sentinel\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/sdk/python/prose-policies.md","siteName":"Agent Sentinel","nav":{"global":{"anchors":[{"anchor":"GitHub","icon":"github","href":"https://github.com/agent-sentinel/agent-sentinel-sdk"},{"anchor":"PyPI","icon":"python","href":"https://pypi.org/project/agentsentinel-sdk/"}]},"tabs":[{"tab":"Guides","groups":[{"group":"Getting started","pages":[{"title":"Agent Sentinel","href":""},{"title":"Quickstart","href":"/quickstart"}]},{"group":"Concepts","pages":[{"title":"Actions \u0026 runs","href":"/concepts/actions-and-runs"},{"title":"Ledger","href":"/concepts/ledger"},{"title":"Policies","href":"/concepts/policies"}]},{"group":"SDK (Python)","pages":[{"title":"Installation","href":"/sdk/python/installation"},{"title":"Instrumentation","href":"/sdk/python/instrumentation"},{"title":"Policies \u0026 budgets","href":"/sdk/python/policies"},{"title":"Cost Tracking","href":"/sdk/python/cost-tracking"},{"title":"Guardrails","description":"First-class runtime primitives: PII detection, content moderation, idempotency, and loop protection.","href":"/sdk/python/guardrails"},{"title":"Prose policies","href":"/sdk/python/prose-policies"},{"title":"Remote sync","description":"Upload local ledger entries to the Agent Sentinel Platform in the background.","href":"/sdk/python/remote-sync"},{"title":"Replay","href":"/sdk/python/replay"},{"title":"Interventions","href":"/sdk/python/interventions"},{"title":"Approval Workflows","href":"/sdk/python/approvals"},{"title":"MCP Integration","href":"/sdk/python/mcp"},{"title":"Error Handling","href":"/sdk/python/errors"},{"title":"Retry \u0026 Resilience","href":"/sdk/python/retry-resilience"},{"title":"LLM Integrations","href":"/sdk/python/llm-integrations"},{"title":"Framework Integrations","href":"/sdk/python/framework-integrations"},{"title":"Compliance (Enterprise foundations)","href":"/sdk/python/compliance"}]},{"group":"AI tools","pages":[{"title":"Claude Code setup","icon":"asterisk","href":"/ai-tools/claude-code"},{"title":"Cursor setup","icon":"arrow-pointer","href":"/ai-tools/cursor"}]},{"group":"Platform API","pages":[{"title":"Platform API Overview","href":"/platform/overview"},{"title":"Authentication","href":"/platform/auth"},{"title":"Ingest","href":"/platform/ingest"},{"title":"Runs \u0026 actions","href":"/platform/runs"},{"title":"Activity Ledger API","href":"/platform/ledger"},{"title":"Agent Discovery","href":"/platform/agents"},{"title":"Interventions API","href":"/platform/interventions"},{"title":"Approvals API","href":"/platform/approvals"},{"title":"Policies API","href":"/platform/policies"},{"title":"Budget reservations","href":"/platform/budgets"},{"title":"Kill Switch API","href":"/platform/kill-switch"},{"title":"Evals API","href":"/platform/evals"},{"title":"Stats","href":"/platform/stats"},{"title":"Replay (platform)","href":"/platform/replay"},{"title":"MCP (Model Context Protocol)","href":"/platform/mcp"},{"title":"AgentVault Credentials","href":"/platform/agentvault"},{"title":"WebSocket Real-time Updates","href":"/platform/websockets"},{"title":"Compliance (Enterprise foundations)","href":"/platform/compliance"}]},{"group":"Web Console","pages":[{"title":"Web Console Overview","href":"/console/overview"},{"title":"Console Quick Start","href":"/console/quickstart"},{"title":"Interventions Page","href":"/console/interventions"},{"title":"Approvals Page","href":"/console/approvals"},{"title":"Kill Switch","href":"/console/kill-switch"},{"title":"Runs Page","href":"/console/runs"},{"title":"Determinism Analysis","href":"/console/determinism-analysis"},{"title":"Replay Hub","href":"/console/replay"},{"title":"Activity Ledger","href":"/console/ledger"},{"title":"Agents Page","href":"/console/agents"},{"title":"Evals","href":"/console/evals"},{"title":"Analytics Page","href":"/console/analytics"},{"title":"MCP Explorer","href":"/console/mcp"},{"title":"Settings Page","href":"/console/settings"}]}]}]},"basePath":"","title":"Prose policies - Agent Sentinel","buildId":"dpl_5tKr6cUUeuVJdEZ9JAEY3h4soMJ8","deploymentId":"dpl_5tKr6cUUeuVJdEZ9JAEY3h4soMJ8","dynamics":[],"chunks":[]}