DigitalOcean Harness Runtime Quickstartpublic

Last verified 22 Sep 2026

DigitalOcean Harness Runtime combines the functionality of a lightweight microVM, built-in tools like chromium and a coding sandbox needed by agents to do work. The product offers rich lifecycle APIs that persist conversational history and working state across sessions, with pause/resume/fork semantics so that developers can control costs and adapt workflows to the nonlinear quirks of agentic work. See What You Can Build for example use cases.

This quickstart starts a Codex CLI agent on Harness Runtime with one command. doctl harness-runtime launch creates a sandbox, starts the agent inside it, and connects your terminal to the running session, so there is no environment spec to write and nothing to provision first.

Prerequisites

You need:

  • A DigitalOcean account with a payment method on file and a positive prepaid balance.
  • A DigitalOcean personal access token with write access.
  • An OpenAI API key, which Codex CLI uses for model access. To use DigitalOcean Inference instead of a third-party provider, see Create Agents.

Install doctl

Install doctl, the DigitalOcean command line client.

Confirm that your build includes the Harness Runtime commands:

doctl harness-runtime --help

The output lists the session commands, including launch, list, pause, and remove. If doctl reports an unknown command, update to a build that includes Harness Runtime.

Authenticate

Authenticate doctl with your personal access token. Run the following command and paste the token when prompted:

doctl auth init

Start an Agent

Make your OpenAI API key available to doctl:

export OPENAI_API_KEY=<your-openai-api-key>

Start a session and give the agent its first task:

doctl harness-runtime launch \
  --harness codex \
  --prompt "Write fib.py that prints the first 10 Fibonacci numbers, then run it."

launch creates the sandbox, starts Codex CLI inside it, and attaches your terminal, all in one step. The --harness flag builds the session configuration for you, so no environment spec file is involved. If you skip the export above, doctl prompts you for the key instead of failing.

The session takes a few seconds to become ready. The agent then starts on your prompt and streams its work to your terminal.

To start an agent on code you already have, clone a repository into the session workspace with --gh-repo:

doctl harness-runtime launch \
  --harness codex \
  --gh-repo digitalocean/sample-python \
  --prompt "Summarize what this project does and list its Python files."

--harness stops being enough once you want to choose the sandbox size, restrict egress, or write permission rules, all of which live in a YAML environment spec. The examples are complete specs paired with the commands to run them, and each one draws its model from DigitalOcean Serverless Inference rather than a third-party provider. Refactor a Repository is the closest to the session you started above.

Approve the Agent’s Actions

Codex pauses before consequential actions, such as writing a file or running a shell command, and shows an approval request. In a terminal, a single key resolves it without pressing Enter:

  • Y or A approves the oldest pending request.
  • N or R rejects it.
  • D defers it.

To review everything waiting on you, type /pending. For the full list of keys and slash commands, type /help.

Continue the Conversation

Type a follow-up task and press Enter to send it. To compose a multi-line message, press Option+Enter (Alt+Enter on Windows and Linux) to insert a line break, then Enter to send.

Manage the Session

Press Ctrl+D to disconnect your terminal. The session keeps running in the cloud:

Output
✓ Disconnected from session locally
Your session is still active in the cloud.

List your sessions to find the generated session name:

doctl harness-runtime list

Reattach with the same launch command. Passing the name of a session that already exists resumes it and picks up where you left off, rather than creating a new one:

doctl harness-runtime launch <your-session-name>

Delete the session when you are finished:

doctl harness-runtime remove <your-session-name>

Next Steps

  • Run Claude Code or OpenCode instead of Codex CLI, or use DigitalOcean Inference for model access, with Create Agents.
  • Control sandbox size, environment variables, egress, and permissions in a YAML file with the environment spec reference.
  • Save a configuration and start future sessions from it with Use Environment Configs.
  • Give the agent governed access to tools such as GitHub, Slack, and Jira with Connect Action Gateway.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.