Skip to main content

Format

All events are JSON objects emitted one per line (NDJSON). Every event has:

ExecutionStarted

Emitted immediately before the child process is spawned. Always the first event in any log.

ExecutionStopped

Emitted on every exit path — clean completion, limit breach, spawn failure, or internal error. Always the last event in any log.

Stop reasons


AgentScopeEntered

Emitted when a function annotated with #[nanny::agent("name")] is entered. Records the limits active for that scope.

AgentScopeExited

Emitted when a function annotated with #[nanny::agent("name")] returns. Records usage during that scope.

StepCompleted

Emitted after each agent step when using the Rust SDK or Python SDK.

ToolAllowed

Emitted when Nanny permits a tool call to proceed.

ToolDenied

Emitted when Nanny blocks a tool call because the tool is not in the [tools] allowed list in nanny.toml.

RuleDenied

Emitted when a custom rule or a per-tool max_calls limit blocks a tool call. The tool was on the allowlist but a rule returned a denial before the call executed.

ToolFailed

Emitted when a permitted tool fails at runtime. Distinct from ToolDenied — the tool was allowed but encountered an error (network failure, bad arguments, timeout). No tokens are charged on failure.

LlmUsageRecorded

Emitted when LLM token usage is reported to Nanny — via the Python SDK’s instrument() or the Rust SDK’s report_usage(). Records the measured input and output tokens debited from the budget, plus optional model and provider labels.