Skip to main content
Your code starts a boat sandbox and makes a OneCLI agent for it, on one vault. The sandbox can reach only OneCLI. Its HTTPS calls go through the gateway, which adds the vault’s key on the way out, so no key is ever in the sandbox.

Before you start

  • A OneCLI managing key in ONECLI_API_KEY. Make one in the dashboard under Settings > API keys. It stays with your code: never put it in the sandbox.
  • A boat API key in BOAT_API_KEY, with the actions the example uses. Make one with boat api-key create my-app --actions sandbox.create,sandbox.read,sandbox.stop,sandbox.delete-own,exec,network.write: it prints the key once. A key made with --preset ci cannot set a network policy, so boat refuses the example with 403.
  • Node.js 22 or later, or Python 3.11 or later.
  • The example uses your Personal vault and its Test key for httpbin.org, which every account starts with. Use any vault, and any host it has an item for.

Install

Example

Save the TypeScript as sandbox.mts and run npx tsx sandbox.mts, or the Python as sandbox.py and run python sandbox.py. It prints 200.

What goes where

The Sandboxes overview explains each value.

Good to know

  • noEnv: true (no_env=True in Python) gives the sandbox none of the secrets stored in your boat account: no environment variables, secret files or credentials. The agent’s settings come only from env.
  • The allow list. A domain entry in boat’s allow list opens port 443, matched by the host name the client sends, and port 80. OneCLI’s hosts use 443.
  • Lifetime. boat’s ttlSeconds (ttl_seconds in Python) is how long the sandbox runs before boat stops it. Keep the agent’s lifetime at least as long.
  • Long commands. execCommand waits 30 seconds by default. Pass a longer timeoutSeconds (its fifth argument), or timeout_seconds= to exec_command in Python, for longer work.
  • Type checkers. Pyright reports ttl_seconds and no_env as unknown parameters, because boat’s Python models declare the API’s names, ttlSeconds and noEnv. Both names work when the code runs.
  • Node clients. Behind an allow list, Node’s http and https modules and axios fail, because they send no host name to the gateway. Give them agent.baseUrl(host) instead, or agent.base_url(host) in Python. See the SDK reference for TypeScript or Python.
  • boat’s own key injection. boat can also keep model keys out of a sandbox itself, with its AI credentials proxy. See how OneCLI compares.

From a terminal

To connect one boat sandbox that is already running, make a connect token as in From a terminal, then run its install_command in the sandbox, as it is, in place of <install_command>:

Versions

Written in December 2026 for @onecli-sh/sdk 4.1 and @boatdev/sdk 1.15 in TypeScript, and for onecli-sdk 0.1 and boat-sdk 1.15 in Python. The sandbox support of both OneCLI SDKs was run end to end in boat sandboxes, with the network allowed only to the agent’s allowed hosts.

Next steps