Automated safety & cost controls

Keep costs down and quality up, automatically

Define spending limits, step budgets, retry strategies, and model fallbacks — and have them enforced in real time by the Niitaka policy engine, without changing your agent code.

Two-tier cost limits

Set a warn_at threshold that emits a signal and an abort_at that halts execution — before your budget is blown.

Step limits

Cap the number of agent steps to prevent runaway loops. Warn early, abort at the hard limit.

Smart retry

Retry on transient errors with exponential, linear, or constant backoff and configurable max attempts.

Model fallback

On persistent errors, automatically fall back to a cheaper or more reliable model — gracefully.

Real-time signals

Every policy trigger emits a signal you can monitor in the dashboard, in Slack, or via email alert.

Layered precedence

Policies apply at the org level, with per-agent and per-experiment overrides — no policy collisions.

At a glance

  • Cost limits: warn_at + abort_at two-tier control
  • Step limits stop infinite loops before they start
  • Retry with exponential / linear / constant backoff
  • Model fallback on configurable error patterns
  • All triggers create auditable policy evaluation logs

Common questions

Are policies enforced in the SDK or on the server?

Policy evaluation runs inside the SDK on the same machine as your agent — it does not make a server round-trip for each enforcement decision. Policies are fetched from the backend at session start and then applied locally as events occur. This keeps enforcement fast and means guardrails still fire even if the backend is temporarily unreachable during a session.

What happens to the current session when a cost limit is hit mid-run?

When the hard abort_at threshold is crossed, the policy engine emits an abort signal. The SDK raises an exception inside your session context so your agent code can handle it gracefully — log the abort, clean up state, or notify downstream systems. The session is marked completed with the abort reason in the audit log.

More general questions? See the full FAQ →

Ready to get started?

Connect your first agent in under 5 minutes. Free to start, no credit card required.

Next: Observability