Run an agent

Launch Claude Code, Codex, OpenCode, or Pi in a box and attach or detach sessions

AgentBox runs Claude Code, OpenAI Codex, OpenCode, and Pi inside a box, in a detachable tmux session — so you can leave the agent working, detach, and reattach later.

The agent verbs (claude, codex, opencode, pi) each create the box if it doesn't already exist, start the agent, and attach you. They share all agentbox create flags — see CLI commands — plus session-resume and attach controls. This page assumes you've read core concepts; the project-teleport mechanics live in teleport a project.

NOTE

<box> is optional almost everywhere — it defaults to the single box for the current project. Otherwise pass its short index (1, 2, …), name, or id prefix.

Launch an agent

agentbox claude is the one-liner: it creates a box (snapshotting the current directory), starts Claude Code in a detached tmux session, and attaches you. agentbox codex, agentbox opencode and agentbox pi have the identical shape.

agentbox claude                       # create a box + start Claude Code, then attach
agentbox claude -- --model sonnet     # pass extra args through to claude

Target another directory with -w, and put pass-through args after --. Boxes get an auto-numbered name by default; pass -n <name> to label one. The first run pulls or builds the agentbox/box:dev image (~1 GB, one-time) and offers a setup wizard that installs project deps and your dev server. See local Docker for the image and services and tasks for the wizard.

$ agentbox claude
log: ~/.agentbox/logs/claude.log
Starting Claude in a box...
> Run setup wizard? › Yes
  ...box ready...
attaching — Control+a d to detach, leaves claude running
Claude Code running inside a box, attached over tmux.

Detach and reattach

The agent runs in a detachable tmux session whose prefix is Control+a (not the usual Ctrl-b). Press Control+a then d to detach — the agent keeps running in the box.

Control+a also opens an actions menu: c (VS Code / Cursor), s (noVNC screen), u (box URL), t (a fresh shell in the same box, opened in a new tab), and k (destroy the box, after a confirmation). The shell tab opens as a cmux surface in the current workspace, a new tmux window, or a new iTerm2 tab depending on your terminal.

Reattach with agentbox attach — it picks the running agent session in the box automatically. Resync your host config and (re)start a session with agentbox claude start (or codex start / opencode start / pi start).

# detach from inside the session: press Control+a then d
agentbox attach 1                     # reattach to whichever agent is running on box 1
agentbox claude start mybox           # start a session (resyncs host ~/.claude)

agentbox attach is agent-agnostic — if multiple agent sessions live in the same box it prompts you to pick. It never auto-starts: when nothing is running it prints a warning and exits non-zero. To start a fresh session use the agent's own command (agentbox claude, codex, opencode, pi) — start also resyncs your host config so new skills, plugins, or a fresh login flow into the box. For --attach-in, --no-attach, and the other attach controls, see CLI commands.

HEADS UP

attach never resyncs your host ~/.claude (skills, plugins, login). After installing a new skill or signing in on the host, use claude start (or a fresh agentbox claude) so the box picks it up.

Switch agents

Codex, OpenCode and Pi follow the identical flow — agentbox codex / agentbox opencode / agentbox pi, each with attach, start, and login subcommands.

agentbox codex                        # OpenAI Codex in a box
agentbox opencode                     # OpenCode in a box
agentbox pi                           # Pi in a box
agentbox dashboard                    # switch between running boxes/agents

Auto-approve is on by default because the box is isolated from your host; pass --no-dangerously-skip-permissions to keep the agent's own approval prompts. Pi has no such flag — it ships with no permission prompts at all, which is why its own docs recommend running it in a container. Each agent shares an identity volume across boxes by default — opt out per box with --isolate-claude-config (and the codex/opencode/pi equivalents). See configuration and CLI commands.

You can run different agents in different boxes for the same project and switch between them with agentbox dashboard. Claude, Codex and Pi resume sessions; OpenCode does not yet (resume starts a fresh box).

