> ## Documentation Index
> Fetch the complete documentation index at: https://docs.paddockai.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI

> The paddock command-line tool: log in from your terminal or run paddock locally, then operate templates, agents, sessions, connectors, and the outbox, as tables or as JSON, and watch agents live.

`paddock` is a single binary for macOS and Linux, on amd64 and arm64. It logs in through the console and saves an API key that the CLI and every server SDK find, or runs paddock on your machine and saves that server's key, and it operates templates, agents, sessions, connectors, and the outbox: it sends messages, follows a session's events live, and sets and tests connector functions. It calls only the public API, so anything it does your backend can do with a server SDK. It is built for people and for coding agents such as Claude Code and Codex: it prints tables for people and the API's own JSON with `--json`, and every error says what to fix.

## Install

```bash theme={null}
curl -fsSL https://api.paddock.build/install.sh | sh
```

The script detects your OS and architecture, downloads the latest release and its `SHA256SUMS`, checks the binary's SHA-256, and installs it as `paddock` only when the checksum matches, printing `Checksum verified`. It installs into `/usr/local/bin` when that is writable, else into `~/.local/bin`, and prints how to add the directory to your `PATH` when it is not on it.

| Variable | Meaning |
| - | - |
| `PADDOCK_INSTALL_DIR` | The directory to install into |
| `PADDOCK_VERSION` | A version to install instead of the latest |
| `PADDOCK_INSTALL_URL` | Where releases are served, default `https://api.paddock.build` |

`paddock version` prints the installed version.

## Log in

```bash theme={null}
$ paddock auth login
Open https://console.paddock.build/cli?code=WDJB-MJHT in your browser (opened for you).
Check that the page shows the code WDJB-MJHT, then confirm.
Waiting for approval…
Logged in to https://api.paddock.build/v1 with key cli-macbook-2m7q (key_…3f9k2m7q).
Credentials saved to /Users/ada/.config/paddock/credentials.
```

`auth login` opens the console's approval page, which carries the code. Sign in, pick the organization, check that the page shows the same code, and confirm. The CLI then receives a new API key of that organization, named `cli-<hostname>-<suffix>`, where the suffix is the last four characters of the key's ID, so the keys of several logins from one machine are told apart; it checks that the key works, and saves it. No secret is typed or pasted. The key is an ordinary API key: it is listed on the console's **API Keys** page with origin **CLI login**, and you revoke it there. If no browser opens, open the printed URL on any device. `--no-browser` never opens one and only prints the URL and the code, for a remote machine, a container, or a coding agent's shell; `PADDOCK_NO_BROWSER=1` does the same for every login, and so does Linux with none of `DISPLAY`, `WAYLAND_DISPLAY`, and `BROWSER` set (VS Code Remote and Codespaces set `BROWSER` to open the URL on your own machine). The code expires after 10 minutes; run `auth login` again then. `--base-url URL` logs in to another paddock API, given as its base URL ending in `/v1`.

| Command | Does |
| - | - |
| `paddock auth login [--base-url URL] [--no-browser]` | Logs in and saves the key and the base URL to the credentials file, replacing it |
| `paddock auth status [--json]` | Prints the base URL and the key in use, the key masked or `none`, each with where it came from, and whether the API accepts the request. Exits 1 when the API refuses it |
| `paddock auth logout` | Removes the credentials file. The key stays valid until you revoke it on **API Keys** |

## Local server

`paddock server` runs paddock on your own machine: the API, the Gateway, and the Runtime service in one process listening on `127.0.0.1` only, an embedded PostgreSQL it downloads and runs itself, and a model endpoint that forwards your harnesses' calls to Anthropic and OpenAI with your own keys. There is no Docker, no E2B account, and no tunnel. It is local mode: an agent runs its harness, and every command the harness runs, as you, on your machine, with no sandbox around it. Use it for your own agents during development.

