Skip to main content
An agent in a sandbox connects to one vault, like any other agent. The sandbox gets its own agent credential and proxy settings, never a key. Your keys stay in the vault, and the gateway adds them to each call on the way out. There are two ways to connect it:

Pick your provider

Each page has a full example in TypeScript and in Python, and the steps from a terminal.

E2B

Sandbox.create with envs and an outbound allow list.

Daytona

daytona.v0.create with the agent’s environment and a domain allow list.

boat

boat.create with env and an allow network policy.

Modal

A sandbox with env and an outbound policy.

Vercel Sandbox

A sandbox with env and a network policy.

Another provider

What a provider needs to work with OneCLI.

How it works

The names here are the TypeScript SDK’s. The Python SDK has the same ones in snake case: agent.allow_hosts, agent.setup_command, and agent.base_url(host).
1

Make an agent for the sandbox

onecli.agents.create makes an agent on one vault. Its answer holds everything the sandbox needs. The agent ends by itself after its lifetime: one hour unless you set another.
2

Start the sandbox with the agent's settings

Give the sandbox agent.env as its environment, and agent.allowHosts as its network allow list. agent.env holds the agent’s credential, so don’t log it.
3

Run the setup line once

Run agent.setupCommand in the sandbox. It writes the certificate files that agent.env points at. Until it has run, HTTPS calls in the sandbox fail with a certificate error.
From then on, HTTPS calls in the sandbox go through the gateway, which adds the vault’s key for each host. When the work is done, stop the sandbox and call agent.disconnect(). The SDK pages for TypeScript and Python have every option: lifetimes, a vault by name, and which clients work through the gateway.

Providers compared

The options are named as in each provider’s TypeScript SDK. Each provider page has the Python names too.
Behind an allow list by host name, Node’s http and https modules, and clients built on them such as axios, fail: they send no host name to the gateway, so the allow list drops their calls. Give those clients agent.baseUrl(host). curl, Node fetch, Python requests, git, npm and pip work through the proxy settings.

Any other provider

A provider works with OneCLI when it can do three things:
  1. Set environment variables for the sandbox, when it starts or for each command. Give it agent.env.
  2. Let the sandbox reach agent.allowHosts. With no allow list, the sandbox reaches them anyway.
  3. Run a shell line in the sandbox, with sh, curl and root certificates installed. Run agent.setupCommand there once.
An allow list by host name often opens only port 443, which is where OneCLI Cloud listens. If your self-hosted OneCLI serves its API or gateway on another port, allow its address by IP range instead. For Docker, a server of your own, or CI, see Docker, servers and CI.

Why OneCLI when a provider injects keys

Each provider above can also add a key to a sandbox’s outgoing calls itself, as the table shows. Like OneCLI, the sandbox then never holds the key. If you use one provider and a few fixed keys, that can be enough. What OneCLI adds:
  • One vault for every place your agents run: any sandbox provider, your laptop, servers and CI. You add a key once, and moving to another provider changes nothing.
  • Permissions per item, and per tool for an app: let a call through, ask a person first, or block it. See Agent access.
  • Rules for the whole organization: block, require approval, or limit the rate. See Rules.
  • A log of every call by every agent, allowed or blocked. See Activity log.
  • App connections: sign in to an app such as GitHub or Google once, and OneCLI renews its tokens. See App connections.
  • An agent per sandbox, with its own credential that ends by itself or when you disconnect it.

From a terminal

Use this to connect one sandbox that is already running, from a terminal where you are signed in. You make a one-use connect token, then run one line inside the sandbox. If your code starts the sandboxes, use your provider’s page instead: the SDK makes an agent with each sandbox, with no token. You need onecli 3.4 or later, signed in with onecli login. See the Quickstart.

Make a connect token

Find the vault the agent should use:
Make a token for that vault. Name the agent so you can tell your agents apart, and set the provider to a short label such as e2b, daytona, boat or vercel:
The token works once, and expires after 15 minutes. --expires-in sets another time, from 1m to 60m. The token is a credential: pass it only to the sandbox it is for, and don’t log or save it. install_command needs only sh and curl in the sandbox. It writes agent.env (mode 0600) and a line in the shell profile that reads it, so a new login shell sends its calls through OneCLI. Run it as the user the agent runs as.

Give your machine access to the sandbox

You run install_command inside the sandbox with the vendor’s own CLI. That needs your vendor account on this machine. Try these in order, and stop at the first one that works.
1

Check whether this machine is signed in

If e2b is missing, install it with npm i -g @e2b/cli.
A list, even an empty one, means this machine is signed in. Go to Run the line in the sandbox.
2

Sign in with your browser

Run the vendor’s sign-in in your own terminal. It opens your browser, and you type no key:
Then run the check from the first step again.
3

If there is no browser sign-in, save a key in a file

Make an API key in the vendor’s dashboard. For E2B, that is e2b.dev/dashboard?tab=keys. Then run this in your own terminal. It asks for the key without showing it, and saves it in a file only you can read:
From then on, start each vendor command with the key read from the file, so the key never shows on screen:
For boat, sign the CLI in with the key once, from the file:
Vercel Sandbox has no key step: sandbox login prints a link you can open on any device.Never put the key in a command as text. Once the agent is connected, you can remove the file, for example rm ~/.onecli/e2b.key.
If a coding agent sets this up for you, it never needs your vendor key. Run the sign-in or the key prompt in your own terminal. If you paste a key into a chat by mistake, delete it at the vendor and make a new one.

Run the line in the sandbox

Pick the running sandbox the agent works in from the list. To start a new one:
Run install_command there, as it is, in place of <install_command>:
For Modal, start the sandbox from your code instead, as in Modal.

Check the agent is connected

Then make the same call twice inside the sandbox, with your provider’s exec command as above. Around OneCLI, it answers 401:
Through OneCLI, it answers 200, because the gateway added the Test key. A login shell reads the proxy settings that connecting wrote:
Start the agent from a login shell too, so its calls go through OneCLI.

When something fails

Next steps