Skip to main content
Enforcement is deny-by-default: the policy file lists what’s allowed. Each tool gets a mode and an optional list of constraints.

Modes

Applying a policy in code

create_agent(...) stays close to LangChain; policy enforcement is applied after agent creation with enforce_policy(...), which accepts either a Pydantic AgentPolicy or a YAML file path:
The same agent code can stay simple in development, while deployment systems inject policy later.

Per-role policies

Agents that need per-role behaviour ship a policies/ directory (one file per role, with inheritance) instead of a single policy.yaml. A legacy single-file policy.yaml is treated as the default role — no migration needed. See Request context + roles for the multi-file shape and inheritance rules.