SDK · API
Reference.
Enforcement gateway for AI agents.
Cost control, tool policy gating, live kill/pause.
What you get
- Cost control
Per-workflow budget with Hard or Soft enforcement. Hard stops at the cap. Soft permits a bounded, cumulative overdraft for the period — and only while an approval chain is active.
- Tool policy gating
Block specific tools in the dashboard. Every protected call carries a typed tool envelope, so approval rules can match on the tool's parameters or money amount. The grant is bound to a SHA-256 digest of the exact payload.
- Live kill / pause
Pause or kill a workflow from the dashboard. The next @protect call rejects. Async @protect raises the typed NullRunWorkflowKilledError. The sync decorator raises NullRunBlockedException, because it unifies every block into one type. error_code NR-W002 for a kill, NR-W003 for a pause.
- Refusals fail closed
Every refusal the gateway sends is honoured. That covers a budget cap, a blocked tool, a tripped breaker, and Redis unreachable. Only an absent answer fails open: if the gateway cannot be reached, the SDK proceeds rather than freeze your agent. It logs the call and counts it. Enforcement stays advisory until the gateway returns.
The full reference covers the exception hierarchy, the fail-closed policy matrix, the control-plane protocol, and per-framework recipes: docs.nullrun.io.