# Run agent harnesses in a sandbox
URL: https://docs.munito.ai/harnesses

The `ubuntu` template has Claude Code (`claude`), Codex (`codex`) and OpenCode (`opencode`) installed. In a sandbox, an agent has a Linux computer of its own: it installs packages, runs tests and Docker, and changes files, and none of it reaches your machine.

| Harness                                         | Vendor API key      | Subscription                          | Open models of Munito AI      |
| ----------------------------------------------- | ------------------- | ------------------------------------- | ----------------------------- |
| [Claude Code](https://docs.munito.ai/harnesses/claude-code) | `ANTHROPIC_API_KEY` | Claude Pro or Max, signed in over SSH | Anthropic-compatible endpoint |
| [Codex](https://docs.munito.ai/harnesses/codex)             | `CODEX_API_KEY`     | ChatGPT, signed in over SSH           | Responses API                 |
| [OpenCode](https://docs.munito.ai/harnesses/opencode)       | The provider's key  | GitHub Copilot, OpenCode Zen or Go    | OpenAI-compatible provider    |

## How a harness runs in a sandbox [#how-a-harness-runs-in-a-sandbox]

1. Create a sandbox from `ubuntu`, and put the keys of the harness in `env`. Every command and every [SSH](https://docs.munito.ai/sandboxes#ssh) shell of the sandbox gets that environment.
2. Run one task with a command, or open a shell over SSH and use the harness in its terminal UI.
3. Read the result from the output of the command, or from the files of the sandbox.

```bash
curl -sS --fail-with-body https://api.munito.ai/sandboxes/v1/sandboxes \
  -H "Authorization: Bearer $MUNITO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"template": "ubuntu", "timeout": 3600, "env": {"ANTHROPIC_API_KEY": "sk-ant-..."}}'
```

- Commands and SSH shells run as root. Each page gives the flags that let its harness work without asking for approval, as root.
- A command runs for at most 30 minutes. For a longer task, start the harness in the background with `nohup` and read its log with later commands, or run it in `tmux` over SSH (`apt-get install -y tmux`).
- To keep the work of an agent across pauses, create a [persistent sandbox](https://docs.munito.ai/sandboxes#persistent-sandboxes).

## Keep keys safe [#keep-keys-safe]

- Every program in the sandbox can read its environment, the agent included. Give the sandbox a key that you can revoke, with the smallest permission and spend limit that the task needs.
- To give a key to one command only, put it in the `env` of that command, not of the sandbox.
- Sign in to a subscription inside the sandbox, over SSH. Its sign-in then stays in the sandbox and never passes through the API.
- Delete the sandbox when the task ends, or let its timeout end it.