A box carries only the agent you launched it for — its binary, its config volume and its credentials. agentbox claude gives you a box with no Codex, OpenCode or Pi credentials in it at all. If you later point another agent at that same box (from agentbox dashboard, or by running agentbox codex <box>), AgentBox installs it on first use, which adds a few seconds to that one launch. agentbox <agent> start <box> also syncs that agent's host config into the box (its model, provider and MCP settings), the same as a box created for it; --no-sync-config and attach skip the sync.

WHY

An agent you aren't using has no reason to have its login sitting in the box. Shipping only the selected agent also keeps the image smaller — the base image carries no agents at all, and each agent is added to the variant you actually ask for.

WHY

Auto-approve is safe to default on because the box can't touch your machine — it's isolated from the host. The agent works without stopping to ask, and you keep your laptop clean.

First-run auth

Credentials are handled on the host and seeded into every box (macOS Keychain doesn't transfer into containers). On the first agentbox claude with no credentials, AgentBox offers an interactive sign-in that's saved and reused by every future box. Skip it with -y (or in CI) and claude will prompt you to /login inside the box.

agentbox claude login                 # sign in once, reused by every box
agentbox codex login                  # device-auth flow for Codex
agentbox opencode login -- --provider anthropic
agentbox pi login                     # opens Pi's TUI; run /login, then /exit

Sign-in runs in a throwaway container, but the agent's own login TUI never takes over your terminal: AgentBox drives it behind the scenes, prints the approval URL, and prompts you for the code (or API key) itself. That keeps the flow identical in every terminal emulator.

Pi is the exception, and not by omission: its only sign-in is the in-TUI /login slash command, so there is no prompt sequence a host can drive. agentbox pi login hands your terminal to Pi itself — run /login, pick a provider, then /exit, and the captured auth.json is reused by every later box. Pi also reads ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY and the other provider keys straight from your environment, which is the headless path.

Pi's config in a box

Every Pi box gets your host ~/.pi/agent (settings, AGENTS.md, extensions, prompts, themes, skills), on local Docker, Remote Docker and every cloud provider. A few things worth knowing:

  • Symlinked skills arrive as real files. Skills under ~/.pi/agent/skills/ are often symlinks into a checkout elsewhere on your machine. AgentBox resolves them on the host before copying, so they work in the Linux box instead of arriving as dangling links. A link that is already broken on the host is skipped and named in the create log.
  • Pin the version with agentbox config set pi.version 0.70.2 (an exact version or npm dist-tag; ranges such as ^0.70 are refused; default latest) so new boxes stop drifting to the newest release.
  • MCP servers defined outside ~/.pi/agent are not copied. Pi's MCP extension can also read ~/.config/mcp/mcp.json and import servers from other tools' configs (Claude Code, Cursor, …). Those files can hold API keys, so AgentBox leaves them on the host and prints a note at create time with the file and how many servers it defines — never a server's name or contents. ~/.pi/agent/mcp.json itself is always copied, even when it is a symlink to a file elsewhere (as stow or chezmoi set it up); the note then tells you the box got a copy of that file. To use those servers in a box, put the ones you need in ~/.pi/agent/mcp.json, or copy a file explicitly with carry:.

Two escape hatches:

  • --interactive hands your terminal to the agent's own login TUI — the old behavior. Use it for a login method the guided prompt can't drive (an exotic agentbox claude login -- --sso, or OpenCode's GitHub Copilot picker, which AgentBox falls back to automatically).
  • --headless (claude, and the automatic choice with no TTY) prints the URL and a greppable AGENTBOX_LOGIN_URL= marker, then you finish with agentbox claude login --code <CODE> — so an orchestrating agent can drive the sign-in. Codex's device-code flow needs no keystroke at all, so it already works without a terminal.
$ agentbox claude
? Sign in with your Claude subscription? (saved and reused by every box) › Yes
✔ Signed in with your Claude subscription — saved for future boxes.

Setting ANTHROPIC_API_KEY / CLAUDE_CODE_OAUTH_TOKEN (Claude) or OPENAI_API_KEY (Codex) on the host forwards it into the box and skips the sign-in offer. Host ~/.claude stays the source of truth — every create / claude syncs it in, so skills, plugins, MCP, and login flow into the next box. Cloud providers capture the login to ~/.agentbox and push it in on create — see hetzner, daytona, and vercel.

Several accounts per agent

Claude and Codex can keep more than one login: a personal and a work subscription, a long-lived token for CI, or an API key. The plain agentbox <agent> login signs in the default account. Everything else lives under agentbox credentials. Run it bare in a terminal for a table of every account with its status, plan meters and boxes, under two actions (Add an account…, What do new boxes here use?). Move with the arrow keys (or j/k) and press Enter on an account to renew it, make it the default, move a box onto it or remove it; Esc or q quits. Each action is also a subcommand:

agentbox credentials add claude/work --login                  # a second subscription login
agentbox credentials add codex/work --login
agentbox credentials add claude/ci --setup-token              # paste a `claude setup-token` token
agentbox credentials add claude/overflow --api-key            # paste an API key

A named login signs in against its own config volume, separate from the default one. Your host's login and its cached profile are never copied into it, so each account shows its own email and plan. A setup token or API key is read from a hidden prompt, or from stdin without a terminal (… --setup-token < token.txt). It is never read from the command line, which would leave it in your shell history. A pipe that sends the token and never closes is fine: the read ends once a full line has arrived and the pipe goes quiet.

default is always the agent's own login, so a setup token or API key needs a name (credentials add claude/ci --setup-token). To have new boxes use it, make it the default with agentbox credentials use claude/ci --global.

An account has one name, which is also how you refer to it (claude/work). A new name is lowercased and runs of spaces or - become _: credentials add "claude/Work Max" (or typing "Work Max" in the menu) stores claude/work_max, and says so before it saves. Anything else outside letters, digits and _ is refused (claude/bad.name). Older names with a - keep working.

Prefer a setup token for an account that several boxes use at the same time. A subscription login renews itself, and each renewal signs out every other copy of that login until AgentBox hands them the new one. A setup token never renews.

agentbox credentials                  # the menu (on a terminal), else the list
agentbox credentials list --json      # name, kind, email/plan, status, limits, default, boxes
agentbox credentials rm claude/work   # its stored login and config volume (not while a box uses it)

The STATUS column reads revoked when a box's agent had the account's login refused (Claude's "Login expired · Please run /login" after another box's renewal signed it out, or a revoked setup token or API key) and has not had a real reply since, nor has the stored login been renewed. Each box counts on its own: another box working on the same account does not clear it, and the status names the box that is still failing. It reads at limit when a plan window is full, and expiring for a setup token in the last 30 days of its year. A revoked login comes back with one command:

agentbox credentials renew claude/default   # sign in again, then push the login to every box on it
agentbox credentials renew claude/work --skip-sign-in   # the stored login is fine; only a box lost it

Without a terminal, renew (like add --login) prints the sign-in URL; finish with agentbox credentials renew claude/work --code <CODE>, which then pushes the login out.

You can also sign in from the hub itself, with no terminal on the PC. On Settings → Subscriptions, a revoked account shows a Revoked badge and the box where it was seen failing. Renew opens a dialog: open the page it shows and approve, then paste the code back (claude) or enter the one-time code on the device page (codex). The new login replaces the stored one and is pushed to every box on the account. Sign in with a new account (at the top of the page) works the same way for a new account: pick the agent and a name, and the same sign-in dialog follows. Add a setup token or API key opens a dialog to paste one under a name. The sign-in runs on the hub's machine, so on a remote control box it signs in that box's own store. A control box's hub runs in a container with no docker of its own, so there the sign-in container runs on the box's own docker engine (the hub host its deploy registers; agentbox hub update registers it again if it is missing). The first sign-in for an agent there adds that agent to the box image on the engine, which takes a minute or two. The tray uses the same /api/v1/accounts/{agent}/{id}/login routes (see the API reference).

Accounts are stored on this machine, in ~/.agentbox/accounts.json, with each secret 0600 under ~/.agentbox/credentials/. The default row appears as soon as the agent is signed in on this machine, including a login only the agent's own file holds (~/.claude/.credentials.json) that no box has backed up yet. If accounts.json is damaged, the list, credentials list --json (storeError) and the Subscriptions page name the file. Only the default logins are shown, and every change is refused until you fix the file or move it aside. The hub's Settings → Subscriptions page shows the same list, each card named by the account with its login's email and plan, and lets you add a login, setup token or API key, renew a login, remove one, and pick the default.

With a remote hub the subscriptions belong to the hub, not to the computer that signed them in: every computer, the web UI and the menu-bar app see one list, and any of them can create a box on any entry. See subscriptions on a remote hub. agentbox credentials then shows and changes the hub's list; agentbox credentials --local shows this computer's own store, which its docker boxes use.

Choosing the account a box runs on

agentbox claude --account work                 # this box only
agentbox create --account claude=work          # repeatable: --account codex=work
agentbox credentials use claude/work           # default for this project
agentbox credentials use claude/work --global  # default everywhere
agentbox credentials use                       # per agent: what a new box here gets, and why
agentbox credentials use claude --clear        # drop this project's setting

credentials use writes the <agent>.account config key (refusing an account that does not exist), so agentbox config set claude.account work still works. With a remote hub it still writes this computer's config (that is what a create from here sends), and checks the name against the hub's list. The global default can also be picked with Make default on the hub's Subscriptions page. agentbox list shows each box's account in the SUBSCRIPTION column (default, or claude/work).

--account wins over the project setting, which wins over the global one; with none, the box uses the default account. A repo's agentbox.yaml cannot choose an account: it is your choice which subscription a project bills, so a value there is ignored with a warning. The account is fixed when the box is created and recorded on it, so changing the setting later does not move existing boxes; switch the box to move it.

A box on a named account gets exactly that account's auth:

  • A login account runs on its own config volume (docker) or its own slice of the credentials volume (Daytona), seeded with your host's settings, skills and plugins but never your host's login, profile or settings.json API key. On docker, Claude's conversations are kept apart from the login: every account's boxes share one agentbox-claude-projects volume, so claude --resume in a box on claude/work finds a session started on default. Each new box copies in the sessions that boxes created before the upgrade still write to their own volume; --isolate-claude-config boxes keep their own.
  • A setup token or API key account reaches the agent as CLAUDE_CODE_OAUTH_TOKEN / ANTHROPIC_API_KEY (codex: OPENAI_API_KEY), and an API-key account is pre-approved so Claude never asks whether to use it. It never appears on a docker command line. On a cloud box it is kept out of the sandbox's create env (which the provider's console shows) and written only to the box's 0600 agent env file.
  • The host's own ANTHROPIC_API_KEY, CLAUDE_CODE_OAUTH_TOKEN and OPENAI_API_KEY are not forwarded into it, so they cannot take over.

A borrowed --model-auth codex login uses codex.account the same way (it has to be a login account).

When a box renews an account's login, AgentBox copies the new token to that account's other boxes (and to your control box, if you have one), never to boxes on another account. Signing a login in again does the same: agentbox <agent> login pushes the new default login to the boxes on default, and agentbox credentials renew to the boxes on that account. Each renewal still signs the other copies out until they receive it, so give an account that several cloud boxes use at once a setup token: it never renews.

Switching a box to another account

agentbox credentials switch my-box claude/ci      # a setup token or API key
agentbox credentials switch my-box claude/work    # a login

The box page in the hub has the same choice: an account selector on the agent's row in Details, with the box's last switches under it. Either way the agent keeps its conversation on the new account:

  • To a login, on any provider: the account's login is written into the box's own copy of the credential file, and nothing is rebuilt. Claude reads that file before every request, so it keeps running and its next turn uses the new account. Other boxes on either account are not touched. A docker box can switch while running, paused or stopped. A cloud box must be running. Codex can't switch to a login on docker yet. On a cloud box it is restarted, since it isn't known to re-read its file.
  • To a setup token or API key, on any provider: the agent's session restarts with that token set and the other auth variable cleared, and resumes the same conversation. A token that does not have the agent's shape is refused before anything changes (Claude ignores a malformed setup token and reads as logged out). Leaving a token for a login restarts the agent too, since the token's variable has to go.
  • A docker box created before boxes had their own credential file can only go back to the login it was created with (a restart). For any other login, destroy it and create it again.

Before the switch, AgentBox keeps a renewal the box made of the old account's login, so that account's other boxes don't lose it. If the agent was renewing the old login at the moment of the switch, that renewal can land in the box afterwards. AgentBox spots it (the login names its own account), stores it for the old account, and puts the new account's login back, so the switch holds. Any other login you sign in inside the box stays in that box only. A cloud box that was stopped while its account changed gets the account's login when it resumes, unless the box holds a newer one. A box that is not running records a token switch and uses it at its next start. Usage is counted under the account the box records. Claude's /status can show the old account's name until its next profile refresh; requests use the new login.

When an account hits its plan limit, the hub can do this for you. The accounts.onLimit key (global, or Settings → General in the hub) is ask by default: an approval offers to move each running box on that account to the next account of the same agent that is not at its limit, and you answer it in the web, the tray or the CLI. With switch the hub moves the box on its own. Each box is asked once per limit window.

agentbox config set accounts.onLimit switch --global

Route LLM traffic through the hub

With llm.proxy: forward, a box's model traffic leaves from the hub's IP instead of the box's own. The rest of the box's traffic still goes direct: package installs, git, telemetry. This is useful when an account should always be seen from one address, or when the box's network shouldn't talk to model providers directly.

agentbox config set llm.proxy forward             # turn the hub's proxy on (global), and on for every new box
agentbox hub restart                              # the proxy listener starts with the hub
agentbox claude --llm-proxy forward               # or per box (needs the proxy on, above)

Only the hosts each agent declares are proxied: Claude's api.anthropic.com, platform.claude.com, mcp-proxy.anthropic.com and claude.ai, and Codex's chatgpt.com, ab.chatgpt.com, auth.openai.com and api.openai.com. Inside the box, a small proxy on 127.0.0.1 sends those hosts to the hub and everything else direct. Only the agent process is pointed at it, through HTTPS_PROXY; an existing NO_PROXY is kept. Agents that declare no model hosts (opencode, pi) are not proxied, even in a forward box.

The hub's side is an HTTP CONNECT proxy on llm.proxyPort (default 8790). It runs only once this machine opted in, with llm.proxy: forward in the global config or llm.proxyUrl set; until then a forward create is refused. llm.proxyPort and llm.proxyUrl are read from the global config only, since they are this machine's address. It never decrypts and only tunnels to those model hosts on port 443.

Each box authenticates with a proxy-only credential: its box id plus an HMAC of its relay token. The relay token itself, which is the box's identity for git pushes, host tools and file copies, is never sent to the proxy. The leg from a box to the hub's proxy is unencrypted TCP, so that scoped credential can be read by anyone on the path. It can only be used to reach these model hosts through the hub, for that box. The model traffic inside the tunnel is still end-to-end TLS between the agent and the provider.

  • Docker boxes reach it at host.docker.internal:<llm.proxyPort>. No setup.
  • Cloud and remote-docker boxes need llm.proxyUrl, the host:port where the hub's proxy port is reachable from the internet. A create with forward and no llm.proxyUrl is refused. A Cloudflare tunnel carries no raw TCP, so it can't be used for this. On Vercel, the proxy host is added to a networkPolicy allowlist automatically.

The setting is fixed at create and shown as llmProxy on the box in the API. It fails closed: if the hub can't be reached, the agent's call fails with an error naming the hub instead of going out directly.

Share a login you already have

Some agents can run on a model-provider login another agent holds, so you do not have to sign in twice. pi and opencode are both multi-provider and both accept your Codex (ChatGPT subscription) login:

agentbox pi --model-auth codex        # this box
agentbox opencode --model-auth codex
agentbox config set pi.modelAuth codex   # every box; `none` to stop being asked
agentbox create --model-auth codex       # an agentless box, seeded for later

The host copies your Codex login into the box at Codex's own path, and the agent imports it into its own store before its session starts. Coding agents never prompt for this — they have their own sign-in, so it happens only when you ask for it with the flag or the config key.

agentbox create takes the same flag even though it launches no agent: the login still lands at its own path in the box and is recorded on the box, so the first agent you start in it later — agentbox pi <box>, agentbox openclaw <box> — imports it with no second decision from you. There is no agent to read a per-agent modelAuth key or to ask on your behalf, so on create the flag is the only way in, and it only accepts logins an agent is known to be able to borrow (today: codex).

The choice travels with a create that runs on a control box too — only the name of the login goes over the wire; the login itself is already in the control box's custody from agentbox hub credentials push, and the box is seeded from your copy, never from whatever that machine happens to hold.

A box cannot refresh a borrowed login by itself — the provider rejects a refresh from a different tool. The box works until the copied token expires, and is renewed by agentbox credentials propagate --agent codex, which pushes your host's refreshed login and re-runs the import. Boxes on their own login (agentbox codex) are unaffected.

Your Claude login is deliberately not shareable this way: a refresh inside a box would rotate the token and sign you out on the host and in every Claude box. Use ANTHROPIC_API_KEY for that instead.

Credential sync across boxes

Claude's OAuth refresh rotates the refresh token: the moment any box refreshes, every other copy of that login (the host backup, other boxes) stops working and 401s. AgentBox handles this automatically: the in-box supervisor watches each agent's credential file (~/.claude/.credentials.json, codex/opencode/pi auth.json) and reports a refreshed blob to the host relay, which keeps the newest one (for Claude, expiresAt decides; codex/opencode/pi are last-writer-wins) and pushes it into all your other running boxes — docker boxes via their config volumes (paused ones included), cloud boxes over the provider transport. A paused cloud box is reconciled when it wakes: resume/start compares the box's blobs with the host backup and pushes or captures whichever is newer.

This is on by default; disable it per box with agentbox create --no-credential-sync or globally with agentbox config set box.credentialSync false. A long-running agent session may hold the old token in memory and ask you to /login once even after the file was fixed — restart the session and it picks up the fresh login.

Expired vs. dead

Two different things get called "expired", and only one of them needs you:

  • The access token lives about 8 hours and renews itself from the refresh token. A saved login whose access token lapsed overnight is perfectly healthy — AgentBox renews it for you before seeding a cloud box, without asking.
  • The refresh token lives about 30 days, and is also what rotation kills. When it has run out (or another copy of the login spent it), nothing can renew it, and only a fresh sign-in helps:
$ agentbox vercel claude
? Your saved Claude login can no longer be renewed. Sign in again? › Yes

Say yes to that prompt only when you see it — signing in when you did not need to spends the shared refresh token, which is exactly what logs your other boxes out.

TIP

Sign in once on the host. Install a skill or sign in there, and the next box picks it up automatically. See configuration and sync and git.

Model gateways on your machine

If your agent config points at a model gateway on your own machine (LiteLLM, Ollama, LM Studio, a local proxy) through http://127.0.0.1:<port> or http://localhost:<port>, that address means the box itself once it is inside a box. AgentBox handles these endpoints when it syncs your config:

AgentWhere the endpoint lives
Codex~/.codex/config.toml: model_providers.<id>.base_url
Claude~/.claude/settings.json: env.*_BASE_URL (e.g. ANTHROPIC_BASE_URL)
OpenCode~/.config/opencode/opencode.json(c): provider.<id>.options.baseURL
Pi~/.pi/agent/models.json: providers.<id>.baseUrl (and per-model baseUrl)
  • Local Docker rewrites the host part to host.docker.internal in the box's copy (port and path unchanged) and prints one line per rewrite. Only endpoints from your host config are rewritten; config you change inside the box is left alone, so a box-local service stays reachable. Your host files are never modified.
  • Linux Docker engine: there host.docker.internal is the docker bridge address (usually 172.17.0.1), so a gateway listening on 127.0.0.1 only still refuses the box. AgentBox probes the bridge address on create and on <agent> start. If nothing answers, it warns you to bind the gateway to 0.0.0.0 or the bridge address (for Ollama: OLLAMA_HOST=0.0.0.0). Docker Desktop and OrbStack forward to your machine's loopback, so no change is needed there.
  • Cloud providers never rewrite: a cloud box has no route back to your machine. The bake (agentbox prepare) warns once for each loopback endpoint; point it at an address the box can reach (a public URL or a tunnel).
  • Remote Docker boxes do not receive your host agent config, so these endpoints never reach them.

Provider URLs set as host environment variables (OPENAI_BASE_URL, ANTHROPIC_BASE_URL) are not forwarded into boxes at all; set them in the agent's config file instead.

Add an agent AgentBox does not ship

The four built-ins are not the whole list. An agent can also arrive as an npm package, the way a custom provider does:

$ npm i -g agentbox-agent-demo
$ agentbox agent add agentbox-agent-demo
registered demo from agentbox-agent-demo@0.1.0

$ agentbox agent list
claude               built-in
codex                built-in
opencode             built-in
pi                   built-in
demo                 agentbox-agent-demo@0.1.0 (agent API v1)

A path works too, for a package you are developing: agentbox agent add ./my-agent. agentbox agent remove <package> unregisters it (it does not uninstall the npm package). When its agents have named accounts, it asks whether to delete them too (rows, secrets and their docker volumes); it refuses while a box still uses one. --purge-accounts or --keep-accounts answers without a prompt; kept accounts are hidden until the package is added again.

An agent package exports one thing — an agentSpec describing where its config lives on the host and in the box, how to install it, and what it can do:

export const AGENT_API_VERSION = 1;

export const agentSpec = {
  id: 'demo',
  aliases: ['demo-agent'],
  sessionName: 'demo',
  binary: 'demo-cli',
  install: { kind: 'npm', package: 'demo-cli' },
  dockerVolume: 'agentbox-demo-config',
  staticPaths: [{ hostHomeRel: ['.demo'], boxDir: '/home/vscode/.demo' }],
  credential: {/* where its login lives, on the box and in the host backup */},
  forwardedEnvKeys: [],
  boxRunEnv: {},
  caps: { resume: false, teleport: 'stub', activitySource: [] },
};

-i "<prompt>" passes the prompt to your binary as its first positional argument. If your CLI takes the first user turn behind a flag instead, declare it as seedPromptFlag (for example seedPromptFlag: '--prompt', which is what opencode uses, since its positional argument is the project directory).

A complete, working example ships in the repo at examples/agentbox-agent-example — one dependency-free file. Register it with agentbox agent add ./examples/agentbox-agent-example to see the whole flow.

agentbox agent add loads the package once, checks the spec, and snapshots it into ~/.agentbox/agents.json. Everything afterwards reads the snapshot, so no part of AgentBox has to import your package to know the agent exists — and your agent's host config is staged into every cloud provider's snapshot from those staticPaths alone.

NOTE

A package cannot claim the name — or an alias — of a built-in agent; agent add refuses it, so nothing can quietly take over agentbox claude.

Next steps

On this page