Skip to main content

Install

The Nanny CLI is a system tool, install it once and use nanny run from any project.
Verify the installation:
For upgrade paths, uninstall, and troubleshooting on each platform, see Installing Nanny. The CLI is the enforcement engine. The SDK instruments your functions. You need both: nanny run owns the process lifecycle and enforces limits; @tool, @rule, and @agent report tool calls and activate named limit sets from inside your agent code.

Initialise a config

Run this in the root of your project:
This writes a nanny.toml with safe defaults:
Set [start].cmd to your agent’s entry point, then list the tools it is allowed to call. nanny init also writes .nanny/app.json, a permanent, one-time identity for this app (an app_id plus a name you’ll be prompted for). It’s meant to be committed alongside nanny.toml.

Run your agent

Nanny reads [start].cmd from nanny.toml, spawns the process, and stops it the moment it tries something outside what you declared.

Label your tools

Labels say what a tool is, so a rule can govern it without knowing its name:
See Tool labels for all five.

Add rules

Install a pack and pin it:
That writes one line into nanny.toml and vendors the pack into .nanny/rules/, both committed:
Your own source is untouched. See Rule packs.

Read the event log

Every run emits structured NDJSON to stdout:
Events go to stdout and Nanny’s own output goes to stderr, so a redirection gives you the log and nothing else:
In a container you redirect nothing: the runtime already collects stdout, which is where every log shipper reads it from. See Event Log.