# Run Cloud Agents in a sandbox
URL: https://docs.munito.ai/sandboxes/cloud-agents

The `ubuntu` template has Claude Code, Codex and OpenCode installed.

| Agent                                                        | API key                 | Subscription                                | Open models of Munito AI |
| ------------------------------------------------------------ | ----------------------- | ------------------------------------------- | ------------------------ |
| [Claude Code](https://docs.munito.ai/sandboxes/cloud-agents/claude-code) | `ANTHROPIC_API_KEY`     | Claude Pro or Max                           | Anthropic-compatible API |
| [Codex](https://docs.munito.ai/sandboxes/cloud-agents/codex)             | `CODEX_API_KEY`         | ChatGPT                                     | Responses API            |
| [OpenCode](https://docs.munito.ai/sandboxes/cloud-agents/opencode)       | The key of the provider | GitHub Copilot, OpenCode Zen or OpenCode Go | OpenAI-compatible API    |

## Run an agent [#run-an-agent]

1. Create a sandbox from the `ubuntu` template. Put the keys of the agent in `env`.
2. Run the agent with a command, or connect over [SSH](https://docs.munito.ai/sandboxes/ports-and-ssh#ssh) and use its terminal UI.
3. Read the result in the output of the command, or in 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-..."}}'
```

Each command and each SSH shell of the sandbox gets the variables in `env`.

## Limits [#limits]

- Commands and SSH shells run as root.
- A command runs for 30 minutes or less. For a longer task, use `nohup` or `tmux`.
- A [persistent sandbox](https://docs.munito.ai/sandboxes/persistence#pause-and-resume) keeps its files and sign-ins when it pauses.

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

Each program in the sandbox can read its environment, and the agent can too. Thus:

- Use a key that you can revoke, with the smallest permissions and spend limit that the task needs.
- To give a key to one command only, put the key in the `env` of that command.
- Sign in to a subscription in the sandbox, over SSH. Then the sign-in does not go through the API.
- Delete the sandbox when the task is complete.
