boat-sdk and @boatdev/sdk), the Anchor Python SDK 1.0.1 and the Anchor TypeScript SDK 1.0.0.
What you’re integrating
Anchor SDK in a Boat sandbox → Anchor Cloud. The sandbox runs your agent and its code. Chromium runs as a managed Anchor cloud session, reached over HTTPS and CDP.- Boat stays the code runtime: the agent edits files, installs packages and runs commands there.
- Anchor stays the remote browser: stealth, proxies, live view and session lifecycle.
- The sandbox can be locked so its only way out is Anchor.
Before you start
Sign up at boat.dev and create an API key in the dashboard. Keep it in your shell:await, so set "type": "module" in your package.json.
Store your Anchor key in Boat
Create an Anchor key at API Keys. Save it as a variable of your default Boat environment, so every new sandbox starts with it and it never sits in your code. With the key inANCHORBROWSER_API_KEY in your shell:
ANCHORBROWSER_API_KEY: the Anchor Python SDK reads it on its own, and the TypeScript samples pass it to the SDK.
Run a web task from the sandbox
Describe the goal in plain English and let Anchor’s agent drive the browser. The script creates a sandbox, installs the Anchor SDK, runs the task and deletes the sandbox.- The sandbox is ready in seconds. In testing a
smallsandbox was ready 2.6 seconds after the create call, and the Python script ran end to end in 33 seconds, install included. - The install is small.
playwright(Python) andplaywright-core(Node.js) are only the client library that speaks CDP. You do not runplaywright install, because the browser lives on Anchor. Python needs a virtual environment: Ubuntu’s systempiprefuses to install packages outside one. - Paths are relative to
/home/user.write_textandexec_commandboth start there. The TypeScript version runs in theanchorfolder, wherenpminstalled the packages. - The session is created first. The task runs on a session the script created, so
finallycan always end it, also when the task fails.
Drive the browser yourself with Playwright
For step-by-step control, create an Anchor session and connect Playwright to it over CDP from inside the sandbox.Watch the browser
Open thelive view URL in your own browser while the script runs, or open the session in the Anchor dashboard. This is the Anchor session streaming directly, so the sandbox needs no desktop, tunnel or public port for it.


anchor-env as a process using about 109 MB. No browser runs in the sandbox for this work, because the browser is on Anchor.

Lock the sandbox to Anchor
By default a Boat sandbox can reach any public address. When the code inside is untrusted, limit it to the two hosts the Anchor SDK needs with a Boat network policy. Install the packages first, then set the policy and wait until Boat reports it as enforced:live.anchorbrowser.io is opened by the person watching, not by the sandbox, so it does not need to be on the list. Boat’s own exec and file calls keep working under any policy.
Give the coding agents in the sandbox Anchor’s MCP server
Every Boat sandbox has Claude Code, Codex and other coding agents installed. Register Anchor’s hosted MCP server once and the agent can run web tasks by itself:exec_command. claude mcp list then shows Anchor next to the computer server Boat registers itself:
api.anthropic.com is blocked, so Claude Code cannot reach its model. If you run a coding agent inside a locked sandbox, add the hosts that agent needs to allow. For Claude Code that includes api.anthropic.com: with it on the list, the sandbox reaches it and example.org stays blocked.
The registration is stored in /home/user/.claude.json, with the key in it. See the MCP server page for the tools it offers.
Clean up two lifecycles
There are two things to end, and ending one does not end the other.- The Anchor session. End it in a
finallyblock inside the sandbox script. Deleting the sandbox does not end a cloud browser; it keeps running and billing until its own timeout. - The Boat sandbox. Delete it in a
finallyblock.ttl_seconds(Python) orttlSeconds(TypeScript) stops the sandbox if your script dies before that. - Set Anchor’s
timeout.max_durationandtimeout.idle_timeout, in minutes, as a safety net for a sandbox that dies mid-run. See Session Timeout. - Reuse one Anchor session for a whole agent run instead of creating one per page.
small sandbox for 8 to 20 seconds. Boat reported $0.0001 to $0.0002 per run.
API key
Each customer brings their own Anchor key as a variable of their Boat environment. Anchor bills them directly for browser usage; Boat bills for the sandbox.Troubleshooting
402 billing_requiredwhen you create a sandbox: the Boat account has no plan yet. Start one in the Boat dashboard under Billing.401from Anchor inside the sandbox: the variable is missing or has another name. Check that your default environment holdsANCHORBROWSER_API_KEY.error: externally-managed-environmentfrompip: Ubuntu’s system Python refuses installs outside a virtual environment. Create one withpython3 -m venv anchor-env, as the samples do.403 trial_saved_snapshots_not_allowed: Boat’s free trial cannot save a sandbox as a saved snapshot, so the samples install the SDK at the start of each run. The install takes about 14 seconds.400 trial_auto_stop_required: during Boat’s free trial a sandbox needs an auto-stop of at most 2 hours. Passttl_secondsof 7200 or less.- A request fails right after you set a network policy: the policy can report
pendingfor a moment. Wait until its status isenforced, as the sample does. - The command stops after 30 seconds: that is Boat’s default command timeout. Pass
timeout_seconds(up to 600), as the samples do. A web task can take a few minutes.

