- Denial — the policy blocked it outright. The agent is not permitted to do this at all.
- Pending approval — the operation is allowed in principle but exceeds a threshold that requires the owner to sign off first. See Policy Engine for how to configure approval thresholds.
PolicyDeniedError carrying machine-readable guidance that enables agents to self-correct and retry without human intervention.
Error hierarchy
The PolicyDenial structure
Denial codes
Basic self-correction
- Python SDK
- TypeScript SDK
Framework-specific handling
Each framework returns denials as tool output strings (not exceptions), so the LLM’s reasoning loop continues naturally:- LangChain
- OpenAI Agents
- MCP
Production patterns
Max-retry guard
Max-retry guard
Cap retry attempts to prevent infinite loops:
Escalation — don't retry cumulative limits
Escalation — don't retry cumulative limits
Cumulative limits (daily, monthly) can’t be fixed by adjusting parameters. Escalate to the owner instead:
Suggestion regex fallback
Suggestion regex fallback
If
details fields are missing, parse the suggestion text: