First request and daily operation
Use one of the complete routes in Installation. Start with a request whose result you can check, such as “Read README.md and summarize what this project does. Do not change files.” Check the tool results and answer in the client. A successful launch alone says nothing about model authentication or useful work.
cowboy ask "<prompt>" runs one prompt to completion without a client and
prints the final answer. Each run gets a Zellij session of its own, so it
neither waits on nor ends an interactive session attached under the same name,
even with --fresh. With -a <name> naming a managed agent, the run stays
inside that agent’s launch envelope and reports completion instead of printing
the answer, with the command that reads the run’s transcript as the agent user.
A managed run that fails to launch exits non-zero with the reason. A local run
that produces no answer, because Zellij never started it or the turn failed,
also exits non-zero with the reason. A run of either kind still going after
--timeout seconds (default 3600; 0 removes the bound) is stopped and exits
non-zero.
Inventory, status, and health
cowboy list
cowboy status
cowboy doctor
These answer different questions. The list shows registered agents that can run. Status shows runtime instances and their last reported activity. Doctor checks whether services are up, the event loop responds, and inbox consumers are still reading. A local session need not have a registry entry, and doctor cannot verify every deployment from every account. An unknown result is not a pass. Use Troubleshooting to interpret it.
For a named managed agent:
cowboy status dev
cowboy doctor dev --json
journalctl -u cowboy-serve-dev --since today
cowboy logs reads the launch log of a backgrounded local serve process; it is
not a general transcript or journal reader. For example, cowboy logs reads
the unnamed headless instance’s log when it was started with --daemon. A verb
given no name — bare cowboy, serve, stop, restart, logs, connect,
ask — addresses the agent_name saved by onboarding, else cowboy.
Use the system journal for managed units, Docker logs for containers, and the
client/session history for conversation content.
Review external actions
Approvals are configured per bridge or effect. For a gated Git push, review the runner’s target, execution identity, commit SHA, changed files, and diffstat. The agent’s prose is not the runner’s description. An authorized approver chooses ✅ to push exactly that SHA or ❌ to reject it. An expired request needs a new review; a branch that moved requires a newly prepared request.
The operation result returns to the agent’s inbox and the configured status channel. Keep the request ID and SHA if delivery or execution is uncertain. An accepted message or approval is not proof that the push or rebuild finished. See approvals and gated effects.
Restart and recover
Managed daemons restart after exit, including clean socket quits, with a
five-second delay and a start-rate limit. A changed per-agent component also
triggers a restart on NixOS activation. Use systemd for an explicit restart;
cowboy restart dev runs the same systemctl restart for a declared daemon:
sudo systemctl restart cowboy-serve-dev
cowboy doctor dev
A deliberate systemd stop leaves the daemon down. Ordinary containers in the
installation example have no Docker restart policy; start them explicitly.
A container that cowboy init --mode docker finishes, or that cowboy serve
or cowboy restart relaunches from its declared volume, runs with
--restart unless-stopped.
For local headless and cage launches, and a cowboy-serve-<name> unit that
cowboy serve <name> started rather than the NixOS module, retain the original
launch command: cowboy restart cannot reconstruct their transient socket,
sandbox, and exposure flags. It stops those instances and asks you to relaunch. For a
settings-based Docker agent it can reuse the declared volume.
After a crash, a sender may receive no answer even though a request was accepted, or see a duplicate after redelivery. Resumed work can also lose the original reply destination; inspect state and external outcomes before resubmitting. Message reliability gives the exact recovery contract.
Back up mutable state
Stop the agent and its writers before copying state. Keep ownership and modes, especially for keys. A Nix closure rebuilds software; it does not restore conversations, working files, credentials, or pending approvals.
- Local: preserve the workspace and Cowboy’s XDG data/config directories
(normally under
~/.local/shareand~/.config). - Managed: preserve the configured agent home and writable mounts, plus the enabled broker/bridge services’ persistent state and secret sources. Include Redis persistence when recovering queued messages and approvals matters.
- Docker walkthrough: preserve both named volumes, including the explicit data directory under the configuration volume. Container removal does not remove these named volumes.
- Settings-based Docker CLI: config and workspace are under
~/.local/share/cowboy/agents/<name>/by default. The current supervisor leaves Montana’s default data directory in the container layer. Preserve it separately before replacing the container, or configure a data directory in a mounted volume in the generated supervisor. The config/workspace mounts alone are not a complete session backup. - OCI: preserve the writable mounts you declared in the bundle; do not treat runtime scratch or the CLI companion’s Redis as a durable backup.
Upgrade and rebuild
Keep the old revision, lock file, and a state backup until the new deployment has answered a test request. Build the new CLI or image from the chosen source revision. On NixOS, update the host’s Cowboy input and rebuild the host, then check doctor and the first real request.
For the Docker walkthrough, stop and remove the old container after backing up,
load the new image, and repeat the run command with the same named volumes. A
settings-based container also has a generated flake and result link under its
configuration volume. Edit that persistent configuration and run cowboy bake
inside the container to build a generation; restarting with an existing result
link does not itself rebuild it. A new base image alone does not replace that
existing generation.
An approval-gated rebuild pins the main commit and resolved input overrides before asking for approval. The result reports when a successful build produced the same system or home generation. Treat that as no deployment change, not evidence that the requested behavior reached the running agent. See rebuild diagnostics.
Stop and remove
Stop local or CLI-managed agents with cowboy stop <name>. A foreground
cowboy serve stops with Ctrl-C in its terminal; cowboy stop reports it and
exits non-zero. A local serve with the name comes first: a resident of the
same name is left running, and cowboy stop says so. For a resident,
cowboy stop (like cowboy harness <name> --stop) also stops a running
cowboy-serve-<name> unit and names it. To
retire a managed daemon, stop its systemd unit, disable the agent in the NixOS
configuration, and rebuild. For the Docker walkthrough, stop and remove the
named container. Keep backups, then deliberately remove only the state and
volumes you no longer need. Removing software or disabling a service is
separate from erasing its history and keys. Revoke provider or publishing credentials when retiring
the deployment.
Continue with Configuration to change models, tools, message access, and service settings.