Run AI agents
AgentBox lets you run AI agents in isolated, lightweight sandboxes and configure the agent, its environment, files, and network access to suit your tasks.
Why run an agent in a sandbox
An agent chooses its own commands and can make mistakes. A sandbox gives it a workspace with separate files, processes, and resources.
- Isolation. Commands run in a separate microVM. Your computer's and application's files are not automatically available. Access to external systems depends on supplied credentials and network rules.
- Full environment. The agent can use a terminal, filesystem, Git, and package managers to install dependencies and run programs.
- Ready-made templates. Popular agent templates include the CLI. Choose a template, supply a model key, and send a task.
- Parallel tasks. Create separate sandboxes for different tasks, each with its own credentials, files, processes, and agent session.
Choose a ready-made template
Public templates already include popular agents. Pass the short name to Sandbox.create or the Go SDK's Template field. You do not need to install the CLI or build a template yourself.
| Agent | Template name |
|---|---|
| Codex | codex |
| Claude Code | claude |
| OpenCode | opencode |
| Pi | pi |
| Hermes | hermes |
| Grok | grok |
| Qwen Code | qwen |
| Kimi Code | kimi |
Templates include the agent CLI and the base Linux toolkit. Supply model credentials using the method described in the selected agent’s guide. A template does not include a provider subscription or balance. Pin a template version when you need a reproducible environment.
Connect to the model provider
If a provider API is unavailable from the sandbox's region, use the ready-made AgentBox proxy, or run your own and supply its URL as shown in the examples. AgentBox provides two endpoints:
- HTTPS:
https://sandbox-proxy.agentbox.ru:65181. - SOCKS5:
socks5h://sandbox-proxy.agentbox.ru:65180.
You still need the provider's credentials and access to the selected model. Proxy configuration depends on the agent:
- Codex uses SOCKS5 through
ALL_PROXY. Thesocks5hscheme makes the proxy resolve destination hostnames. - OpenCode, Claude Code, and Pi use the HTTPS proxy through
HTTPS_PROXYandHTTP_PROXY.
These are process-wide network settings. Other requests from the agent and its tools may also use the proxy if they honor these variables. NO_PROXY keeps connections to localhost and 127.0.0.1 direct. Pass the settings into the sandbox. Your application's AgentBox API addresses stay the same.
Agent call lifecycle
- Create a sandbox for the task.
- Supply credentials using the method in the selected agent’s guide, upload input files through the filesystem SDK, and start the agent through the commands API.
- Receive process output and agent events. Wait for the call to complete.
- Read the output files through the SDK before stopping the sandbox.
- If the work is finished, kill the sandbox in
finally. For another request in the same session, leave it running or pause it.
Store the sandbox ID together with the agent session ID when continuing a conversation. The history and input files live inside that sandbox. A session ID alone does not transfer them to a new machine.
Agent access
The agent can access files and keys you provide. Supply only the data and credentials needed for the specific task.
Use network rules to restrict outbound connections. The agent still needs access to the model API or the proxy used to reach it.
The examples run agents with their default toolsets and without action approval prompts. They can work with files, run commands, and access the network. AgentBox provides isolation from other machines.