# Agents

> Start a coding agent on your box, close the laptop, and let it work; it is an ordinary process on a machine you already pay for, so nothing it does is metered.

URL: https://prized.dev/docs/agents

## Start an agent [#start-an-agent]

```bash
prized agents run claude
```

This starts Claude Code in a detached tmux session named `claude`, in your synced project, and prints the reattach command; closing the lid changes nothing. `run` never starts a second copy of a session that exists; it says so.

| Flag        | What it does                                                                                                                            |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| `--attach`  | Land in the session as it starts; otherwise reattach later with `prized ssh -s claude`.                                                 |
| `--dir`     | Working directory. Defaults to your only synced project; a [clone](https://prized.dev/docs/sync#add-a-project) is not one, so pass `--dir ~/code/<name>`. |
| `--session` | Session name, for a second concurrent run of the same agent.                                                                            |
| `-- ARGS`   | Everything after `--` goes to the agent.                                                                                                |

> A working agent holds off [auto-pause](https://prized.dev/docs/boxes#auto-pause); what a pause does to it depends on the box size ([Pause and resume](https://prized.dev/docs/boxes#pause-and-resume)).

The agent's own copy action (Claude Code: select, then **c**) lands on your clipboard through `prized ssh` ([Copy out](https://prized.dev/docs/sessions#copy-out)).

## The agents [#the-agents]

| Agent                   | On the box                                     | Runs on the box |
| ----------------------- | ---------------------------------------------- | --------------- |
| Claude Code (`claude`)  | Preinstalled.                                  | Yes             |
| Codex CLI (`codex`)     | Preinstalled.                                  | Yes             |
| OpenCode (`opencode`)   | Installed on first use, from a pinned release. | Yes             |
| pi (`pi`)               | Installed on first use, from a pinned release. | Yes             |
| Cursor (`cursor`)       | Installed on demand (`--install-cursor`).      | Yes             |
| ChatGPT app (`chatgpt`) | Drives `codex` over SSH from your machine.     | No              |

`chatgpt` is a connection, not a process on the box, so its tasks stop when your machine sleeps and `prized agents run chatgpt` refuses; `prized agents run codex` survives a closed laptop. App setup is on [Codex remote](https://prized.dev/docs/codex).

### OpenCode and pi [#opencode-and-pi]

```bash
prized agents run opencode
```

The first `prized agents run` or `prized prompt` of either installs a pinned release on the box, checked against its SHA-256 before anything is unpacked; a mismatch installs nothing and the command says why. A copy you installed on the box yourself is used instead. Neither has a handoff: sign in on the box (`opencode auth login`; or `pi`, then `/login`), or set a provider key as a Secret ([Keys for other agents and backends](https://prized.dev/docs/credentials#keys-for-other-agents-and-backends)). OpenCode also runs its free models with no key.

## See what is set up [#see-what-is-set-up]

```bash
prized agents ls
```

One row per agent: installed and signed in on your machine and on the box, MCP servers found, and where it is running. For OpenCode and pi, signed in on the box means a sign-in or a provider key there. Read-only; takes `--json`.

## Hand credentials to the box [#hand-credentials-to-the-box]

```bash
prized agents handoff claude codex
```

Lists what would travel, asks, then copies the named agents' sign-in and MCP config to the box; `prized setup` runs the same step. Re-run it after changing MCP config. `--gh` adds your GitHub CLI token and git identity, `--install-cursor` installs Cursor's CLI first; what travels per tool is on [Credentials](https://prized.dev/docs/credentials).

## Drive it remotely [#drive-it-remotely]

```bash
prized prompt --provider claude "fix the failing tests and run them again"
```

`prized prompt` runs Claude Code, Codex, OpenCode or pi headless on the box and streams its events until the verdict; `prized events` follows a run and `prized interrupt` stops it, also over HTTP ([Prompt an agent remotely](https://prized.dev/docs/remote-agents)). A model written `amazon-bedrock/…`, `openrouter/…` or `deepseek/…` runs it on that backend ([Models and backends](https://prized.dev/docs/remote-agents#models-and-backends)).

## Several agents at once [#several-agents-at-once]

Each agent gets one session by default (`claude`, `codex`, `opencode`, `pi`, `cursor`), each in its own project via `--dir`. For two runs of the same agent, name the sessions:

```bash
prized agents run claude --session claude-api --dir ~/code/api
prized agents run claude --session claude-web --dir ~/code/web
prized ssh --ls
```

## Bring your own agent [#bring-your-own-agent]

Any CLI agent runs on the box. Pick `other` in setup's agent step and it prints these steps with your box's name filled in:

1. `prized ssh` opens the box, waking it if needed.
2. Install the agent's CLI there.
3. Sign in there, once per box; the credential stays on the box disk and Prized never sees it.
4. Run it detached in a named session: `prized ssh -s myagent`, or `tmux new-session -d -s myagent 'the-agent'` from any box shell. Reattach with `prized ssh -s myagent`.

For an API key, prefer a [Connector](https://prized.dev/docs/connectors): the box gets a placeholder and the real value never touches its disk. The handoff and `prized agents run` do not cover your own agent; sessions work the same.

## Review from your machine [#review-from-your-machine]

In a synced project, the agent's edits stream into the folder on your machine as it works, so you review the diff in your own editor. The box wins [sync](https://prized.dev/docs/sync#conflicts-the-box-wins) conflicts, so a local edit that races the agent yields to its work; a clone has no mirror, so review it over git.

> An agent on your machine can run the Prized setup itself with the prompt on [Agent setup](https://prized.dev/docs/agent-setup); for scripts, every CLI command speaks JSON ([CLI](https://prized.dev/docs/cli#for-agents-and-scripts)).
