Getting started

Use deck with AI agents

AI coding agents such as Claude Code and Codex, scripts and CI jobs can run deck with no person at a terminal. Pass every value as a flag, ask for JSON with --output json, and authenticate with an environment variable.

To set up Deckrun from your agent, paste "Set up Deckrun from deckrun.com/agents" into it. deckrun.com/agents has the steps your agent follows, and there is a page for Claude Code, Codex and Cursor.


The guide for agents

deck ships a guide written for AI agents, so it always matches the installed version:

deck agent-guide          # workflow, rules, commands with their flags and JSON
deck agent-guide config   # every deckrun.toml field, to write the config by hand

The guide tells the agent what to run and in which order, and what it must never do: run destructive commands, create a cluster without your explicit yes, or ask you to paste a cloud or Deckrun token into the chat. Before creating a cluster, the agent lists the regions and node sizes your provider offers, proposes the region closest to where you said your users are (or asks), proposes 2 nodes of the cheapest size with at least 2 vCPU and 4 GB of memory, and tells you the estimated monthly cost. The agent may open a deck forward tunnel on its own to diagnose a problem, but shows you every deck exec command and waits for your yes before running it. When you ask it to delete something, it gives you the exact command to run yourself. Point your agent to it, for example: "Read deck agent-guide and deploy this repo with Deckrun". deck --help also points agents to it.

The Deckrun Skill

The Deckrun Skill teaches your agent when to use Deckrun, how to install deck and sign in, and the rules above, and tells it to run deck agent-guide for everything else. Install it in Claude Code:

/plugin marketplace add deckrun/skills
/plugin install deckrun@deckrun-skills

Then ask, for example: "Deploy this repo to my DigitalOcean with Deckrun". The source is at github.com/deckrun/skills.

AGENTS.md

deck init adds a short Deckrun section to AGENTS.md next to deckrun.toml, so any agent working in the repo knows the app is deployed with Deckrun and how. It creates AGENTS.md if there is none.

  • If the repo has a CLAUDE.md, deck adds the section there too, because Claude Code doesn't read AGENTS.md when a CLAUDE.md exists. If your CLAUDE.md already imports @AGENTS.md, deck leaves it alone. deck never creates CLAUDE.md.
  • The section sits between <!-- BEGIN:deckrun --> and <!-- END:deckrun --> lines. deck only ever replaces what is between them, so keep your own instructions outside.
  • deck init --no-agents-md skips it.
  • In a repo that already has deckrun.toml, run deck write-agents-md to add or refresh the section. It reads the app name from deckrun.toml (-c for another file) and needs no token.

Authentication

Run deck auth login yourself, or let the agent run it in the background: deck prints the authorization URL first, so the agent can show it to you, and stores the token once you approve it in the browser. deck waits up to 15 minutes for the approval. If you don't have a Deckrun account yet, sign up from that page and open the verification email in the same browser: it brings you back to approve the CLI. If the time runs out, run deck auth login again.

Where there is no browser, such as a cloud agent or a CI job, set DECKRUN_TOKEN (and DECKRUN_TEAM_ID if you belong to more than one team). See Install Deck CLI.

No prompts

deck only asks a question when a person can answer it: stdin and stdout are terminals, no AI agent is detected and CI is not set. Otherwise, a missing value makes the command fail immediately with an error that names the flag to pass, for example:

region is required in non-interactive mode: pass --region

deck exec follows the same rule: it passes stdin and opens a TTY by default only when a person is at the terminal. Elsewhere, pass -i and -t explicitly if you need them.

Destructive commands (delete, secrets unset) still require --yes without a terminal. Agents should never run them.

JSON output

These commands accept -o, --output text|json:

auth login, providers add, providers list, clusters regions, clusters sizes, clusters create, clusters list, init, deploy, apps list, apps status, logs, releases list, secrets list, secrets set, domains add, domains list, write-agents-md.

  • Text is the default for everyone. Detecting an agent never changes the output, so your scripts behave the same whoever runs them. Agents pass --output json.
  • On success, stdout holds exactly one JSON document: an array for lists ([] when empty) and an object otherwise. It is compact when stdout is not a terminal, and indented when it is.
  • logs and auth login write one JSON object per line instead.
  • Progress and messages go to stderr, without colours. Commands never prompt in JSON mode.
  • Field names are snake_case and timestamps are RFC 3339. Secret values never appear in any output.
  • Within a major version, fields may be added but are never renamed, removed or retyped.

Shapes

providers list (and providers add, one object):

[{"id":"prov-1","type":"digitalocean","description":"DO main"}]

clusters regions: zones is empty for DigitalOcean.

{"provider_type":"scaleway","regions":[{"slug":"fr-par","name":"Paris","zones":[{"slug":"fr-par-1","name":"Paris 1"},{"slug":"fr-par-2","name":"Paris 2"},{"slug":"fr-par-3","name":"Paris 3"}]}]}

clusters sizes: cheapest first. price_monthly is per node, in currency, as of prices_as_of.

