fly 0.5.26, sprites-py 0.7.2, @fly/sprites 0.2.5, the Anchor Python SDK 1.0.1 and the Anchor TypeScript SDK 1.0.0.
What you’re integrating
- The Sprite runs your code. It is an Ubuntu machine with Python, Node.js, Claude Code and Codex already installed.
- Anchor runs the browser. Your code creates a session over the API and drives it with a task or with Playwright over CDP. No browser runs in the Sprite.
- A Sprites Connector holds the Anchor API key. Code in the Sprite calls a gateway URL, and Sprites adds the key outside the Sprite. A leaked environment or a prompt-injected agent has no key to give away.
- A network policy limits what the Sprite can reach. With the policy on this page, the only path to Anchor’s API is the connector.
Before you start
You need an Anchor API key and a Fly.io account. Install the Fly CLI (instructions), version 0.5.20 or later, and sign in:Save your Anchor key as a Connector
Create a custom API connector that points at Anchor’s API and sends the key in theanchor-api-key header. Only Sprites with the label anchor may use it:
jq reads the key from your environment and the request body goes over standard input, so the key does not appear in your shell history. The connector shows up in the dashboard under Connectors:

A connector with no access policy refuses every Sprite. The
sprite_labels rule above is what lets a Sprite in. Running the command again with the same name updates the connector in place, which is how you rotate the key.Create a Sprite and install the SDK
Create a Sprite with theanchor label and make it the default for this folder:

- The Sprite is ready at once. In testing the create call took 0.5 seconds. The Python install took 9 seconds and the Node.js install 4.
- 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. - The install stays. A Sprite keeps its disk when it sleeps, so you install once.
- Run commands through
bash -c. A Sprite has two Pythons. Throughbash,python3is the Sprite’s managed Python 3.13, wherepipinstalled the SDK. Started directly,python3is the system Python 3.14, and the import fails.
Run a web task
The script in the Sprite uses the Anchor SDK as usual, with two environment variables:ANCHORBROWSER_BASE_URL points the SDK at the gateway, and ANCHORBROWSER_API_KEY is a placeholder, because the SDK wants a value. The connector replaces it with the real key.
Each host script below writes the task script into the Sprite and runs it.
python run_task.py or npx tsx run_task.ts. Both print:
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 Sprite. The session is created through the connector. The CDP connection goes straight toconnect.anchorbrowser.io with the session’s own token, so it needs no API key.
fly sprites exec uploads it and runs it in one command:
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 Sprite needs no desktop, tunnel or public URL for it.

Lock the Sprite to Anchor
By default a Sprite can reach any public address. When the code inside is untrusted, set a network policy that allows two hosts only. Install the packages first, because the policy also blocks PyPI and npm.api.anchorbrowser.io is blocked too. The Sprite cannot call Anchor’s API directly, even if someone gave it a key. Its only route is the connector, which you can restrict and revoke.
The code can still browse any site, because the page loads happen in Anchor’s browser, not in the Sprite.
live.anchorbrowser.io is opened by the person watching, so it does not need to be on the list. fly sprites exec and the Sprites SDKs keep working under any policy.
To open the Sprite again, for example to install another package, post an empty rule list and wait before the next request:
Limit what the connector may call
The connector’s access policy can also list the Anchor paths a Sprite may use. This one allows the session and tool endpoints and the MCP server, and nothing else:403 with endpoint is not in allowed list. The * matches the rest of the path, so /v1/sessions/* also covers the /v1/sessions/all/status check in the cleanup section.
Give the coding agents in the Sprite Anchor’s MCP server
Every Sprite has Claude Code and Codex installed. Register Anchor’s hosted MCP server through the connector, and the agent can run web tasks without ever holding the key:/home/sprite/.claude.json holds only the placeholder. This also works in the locked Sprite, because the MCP calls go through api.sprites.dev.
A locked Sprite also blocks the agent’s own model provider. If you run a coding agent inside a locked Sprite, add the hosts that agent needs to the policy. For Claude Code that includes api.anthropic.com. See the MCP server page for the tools Anchor’s server 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 script that runs in the Sprite. A Sprite that goes to sleep or is destroyed does not end a cloud browser; it keeps running and billing until its own timeout. - The Sprite. It sleeps by itself when idle and bills no compute while asleep, so you can keep it. Destroy it with
fly sprites destroy --yes -s anchor-demowhen you no longer need it. - Set Anchor’s
timeout.max_durationandtimeout.idle_timeout, in minutes, as a safety net for a script that stops mid-run. See Session Timeout. - Reuse one Anchor session for a whole agent run instead of creating one per page.
API key
Create and manage Anchor API keys in the Anchor dashboard. To rotate the key, run the connector command again with the new key and the samename.

