Documentation Index
Fetch the complete documentation index at: https://docs.nanny.run/llms.txt
Use this file to discover all available pages before exploring further.
The three limit types
Every Nanny execution is governed by three independent limits. Any one of them can stop a run.Timeout
The wall-clock time limit in milliseconds. The moment the child process has been running fortimeout ms, Nanny kills it — regardless of what it’s doing.
Steps
The maximum number of agent steps allowed. Requires#[nanny::tool] (Rust) or @tool (Python) to report tool calls.
Cost
The maximum number of cost units the agent may spend. Each tool declares its cost per call; Nanny tracks the running total and stops the moment the budget is exhausted.Named limit sets
In a multi-agent system, each agent has a different risk profile. The analysis agent makes expensive API calls — it deserves a tight cost ceiling. The reporter just writes a file — it barely needs a budget at all. Named limit sets let each role get exactly the ceiling it deserves, configured once innanny.toml.
[limits] and override only the fields you declare. In the example above, [limits.ingestion] inherits from the global [limits] and overrides all three fields. A set that only declares timeout would inherit steps and cost from the base.
Each agent activates its own set via the @agent("role") decorator:
What happens when a limit is hit
- Nanny kills the child process immediately — no grace period, no way for the agent to catch or delay the stop.
- An
ExecutionStoppedevent is emitted with the reason. - A human-readable message is printed to stderr:
nanny: stopped — TimeoutExpired. - Nanny exits with code
1.
| Reason | Trigger |
|---|---|
AgentCompleted | Process exited cleanly on its own |
TimeoutExpired | Wall-clock timeout exceeded |
MaxStepsReached | Step limit hit |
BudgetExhausted | Cost budget exhausted |
ToolDenied | Tool not in allowlist |
RuleDenied | Custom rule returned denial |
ManualStop | Stopped programmatically |
ProcessCrashed | Child process exited with non-zero code unexpectedly |
BridgeUnavailable | Bridge was active but unreachable — Nanny fails closed rather than continue ungoverned |