```bash theme={null}
$ export ANTHROPIC_API_KEY=sk-ant-…
$ paddock server start
PostgreSQL  17.6 on 127.0.0.1:15432, data in /Users/ada/.paddock/postgres/data
Harnesses   claude 2.1.300, codex 0.162.1 in /Users/ada/.paddock/harnesses
Paddock is running at http://127.0.0.1:8080/v1 (local mode: agents run on this machine, not in sandboxes)
API key: none required (base URL saved to /Users/ada/.config/paddock/credentials)
Agents:  /Users/ada/.paddock/agents
Logs:    /Users/ada/.paddock/logs/server.log
```

`server start` generates the server's keys on first use, installs the pinned PostgreSQL after checking its SHA-256 and the pinned Claude Code and Codex CLIs with `npm` (Node 22 or later), starts the server in the background, and saves its base URL to the credentials file, so every other command and the server SDKs use the local server at once. The local server needs no API key: a request without `Authorization` works, and a key a client sends anyway is ignored. It listens on `127.0.0.1` only, so only your machine reaches it. The model keys are read from the environment of `server start` and stay in the server's memory: they never reach an agent's files or environment. Nothing checks them at start; creating an agent whose harness's key is missing, such as a Codex agent without `OPENAI_API_KEY`, prints a warning, and its turns fail with `model_auth` until you restart the server with the key. Everything lives under `~/.paddock`, or `PADDOCK_HOME`: the keys, each agent's directory, the harnesses, PostgreSQL's binaries and data, and the logs. `PADDOCK_DATABASE_URL` names a PostgreSQL to use instead of the embedded one.

| Command | Does |
| - | - |
| `paddock server start [--config FILE] [--port 8080] [--grpc-port 9443] [--json]` | Starts the server in the background and prints its base URL, whether it requires an API key, and where agents and logs are; with `--json`, `{ baseUrl, apiKeyRequired, credentialsFile, home, logFile, warnings }`. A server already running is reported and kept, with the configuration it was started with |
| `paddock server run [--config FILE] [--port 8080] [--grpc-port 9443] [--services api,gateway,runtime]` | Runs the server in the foreground, logging to standard output and the log file, until Ctrl-C, which stops it as `server stop` does |
| `paddock server stop [--config FILE] [--yes]` | Stops the server, every agent's processes, and PostgreSQL, waiting up to 30 seconds. Stopping interrupts running turns, so it first asks `Stop the paddock server and N running agents? [y/N]` and goes on only on `y`; `--yes` or `-y` skips the question, which a script without a terminal must pass. The data and each agent's directory stay. After `server start`, an agent whose turn was interrupted wakes on its own within about 30 seconds and runs that turn again; any other agent wakes on its next message |
| `paddock server status [--config FILE] [--json]` | Prints whether the server and its PostgreSQL run, the server's process ID and base URL, and each installed harness's version |

### Configuration file

`--config FILE` takes a YAML file of the local server's settings. Every key is optional:

```yaml paddock.yaml theme={null}
port: 8080                    # --port
grpc_port: 9443               # --grpc-port
home: ~/.paddock              # PADDOCK_HOME
database_url: postgres://…    # PADDOCK_DATABASE_URL; the embedded PostgreSQL when unset
sandbox_provider: local       # PADDOCK_SANDBOX_PROVIDER: local or e2b
daemon_bin: /usr/local/bin/paddockd   # PADDOCK_DAEMON_BIN
daemon_sleep_after: 10m       # PADDOCK_DAEMON_SLEEP_AFTER
api_key: a-long-random-secret # unset: no key required
```

A flag wins over the file, the file over the environment variable, and the environment over the default. An unknown key, a value of the wrong type, a bad port, duration, or provider, and an empty `api_key` stop the start with the file's path and the key. `~/` in `home` and `daemon_bin` is your home directory, and a relative path is relative to the file. `server stop` and `server status` take the same `--config` when the file moves the home. A change takes effect at the next start after `server stop`.

With `api_key` set, the server requires it: every `/v1` request needs `Authorization: Bearer <api_key>` or a session token, and anything else gets `401 unauthorized`. `server start` saves the key with the base URL to the credentials file, so the CLI, the server SDKs, and `agents watch` send it on their own; for `curl`, add the header yourself. `api_key` has no environment variable, so a `PADDOCK_API_KEY` exported for the hosted API never locks your local server.

