- 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
| Exception | HTTP | When |
|---|---|---|
APIError | varies | Base class for all errors |
AuthenticationError | 401 | Missing or invalid API key |
NotFoundError | 404 | Resource not found |
ServerError | 5xx | Server-side error (auto-retried) |
PolicyDeniedError | 403 | Policy violation — contains structured PolicyDenial |
The PolicyDenial structure
Denial codes
| Code | Cause | Key details fields |
|---|---|---|
TRANSFER_LIMIT_EXCEEDED | Per-tx amount cap | limit_value, requested_amount |
CHAIN_RESTRICTED | Chain not in allowed list | allowed_chains, requested_chain |
CONTRACT_NOT_WHITELISTED | Contract not whitelisted | allowed_contracts, requested_contract |
PARAMETER_OUT_OF_BOUNDS | Contract call parameter out of range | param_name, op, limit_value |
BUSINESS_HOURS_VIOLATION | Operation outside allowed hours | — |
DELEGATION_EXPIRED | Delegation TTL has passed | expires_at |
WALLET_FROZEN | Wallet or delegation is frozen | — |
INSUFFICIENT_BALANCE | Wallet balance too low | balance, requested_amount |
INSUFFICIENT_PERMISSION | Delegation lacks required permission | required_permission |
POLICY_DENIED | Generic rule block | — |
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
- Agno / CrewAI
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: