nanny.toml from the current directory and kills the process the moment any limit is crossed.
Examples
Options
Exit codes
Stderr
When Nanny stops a process it prints the reason to stderr:Event log
Every run emits NDJSON events to stdout.ExecutionStarted is always first; ExecutionStopped is always last:
Governance server
nanny run --serve starts a long-lived governance server instead of launching a command. Other processes and machines connect to it over TCP with nanny run --join=<appId>, and every tool call from every connected agent counts against one shared budget and step limit. For a single-process agent you don’t need this: plain nanny run is enough.
Starting a server requires nanny init to have already run in that directory: the server’s state is keyed by the app’s permanent app_id, not a global path, so two unrelated apps’ servers on one machine never collide.
nanny.toml from the current directory and blocks until stopped (nanny stop or CTRL-C).
Serve flags
The bind address sets the security posture: loopback (
127.0.0.1) is plain HTTP for same-machine agents; a non-loopback address (0.0.0.0) makes mTLS mandatory, and the server refuses to start without certs. For cross-machine setup, certificates, and connecting agents, see the Governance server guide.
Manage a running server
app_id when --app is omitted. nanny status reads ~/.nanny/servers/<appId>/server.addr and probes the server (exit 0 if reachable, 1 otherwise). nanny stop reads the PID from ~/.nanny/servers/<appId>/server.pid and sends SIGTERM (on Windows, taskkill /F).
Relocating the state directory
SetNANNY_HOME to put .nanny/servers/ (and everything else normally under ~/.nanny/) somewhere other than the home directory:
--serve/--join pair need the same NANNY_HOME to find each other’s state. Falls back to the OS home directory when unset.
For per-function governance (marking individual tools and rules in code), see the Rust SDK guide or Python SDK guide.