Skip to main content

Enforce Mode — Active Runtime Control

Enforce mode moves from observation to action. Budget caps, tool call limits, and compliance rules become hard constraints that shape agent behavior in real time.
1

Switch to enforce

2

Add a budget cap

Wrap any block of agent work with cascadeflow.run() and set a budget:
If the agent exceeds $0.50, cascadeflow issues a stop action. The agent halts cleanly and prevents runaway spend.
3

Combine budget with tool call limits

TypeScript
4

Add compliance gating

Restrict which models can process sensitive data:
TypeScript
5

See what happened

The decision trace shows every enforcement action:
In enforce mode, record['applied'] is True — actions are executed, not just logged.

Gradual Rollout

You do not need to jump from observe to full enforcement. Start with one constraint:
The TypeScript run() API takes a callback so the scoped context follows asynchronous work through AsyncLocalStorage in Node.js.

Next Step

Ready to attach policy to individual agents? Use the @agent decorator →