doctl harness-runtime create
Generated on 1 Oct 2026
from doctl version
v1.177.0
Usage
doctl harness-runtime create [<manifest>] [flags]Aliases
deploy, start, runDescription
Create a hosted session, wait until it is ready, optionally send --prompt, and print a ready summary. It never opens the chat — that is doctl harness-runtime launch, which is the only difference between the two commands. Open the session later with doctl harness-runtime launch <session>.
Provide exactly one of:
- a manifest — as a positional path, or with
--spec/-f/--file(-reads stdin). With none of these,./agents.yamlis used when it exists. --harness— opencode, claude-code, codex, or codex-agentapi (builds the manifest for you).codexis the Codex CLI, with the agent loop run by DigitalOcean;codex-agentapiis OpenAI’s sandbox-provider model, where the loop and session state live at OpenAI and DigitalOcean supplies only the sandbox (and which checkpoint, fork, and rollback do not cover).--from-config— an existing Agent Config, by name or ID (--namerequired)
These four are equivalent:
doctl harness-runtime create # uses ./agents.yaml
doctl harness-runtime create agents.yaml
doctl harness-runtime create -f agents.yaml
doctl harness-runtime create --spec agents.yamlWith a manifest or --harness, optionally pass --gh-repo and --prompt. Example:
doctl harness-runtime create --harness claude-code --gh-repo owner/repo --prompt "Review the README"Flat manifests use a top-level name (or pass --name, which writes that field). Minimal example:
name: my-session
agent: opencodeEgress (optional). Omitting egress leaves destinations unrestricted. Exactly one form:
egress: unrestricted- host allowlist:
egress: [api.github.com, pypi.org] - object:
allow_hosts,allow_ips(exact IPv4/IPv6 literals — not CIDRs), and optionalvpc_uuid/subnet_uuid(subnet_uuidrequiresvpc_uuid; VPC attachment is create-time immutable)
egress:
allow_hosts: [api.github.com]
allow_ips: ["203.0.113.10"]
vpc_uuid: <uuid>${VAR} in a manifest is expanded from your environment (prompted in a terminal when missing). For codex and codex-agentapi, doctl prompts for $OPENAI_API_KEY when unset.
Secrets. --secret NAME=VALUE fills a secret slot the manifest declares, overriding any value written in the file — so a checked-in agents.yaml can name the credentials it needs without carrying them. NAME=@path reads the value from a file and NAME=- from stdin, neither of which leaves it in shell history. Repeat the flag per secret. For claude-code, --secret ANTHROPIC_API_KEY=@path (or =-) is enough — the key need not also be in the process environment. NAME=- cannot be combined with a manifest on stdin (--spec -). Not needed with --from-config: that config captured its values when it was created, and keeps them server-side.
Inspect before creating. --dry-run prints the fully-resolved manifest — name applied, ${VAR} expanded, secret values redacted — and exits without calling the API. That makes a working --harness invocation reusable, with no file ever touching disk:
doctl harness-runtime create --harness claude-code --gh-repo owner/repo --dry-run \
| doctl harness-runtime config create --spec - --name reviewer --secret ANTHROPIC_API_KEY=@~/.secrets/anthropic.keyUnattended runs. --on-hitl approve|reject|defer stays attached headlessly after the session is ready — no TUI, no keyboard input, one log line per event — and resolves every approval request that way until the run finishes. Ctrl-C detaches and leaves the session running. Combined with the global --interactive=false, an agent can drive a whole run with no human present:
doctl harness-runtime create --spec agents.yaml --prompt "Fix the failing test" \
--on-hitl approve --interactive=falseFrom another shell, poll with show <session> -o json, move files with upload / download, and tear down with remove (also destroy / rm).
Surviving a low balance. When a team’s prepayment balance runs out, running sessions are paused. --resume-on-topoff opts this session in to being resumed automatically once the balance is topped off, so an unattended run picks up where it stopped instead of waiting for someone to notice:
doctl harness-runtime create --spec agents.yaml --prompt "Fix the failing test" \
--on-hitl approve --resume-on-topoffIt is off by default and is spending consent, so it is deliberately narrow: per-session (never inherited from an Agent Config, and never by a fork) and honoured only for a session paused for low balance whose last run had not finished. A session you paused yourself, or one that idled out, stays paused. It is not an agents.yaml field — pass the flag on each create, or change it later with doctl harness-runtime update <session> --resume-on-topoff[=false].
Creating from a manifest or --harness also persists an Agent Config named after the session (shown as Config on the ready card). Start later sessions from it with create --from-config or config start-session.
Use -o json for machine-readable create output without waiting. Combined with --prompt, doctl still waits until the session is ready and delivers the prompt before printing JSON — otherwise the prompt would be dropped.
Example
doctl harness-runtime create ;Flags
| Option | Description |
|---|---|
--dry-run |
Print the fully-resolved manifest (secrets redacted) and exit without creating anything Default: false |
--format |
Columns for output in a comma-separated list. Possible values: SessionID, Name, AgentKind, Status, ConfigID, ParentSessionID, ForkID, RepoHint, CreatedAt, PauseReason. |
--from-config |
Name or ID of an existing Agent Config to create the session from. Requires –name. Mutually exclusive with –harness and –spec. |
--gh-repo |
GitHub repository to clone into the workspace (https://github.com/org/repo or org/repo). Only with –harness or –spec. |
--harness |
Coding-agent harness (opencode, claude-code, codex, codex-agentapi). Builds the manifest for you. codex is the Codex CLI run by DigitalOcean; codex-agentapi is OpenAI’s sandbox-provider model, where OpenAI runs the agent loop. Omit it and pass –template sandbox for a sandbox with no agent in it, which you drive with exec, upload, download and port-forward. Mutually exclusive with –spec and –from-config. |
--help, -h |
Help for this command |
--name |
Name for the new session. On flat manifests sets top-level name; on legacy envelopes sets metadata.name. If omitted, the server auto-generates a name. Must be unique among your team’s active sessions. Required with –from-config. |
--no-header |
Return raw data with no headers Default: false |
--on-hitl |
Stay attached headlessly and resolve every approval request this way (approve|reject|defer), until the run finishes. For unattended automation; no TUI, no keyboard input. |
--permission |
Tool-permission default for a –harness session: allow (run tools without asking), ask (raise an approval request per tool call, resolvable with ‘doctl harness-runtime approve’), or deny. Written as the manifest’s permissions.default. Only valid with –harness; a –spec manifest declares its own. Default: allow |
--prompt |
Initial prompt to send once the session is ready |
--resume-on-topoff |
Let DigitalOcean resume this session automatically once your team’s prepayment balance is topped off after a low-balance pause. Off by default and per-session (never inherited from an Agent Config or by a fork). Revoke it with –resume-on-topoff=false. Only a session paused for low balance whose last run was unfinished is resumed; one you paused yourself, or that idled out, stays paused. Default: false |
--secret |
Tenant secret as NAME=VALUE, injected into the manifest’s secret slots (overriding a value declared in the file). Repeatable. NAME=@path reads the value from a file and NAME=- reads it from stdin, so a credential need not appear in shell history or in checked-in YAML. |
--spec, -f |
Path to an agent manifest in YAML or JSON, equivalently given as a positional argument or –file. Defaults to ./agents.yaml when present. Prefer flat format (top-level name + agent), e.g. “name: my-session\nagent: opencode”. Legacy apiVersion/kind/metadata/spec envelopes still work. Set to “-” to read from stdin. ${VAR} references are resolved from the local environment. Mutually exclusive with –harness and –from-config. |
--template |
Sandbox template the session runs on. Either a platform template (sandbox for a bare sandbox, or the template that matches your –harness) or one of your team’s own from ‘doctl harness-runtime template create’ — a team template of the same name takes precedence. Omit it to get the default for the chosen –harness. Passed without –harness it asks for a sandbox with no agent in it. A –spec manifest sets its own top-level template. |
--wait-timeout |
Maximum seconds to wait for the session to become ready (0 uses the default). Ignored with -o json unless –prompt is also set. Default: 300 |
Related Commands
| Command | Description |
|---|---|
| doctl harness-runtime | Managed Agents Runtime Services (M.A.R.S) |
Global Flags
| Option | Description |
|---|---|
--access-token, -t |
API V2 access token |
--api-url, -u |
Override default API endpoint |
--config, -c |
Specify a custom config file Default: |
--context |
Specify a custom authentication context name |
--http-retry-max |
Set maximum number of retries for requests that fail with a 429 or 500-level error
Default: 5 |
--http-retry-wait-max |
Set the minimum number of seconds to wait before retrying a failed request
Default: 30 |
--http-retry-wait-min |
Set the maximum number of seconds to wait before retrying a failed request
Default: 1 |
--interactive |
Enable interactive behavior. Defaults to true if the terminal supports it (default false)
Default: false |
--output, -o |
Desired output format [text|json] Default: text |
--trace |
Show a log of network activity while performing a command Default: false |
--verbose, -v |
Enable verbose output Default: false |