---
title: DigitalOcean Harness Runtime Quickstart (public)
description: Start a Codex CLI agent in an isolated DigitalOcean sandbox with a single doctl command.
product: Managed Agents
url: https://docs.digitalocean.com/products/managed-agents/agent-harness-runtime/quickstart/
last_updated: "2026-09-22"
---

> **For AI agents:** The documentation index is at [https://docs.digitalocean.com/llms.txt](https://docs.digitalocean.com/llms.txt). Markdown versions of pages use the same URL with `index.html.md` in place of the HTML page (for example, append `index.html.md` to the directory path instead of opening the HTML document).

# DigitalOcean Harness Runtime Quickstart (public)

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](https://docs.digitalocean.com/products/managed-agents/agent-harness-runtime/details/what-you-can-build/index.html.md) 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](https://docs.digitalocean.com/products/managed-agents/agent-harness-runtime/how-to/manage-ahr-prepayment/index.html.md).
- A DigitalOcean [personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) 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](https://docs.digitalocean.com/products/managed-agents/agent-harness-runtime/how-to/create-managed-agent/index.html.md).

## Install doctl

Install [`doctl`](https://docs.digitalocean.com/reference/doctl/how-to/install/index.html.md), the DigitalOcean command line client.

Confirm that your build includes the Harness Runtime commands:

```shell
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:

```shell
doctl auth init
```

## Start an Agent

Make your OpenAI API key available to `doctl`:

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

Start a session and give the agent its first task:

```shell
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`:

```shell
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](https://docs.digitalocean.com/products/managed-agents/agent-harness-runtime/examples/index.html.md) 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](https://docs.digitalocean.com/products/managed-agents/agent-harness-runtime/examples/refactor-a-repository/index.html.md) 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:

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

List your sessions to find the generated session name:

```shell
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:

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

Delete the session when you are finished:

```shell
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](https://docs.digitalocean.com/products/managed-agents/agent-harness-runtime/how-to/create-managed-agent/index.html.md).
- Control sandbox size, environment variables, egress, and permissions in a YAML file with the [environment spec reference](https://docs.digitalocean.com/products/managed-agents/agent-harness-runtime/reference/environment-spec/index.html.md).
- Save a configuration and start future sessions from it with [Use Environment Configs](https://docs.digitalocean.com/products/managed-agents/agent-harness-runtime/how-to/use-agent-configs/index.html.md).
- Give the agent governed access to tools such as GitHub, Slack, and Jira with [Connect Action Gateway](https://docs.digitalocean.com/products/managed-agents/agent-harness-runtime/how-to/connect-action-gateway/index.html.md).