The console does not sign in to a local server; drive it with the CLI and the server SDKs. A connector's provider cannot reach `127.0.0.1`: to receive webhooks, run your own tunnel to the HTTP port and start the server with `PADDOCK_WEBHOOK_BASE_URL` set to the tunnel's URL followed by `/hooks`.

## Credentials

`auth login` and `server start` write one JSON file with mode `0600`, in a directory of mode `0700`:

```text theme={null}
$XDG_CONFIG_HOME/paddock/credentials     # when XDG_CONFIG_HOME is set
~/.config/paddock/credentials            # otherwise, on macOS too
```

```json theme={null}
{ "apiKey": "pdk_sk_…", "baseUrl": "https://api.paddock.build/v1" }
```

The CLI and every server SDK look up the key and the base URL in the same order:

1. **API key**: an explicit option (in a server SDK), then `PADDOCK_API_KEY`, then the credentials file. With none, requests carry no `Authorization`, which a local server without a configured key accepts.
2. **Base URL**: an explicit option (`--base-url` on `auth login`, or the SDK's option), then `PADDOCK_BASE_URL`, then the credentials file when no key comes from an option or the environment, then `https://api.paddock.build/v1`.

The file's key and base URL were saved together, so they are used only together: a key from an option or `PADDOCK_API_KEY` never goes to the file's base URL, and the file's key is never sent to another base URL. A file with a base URL and no key, as `server start` saves it for a local server without a key, gives the base URL alone. The file is read only when no key comes from an option or the environment. A missing file means no credentials; a file that is needed but cannot be read fails with its path; run `paddock auth login` to replace it or `paddock auth logout` to remove it. See [Authentication](https://docs.paddockai.dev/platform/authentication.md#api-keys).

## Templates

```bash theme={null}
$ paddock templates create ./examples/hello
TEMPLATE  HARNESS      MODEL          CREATED
hello@1   claude-code  claude-sonnet  2026-11-22 09:15:30 +01:00
$ paddock templates create -f template.yaml --dry-run
dry run: template.yaml is valid and would be repo-explainer@1
$ paddock templates create -f template.yaml
TEMPLATE          HARNESS      MODEL          CREATED
repo-explainer@1  claude-code  claude-sonnet  2026-11-19 09:15:30 +01:00
```

| Command | Does |
| - | - |
| `paddock templates create PATH\|-f FILE [--dry-run] [--json]` | Sends the YAML file as it is and prints the created version. `PATH` is the file, or a directory holding `template.yaml`. `--dry-run` runs every check, stores nothing, and prints the `name@version` a create would return |
| `paddock templates list [--json]` | Prints the latest version of every template, with `BUILT-IN` `yes` for the [built-in templates](https://docs.paddockai.dev/guides/templates.md#built-in-templates), or `No templates.` when there are none |
| `paddock templates get NAME[@VERSION] [--json]` | Prints a version, the latest by default, then its document as YAML. Save that YAML under another name to customize a built-in template |
| `paddock templates delete NAME@VERSION [--json]` | Deletes one version. Fails with `409 conflict` while an agent uses it, and for a built-in template (`builtin_template`) |
| `paddock templates delete NAME --all [--json]` | Deletes every version of a template, newest first, but only when no agent uses any; otherwise it deletes nothing and names each version in use and its agent count |

Tables name a template version by its ref, `name@version`, which is what `agents create` takes. Creating a document under an existing name adds that name's next version; a document identical to the latest version returns that version unchanged; and every version of a name runs on one harness, so a document with another harness is `409 conflict` with `details.reason` `harness_changed`. Agents keep the version they were created from. See [Templates](https://docs.paddockai.dev/guides/templates.md).

## Agents

```bash theme={null}
$ paddock agents create hello
ID                              TEMPLATE  HARNESS      MODEL          STATUS    SESSIONS  CREATED
agt_01jd7b3kq2v8w5x0m4n6p9r3t1  hello@1   claude-code  claude-sonnet  sleeping  0         2026-11-22 09:15:41 +01:00
url: http://127.0.0.1:8080/v1/agents/agt_01jd7b3kq2v8w5x0m4n6p9r3t1
$ paddock agents create repo-explainer@1 --json | jq -r .id
agt_01jd7b3kq2v8w5x0m4n6p9r3t1
```

The agent's URL takes messages: `POST <url>/messages` with `{"text": "…"}` sends one to the agent's default session, created on the first message, and wakes the agent; see [Agents and sessions](https://docs.paddockai.dev/guides/agents-and-sessions.md#send-to-an-agent).

| Command | Does |
| - | - |
| `paddock agents create TEMPLATE\|--template TEMPLATE [--json]` | Creates an agent from a template version, `NAME@VERSION`, or from a template's latest version, `NAME`, and prints it with its URL |
| `paddock agents list [--json]` | Prints every agent, newest first, with its template, status, and session count, or `No agents.` when there are none |
| `paddock agents get AGENT_ID [--json]` | Prints one agent |
| `paddock agents delete AGENT_ID [--json]` | Deletes an agent and its sandbox, and prints its ID |
| `paddock agents watch AGENT_ID` | Opens a terminal UI that follows the agent live |

### Watch an agent

```text theme={null}
agt_01jd7b3kq2v8w5x0m4n6p9r3t1  hello@1  claude-code  awake  1 session
╭──────────────────────────────────╮╭──────────────────────────────────────────────────────────╮
│ Sessions                         ││ ses_…5m4k3j2h   Events  Transcript  Stats   follow        │
│ > running  ses_…5m4k3j2h 12s ago ││ [1] user: Write and run a hello script                    │
│                                  ││ [2] turn.started user                                     │
│                                  ││ [3] tool_call file_write (Write)                          │
│                                  ││ [4] tool_result file_write                                │
│                                  ││ [5] tool_call shell (Bash)                                │
╰──────────────────────────────────╯╰──────────────────────────────────────────────────────────╯
↑↓ session  tab/←→ view  f follow  pgup/pgdn scroll  q quit
```

`agents watch` lists the agent's sessions on the left, newest first, with their status and last activity, and shows the selected one live on the right, through the [client SDK](https://docs.paddockai.dev/sdks/client.md) as a browser would see it. **Events** shows its event lines, **Transcript** its messages and each tool call's command or file, and **Stats** its status and error, turns, tool calls, the tokens its turns used, and the latest turn's time, time to first token, and wake time when it woke the agent; cost and the time until the agent sleeps are not reported by the API, and say so. `↑` and `↓` (or `k` and `j`) select a session, `tab` and the arrows switch views, `f` stops and resumes following, `pgup` and `pgdn` scroll while following is off, and `q` quits. With no sessions yet, it shows the `curl` that sends the first message.

The UI is `@paddockai/watch`, a Node.js program in the repository's JavaScript SDKs: `agents watch` runs `paddock-watch` from your `PATH`, or else runs it with Node.js 20 or later from the checkout you are in, after `(cd sdk/js && pnpm install && pnpm -r build)`.

## Sessions

```bash theme={null}
$ paddock sessions create --agent agt_01jd7b3kq2v8w5x0m4n6p9r3t1 --json | jq -r .id
ses_01jd7b4m2c9x8v7b6n5m4k3j2h
$ paddock sessions send ses_01jd7b4m2c9x8v7b6n5m4k3j2h "Explain this repository."
sent msg_01jd7b4n5p6q7r8s9t0v1w2x3y (seq 3)
$ paddock sessions stream ses_01jd7b4m2c9x8v7b6n5m4k3j2h
session ses_01jd7b4m2c9x8v7b6n5m4k3j2h running
[3] user: Explain this repository.
[4] turn.started user
[5] tool_call file_read (Read)
[6] tool_result file_read
[7] assistant: This repository is a Go monorepo…
[8] turn.ended completed
session ses_01jd7b4m2c9x8v7b6n5m4k3j2h idle
^C
```

| Command | Does |
| - | - |
| `paddock sessions create --agent AGENT_ID [--cwd DIR] [--system-prompt TEXT] [--reply-key KEY] [--metadata K=V]... [--json]` | Creates a session of an agent and prints it. `--metadata` repeats |
| `paddock sessions list [--agent AGENT_ID] [--json]` | Prints every session of the project, or of one agent, newest first, or `No sessions.` |
| `paddock sessions get SESSION_ID [--json]` | Prints one session |
| `paddock sessions delete SESSION_ID [--json]` | Deletes a session, its events, and its tokens, and prints its ID |
| `paddock sessions send SESSION_ID TEXT\|- [--json]` | Sends a message and prints its ID and `seq`; `-` reads the text from standard input. It returns once the message is stored, without waiting for a turn |
| `paddock sessions stop SESSION_ID [--json]` | Stops the running turn and holds waiting messages |
| `paddock sessions events SESSION_ID [--after SEQ] [--json]` | Prints every event of the session, or those after a `seq`, one line each |
| `paddock sessions stream SESSION_ID [--after SEQ] [--json]` | Follows the session live until Ctrl-C. It reconnects on its own and resumes after the last `seq` it printed; it exits 1 when the session is deleted |
| `paddock sessions token SESSION_ID [--ttl DURATION] [--json]` | Mints a [session token](https://docs.paddockai.dev/platform/authentication.md#session-tokens) for the client SDK, valid for `--ttl` (default `1h`, from `1m` to `24h`) |

Event lines show each event's `seq` in brackets: a message as its kind and text, a tool call or result by the normalized tool name such as `file_read`, the call followed by the harness's own name such as `(Read)`, a turn's start with its origin and its end with its outcome, and a line such as `session ses_… idle` when the session's status changes. Streaming text is not printed as it is generated; the assistant message that completes it is. With `--json`, `sessions stream` prints one JSON line per stream event, `{"session": …}` or `{"event": …}`, streaming messages and status updates included.

> [!WARNING]
>
> `sessions token` prints a credential: only the token and a newline, so you can pipe it, such as `paddock sessions token ses_… | pbcopy`. Anyone holding it can read and write that session until it expires. It is the only command that prints a credential.

See [Agents and sessions](https://docs.paddockai.dev/guides/agents-and-sessions.md) and [Streaming](https://docs.paddockai.dev/guides/streaming.md).

## Connectors

```bash theme={null}
$ paddock connectors create github-acme-web --preset github --param agent=agt_01jd7b3kq2v8w5x0m4n6p9r3t1 --param repository=acme/web
ID                              NAME             INBOUND        OUTBOUND  CREATED
con_01h455vb4pex5vsknk084sn02q  github-acme-web  v1 nodejs24.x  -         2026-11-19 09:20:11 +01:00
webhook: https://webhook.paddock.build/con_01h455vb4pex5vsknk084sn02q
inbound function: v1 nodejs24.x (preset github)
secrets: default
$ printf %s "$GITHUB_WEBHOOK_SECRET" | paddock connectors secrets set github-acme-web default
set secret default of github-acme-web
$ paddock connectors fn test github-acme-web --side inbound --request ping.json
result: accept (version 1, 38 ms)
answer: 202
dedupe key: 72f1a7f3-…
```

`CONNECTOR` is a connector's ID or its name. `SIDE` is `inbound` or `outbound`, and `RUNTIME` is `nodejs24.x` or `python3.14`.

| Command | Does |
| - | - |
| `paddock connectors create NAME [--inbound] [--outbound] [--preset PRESET] [--runtime RUNTIME] [--param K=V]... [--json]` | Creates a connector and prints it with its webhook URL. With `--preset`, it gets the preset's sides, each set to the preset's function with the preset's default params and your `--param` values over them (`--runtime` defaults to `nodejs24.x`); without, it gets the sides you name, or both |
| `paddock connectors list [--json]` | Prints every connector with each side's function, `no function`, or `-` for no side |
| `paddock connectors get CONNECTOR [--json]` | Prints a connector: its webhook URL, each side's function, the outbound rate limit, and its secrets' names |
| `paddock connectors delete CONNECTOR [--json]` | Deletes a connector and its functions; its URL answers `404` at once |
| `paddock connectors fn set CONNECTOR --side SIDE --file FILE [--runtime RUNTIME] [--param K=V]... [--json]` | Sets a side's function to the file's code and publishes it. The runtime defaults to `python3.14` for a `.py` file and `nodejs24.x` otherwise; the params are exactly the `--param` values you give |
| `paddock connectors fn test CONNECTOR --side SIDE --request FILE [--file FILE] [--runtime RUNTIME] [--param K=V]... [--json]` | Runs a side's function on a sample and prints the result and the function's logs. `--request` is a JSON file: `{ method?, query?, headers?, body, bodyEncoding? }` for `inbound`, or `{ address, text, attachments? }` for `outbound`, which delivers for real. With `--file`, the file runs as an unsaved draft; otherwise the saved version runs |
| `paddock connectors secrets set CONNECTOR NAME [--json]` | Sets a secret, creating it if missing, from standard input. The value is never printed |
| `paddock connectors secrets delete CONNECTOR NAME [--json]` | Deletes a secret other than `default` |
| `paddock connectors deliveries list CONNECTOR [--status STATUS] [--json]` | Prints every request to the connector's URL, newest first, with the function's result and the number of routes |
| `paddock connectors deliveries replay CONNECTOR DELIVERY_ID [--json]` | Runs the current inbound function again on a recorded request, for real, as a new delivery |
| `paddock outbox list [--session SESSION_ID] [--connector CONNECTOR] [--status STATUS] [--json]` | Prints the messages agents sent, newest first, with each one's key, status, and attempts |
| `paddock outbox retry OUTBOX_ID [--json]` | Queues a failed message again |

`connectors secrets set` reads the value only from standard input, so it never lands in your shell history or a process list, and it refuses a terminal, where what you type is echoed: pipe the value in. A test that ran exits `0` whatever its result. If a preset's function cannot be set after `connectors create` made the connector, the CLI says the connector was created, with its ID, before the error. See [Connectors](https://docs.paddockai.dev/guides/connectors.md) and [Connector functions](https://docs.paddockai.dev/guides/connector-functions.md).

## JSON output

Every command but `auth login`, `auth logout`, `server run`, `server stop`, `agents watch`, and `version` takes `--json`. It prints what the API returns: a resource such as a template, an agent, a session, an event, or a connector as the [API reference](https://docs.paddockai.dev/api-reference/introduction.md) documents it, a list as a JSON array of every item across every page (`[]` when there are none), a delete as `{ "deleted": [...] }` with the refs or IDs it deleted, `auth status` as `{ baseUrl, baseUrlSource, key, keySource, valid }` with the key masked, `sessions token` as `{ token, expiresAt }`, and `connectors secrets set` as `{ connectorId, name }`, never the value. When `templates delete NAME --all` fails, it prints the versions already deleted before the error: `{ "deleted": [] }` when it refuses before deleting any. Flags may come before or after the arguments.

Tables show times in your local time zone with its offset from UTC, such as `2026-11-19 09:15:30 +01:00`.

## Errors and exit codes

An API error goes to standard error as `error: <code>: <message>`, then each field error as `path: message` (or just the message, for a problem with the whole document), then any other detail, then the request ID. A template validation error whose message is its first field error prints that error once:

```text theme={null}
error: invalid_request
  spec.model: model gpt-5.5 runs on codex, not claude-code
  request: req_01jd7b3kq2v8w5x0m4n6p9r3t1
```

An error found while reading the YAML itself, such as a key paddock does not know or a value of the wrong kind, also names its line:

```text theme={null}
error: invalid_request
  spec.colour (line 8): unknown field
  request: req_01jd7b3kq2v8w5x0m4n6p9r3t1
```

With `--json`, the error is one line of the API's [error body](https://docs.paddockai.dev/platform/errors.md) with `requestId` added: `{"error":{"code":…,"message":…,"details":…,"requestId":…}}`.

| Exit code | Meaning |
| - | - |
| `0` | Success, or `--help` |
| `1` | Any failure: an API error, an unreadable file, no key |
| `2` | A usage error, such as `templates create` with neither a path nor `-f`, or a flag the command does not take (`paddock auth login: unknown flag --x`), which prints the command's usage and flags; an unknown command prints `unknown command` and every command's usage |

`paddock --help` lists every command; `paddock <group> <command> --help`, such as `paddock templates create --help` or `paddock connectors fn set --help`, prints that command's usage and flags.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.