{"provider_type":"digitalocean","region":"ams3","zone":"","prices_as_of":"2025-09","sizes":[{"slug":"s-2vcpu-4gb","vcpus":2,"memory_gb":4,"price_monthly":24,"currency":"USD"}]}

clusters list (and clusters create, one object; with --no-wait the status is creating):

[{"id":"clu-1","name":"acme-prod","provider_id":"prov-1","region":"fra1","zone":"","size":"s-2vcpu-4gb","nodes":2,"auto_scale":false,"min_nodes":0,"max_nodes":0,"status":"created","load_balancer_ips":["203.0.113.10"]}]

apps list:

[{"id":"app-1","name":"web","cluster":"acme-prod","public_ip":"203.0.113.10","urls":["https://web.example.com"]}]

apps status: release is null when the app was never deployed, and failure only appears when the release failed. When the processes can't be fetched, processes is null and processes_error says why.

{"app":{"id":"app-1","name":"web","cluster":"acme-prod","urls":["https://web.example.com"]},
 "release":{"id":"rel-3","version":"v3","status":"error","image_url":"registry.example.com/web:3","created_at":"2026-11-06T10:00:00Z",
            "failure":{"category":"image_pull","message":"The image couldn't be pulled","hint":"Check the image exists","detail":"ErrImagePull"}},
 "processes":[{"name":"web","size":"small","autoscaling":{"min_replicas":2,"max_replicas":4},
               "pods":[{"name":"web-7d9f-abc","cpu":"2m","memory":"146Mi"}]}]}

releases list:

[{"id":"rel-2","version":"v2","status":"deployed","image_url":"registry.example.com/web:2","created_at":"2026-11-05T10:00:00Z"}]

deploy: urls is empty when the release exposes no HTTP process.

{"app":"web","release":{"id":"rel-4","version":"v4","status":"deployed"},"image":"registry.example.com/web:4","urls":["https://web.example.com"]}

init (agent_files is [] with --no-agents-md):

{"app":{"id":"app-9","name":"api","cluster":"acme-prod"},"config_file":"deckrun.toml","files_created":["Dockerfile"],"files_kept":[],"secrets_set":[],"agent_files":[{"path":"AGENTS.md","action":"created"}]}

write-agents-md (action is created, updated or unchanged):

{"files":[{"path":"AGENTS.md","action":"unchanged"},{"path":"CLAUDE.md","action":"updated"}]}

secrets list and secrets set (names only):

[{"name":"DATABASE_URL","updated_at":"2026-11-02T09:30:00Z"}]
{"secrets":["ALPHA","ZED"]}

domains list and domains add (public_ip is the address to point the DNS record at):

[{"id":"dom-1","name":"web.example.com","has_custom_cert":false}]
{"id":"dom-9","name":"shop.example.com","has_custom_cert":false,"public_ip":"203.0.113.10"}

logs (one line per log entry; --timestamps adds the timestamp to message):

{"pod":"web-7d9f-abc","container":"app","message":"GET /health 200"}

auth login (the first line is written before waiting for the approval; expires_at is when deck stops waiting, 15 minutes later):

{"event":"authorize","url":"https://app.deckrun.com/cli/authorize?port=53908&state=...","expires_at":"2026-11-13T10:15:00Z"}
{"event":"logged_in","team":{"id":"team-1","name":"Acme"}}

When your account belongs to several teams and --team isn't given, the login still succeeds, with no active team, and the last line lists the teams instead. Choose one with deck switch <team-id>:

{"event":"logged_in","teams":[{"id":"team-1","name":"Acme"},{"id":"team-2","name":"Beta"}]}

Errors

In JSON mode, a failed command writes nothing to stdout, writes one JSON object as the last line of stderr, and exits with code 1. tip, suggested_command and details only appear when they have a value.

{"error":{"code":"missing_flag","message":"region is required in non-interactive mode: pass --region"}}
CodeMeaning
missing_flagA required value is missing. The message names the flag.
invalid_flagA flag or value is not valid.
unauthorizedNo valid token. suggested_command is deck auth login.
missing_teamNo active team. Set DECKRUN_TEAM_ID or run deck switch.
forbiddenThe token's user can't do this.
not_foundThe app, cluster, provider or service named doesn't exist.
conflictThe resource is not in a state that allows the operation.
payment_requiredThe team has no active subscription.
deployment_limit_reachedThe monthly deployment limit was reached. details has limit, used and cycle_resets_at.
invalid_provider_credentialsThe cloud provider rejected the stored credentials.
confirmation_requiredA destructive command needs --yes.
invalid_filedeck can't safely edit a file, such as an AGENTS.md with a stray Deckrun marker. details has path.
deploy_failedThe release failed in the cluster. details has release_version and the diagnosed failure.
timeoutdeck stopped waiting for something outside it, such as the browser approval of deck auth login. Run suggested_command again.
internalAnything else. Read message.
Previous
Install Deck CLI