# Agent

URL: https://docs.hanzo.ai/docs/cli/agent

> The `hanzo agent` commands.

Also for this capability: [API](https://docs.hanzo.ai/docs/openapi/agent) · **CLI** · [MCP](https://docs.hanzo.ai/docs/mcp-tools/agent) · [SDKs](https://docs.hanzo.ai/docs/sdks)

Autonomous agents for your org: define them, run them, keep every run.

[API reference →](https://docs.hanzo.ai/docs/openapi/agent)

```bash
hanzo agent list
```

Every command takes `--json` for the raw response and `--help` for its own flags. Sign in once with `hanzo auth login`; the commands below use that session, and the org they act in is the one it carries.

| Command                    | What it does                                                                                                                                  |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `hanzo agent activity`     | Serves the org-wide recent-activity feed.                                                                                                     |
| `hanzo agent coding`       | Start one autonomous coding run against a repo in the caller's org                                                                            |
| `hanzo agent create`       | Defines an agent in the caller's org: a model, a system prompt (instructions) and a set of tool names.                                        |
| `hanzo agent get <ref>`    | Returns one agent with its system prompt and its 20 most recent runs.                                                                         |
| `hanzo agent list`         | Returns every agent defined in the caller's org, each with the number of runs recorded against it.                                            |
| `hanzo agent metrics`      | Serves the invocations-over-time histogram for the org's Agents dashboard.                                                                    |
| `hanzo agent rm <ref>`     | Removes an agent and every run recorded against it.                                                                                           |
| `hanzo agent run <ref>`    | Run one of your org's agents and get the recorded run back.                                                                                   |
| `hanzo agent runs <ref>`   | Returns one agent's execution history, newest first — each run's input, its output or its error, and how long it took.                        |
| `hanzo agent runs-all`     | Returns the org's agent runs across EVERY agent, newest first — what ran here, for whom, on which model, how long it took, and why it failed. |
| `hanzo agent spend <ref>`  | Answers what one of your org's agents has spent, in integer micro-USD.                                                                        |
| `hanzo agent update <ref>` | Changes an agent in place.                                                                                                                    |

### Builds

| Command                                      | What it does                                                                                                                                                                                                                                                                        |
| -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `hanzo agent builds list`                    | Returns the public index of every published build, most recently updated first, so a gallery can link straight to the story behind each product.                                                                                                                                    |
| `hanzo agent builds org get <org> <project>` | Returns the readable build of one product: the agent session that produced it, turn by turn — the prompts, the reasoning, the commits each turn produced — plus the exact `git log` that re-derives every commit binding from git itself, so nothing here has to be taken on trust. |

### Chat

| Command                                   | What it does                                            |
| ----------------------------------------- | ------------------------------------------------------- |
| `hanzo agent chat conversations create`   | Record turns in a conversation                          |
| `hanzo agent chat conversations get <id>` | Read one agent thread in full                           |
| `hanzo agent chat conversations list`     | List the agent threads in your org                      |
| `hanzo agent chat create`                 | Run one tool-calling round against your org's own tools |
| `hanzo agent chat presets`                | List the agent presets available to a caller            |

### Sessions

| Command                              | What it does                                                                                                                                                                         |
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `hanzo agent sessions budget <id>`   | Sets, raises, or removes a session's cap.                                                                                                                                            |
| `hanzo agent sessions control <id>`  | Returns the steering commands (pause/resume/stop/message) recorded against the caller's own session that are newer than the cursor, oldest first, with the cursor to poll from next. |
| `hanzo agent sessions create`        | Opens a live agent session in the caller's org — the row every surface (the CLI's outer agent, hanzo.bot, the console, chat) hangs its activity off.                                 |
| `hanzo agent sessions events <id>`   | Records one turn of a session's transcript and answers 201 with it.                                                                                                                  |
| `hanzo agent sessions get <id>`      | Returns one session with its direct child sessions and its 50 most recent events, oldest of those first.                                                                             |
| `hanzo agent sessions list`          | Returns the caller org's live sessions, newest first — each with its event count, its direct-child count and a one-line preview of its latest event.                                 |
| `hanzo agent sessions message <id>`  | Sends a steering message to a running session — the endpoint a human or another agent interrupts through.                                                                            |
| `hanzo agent sessions pause <id>`    | Asks a running session to pause.                                                                                                                                                     |
| `hanzo agent sessions progress <id>` | Returns how far along one run is: the share of its goal that is done, whether it is running, blocked or finished, and a line saying what it is doing right now.                      |
| `hanzo agent sessions resume <id>`   | Asks a paused session to continue, on the same terms as a pause.                                                                                                                     |
| `hanzo agent sessions stop <id>`     | Ends a running session.                                                                                                                                                              |
| `hanzo agent sessions stream`        | Live session and event updates for the caller's org, as Server-Sent Events.                                                                                                          |
| `hanzo agent sessions tree <id>`     | Returns the subagent-flow graph rooted at this session: the session, its children, their children, each node carrying its own event count.                                           |
| `hanzo agent sessions update <id>`   | Updates a session's surface-owned truth: its status, its title, the run-target it is dispatched to, and the product it built plus whether that build's story is public.              |

### Targets

| Command                                        | What it does                                                                                                                                                                                                                     |
| ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `hanzo agent targets claim <id>`               | The machine's long poll for work: it authenticates the daemon, stamps the liveness the dispatch gate reads (the poll IS the proof a runner is listening), and waits up to 25 seconds for the next run addressed to THIS machine. |
| `hanzo agent targets create`                   | Registers a machine as an agent target, or re-links one that is already registered.                                                                                                                                              |
| `hanzo agent targets get <id>`                 | Returns one registered machine, with its live session load.                                                                                                                                                                      |
| `hanzo agent targets key <id>`                 | Mints (or rotates) the claim key a `hanzo code --serve` daemon presents to claim work for this machine, and returns it ONCE: only its SHA-256 hash is stored.                                                                    |
| `hanzo agent targets list`                     | Returns every machine registered to the caller's org, newest first, each with its live session load.                                                                                                                             |
| `hanzo agent targets rm <id>`                  | Deregisters one machine.                                                                                                                                                                                                         |
| `hanzo agent targets runs report <id> <runId>` | Completes a claimed run: it delivers the terminal result to the run's durable owner, which is what lets that workflow finish.                                                                                                    |
| `hanzo agent targets update <id>`              | Updates one machine in place.                                                                                                                                                                                                    |
