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. Other processes and machines connect to it with nanny run --join=<appId>, and every tool call from every connected agent is evaluated against one shared set of rules.
Whether it also runs an app of its own is decided by nanny.toml:
[start]present. The governor launches that command underneath itself, in one process. One container, one command, no launcher script. Trailing arguments after--append to it.[start]absent. A headless governor, for the case where the apps live elsewhere and arrive via--join.
run_id that tells them apart.
Use it for everything. A single process gets a governor on loopback with no
certificates and no setup, and several processes or machines get the same
governor with an address and a bundle. One shape means the thing you run in
development is the thing you run in production.
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.