Exploring Docker Sandboxes for Live Web Access
Coding agents inside a Docker Sandbox are deliberately cut off from most of the internet. The sandbox network policy blocks almost everything, which is great for containment but bad when the agent needs to read current documentation or pull the contents of a URL you hand it. The new Docker guide, Give sandboxed agents live web access with Firecrawl, shows a clean answer: compose the Firecrawl v3 mixin onto a sandbox workload so the agent can search, scrape and crawl the web through a single API host, while your API key never enters the sandbox.
This post walks through the guide and explains what each part of the kit does. Every command below was checked against the guide, the sbx CLI reference and Gordon, the docs AI assistant.
What the Firecrawl kit adds to a sandbox
The kit is a v3 mixin published as docker.io/firecrawl/sbx-kit-firecrawl. A mixin does not define a whole agent. It layers extra capabilities onto an existing workload. The Firecrawl mixin contributes four capabilities:
- com.docker.sandbox/lifecycle@1: an install hook that installs a pinned
firecrawl-pyrelease as the agent user. If the install fails, sandbox creation fails, so you never get a half-configured sandbox. - com.docker.sandbox/credential@1: requests the key stored under the
firecrawlservice. The host proxy adds it as anAuthorization: Bearerheader, but only on requests toapi.firecrawl.dev. - com.docker.sandbox/network-policy@1: allows
pypi.organdfiles.pythonhosted.orgduring install, andapi.firecrawl.devat runtime. - com.docker.sandbox/agent-context@1: adds instructions that tell the agent the SDK exists, how to call it, and which sandbox limits apply.
The key detail is the credential model. Inside the sandbox, FIRECRAWL_API_KEY holds the literal placeholder proxy-managed. The SDK sends that placeholder, and the proxy running on your host swaps in the real key on the way out. Requests to any other host never carry the key. Because the install hook uses the workload’s own Python, the kit works with any workload that ships python3 and pip, which Docker’s sandbox workloads do.
Prerequisites
- Docker Sandboxes (the
sbxCLI) installed and signed in, version 0.46 or later. - A global network policy. If you have not set one yet, initialize it with the balanced preset (shown below).
- A Firecrawl API key. Keys start with
fc-.
The balanced policy allows typical development traffic such as AI services and package registries, and it is the preset the CLI reference recommends:
sbx policy init balanced
Local policy initialization is a one-time setup. Use sbx policy reset to start over.
Step 1: Store the Firecrawl key on the host
The kit declares a credential for a service called firecrawl, so that is the name you store the key under:
sbx secret set firecrawl
sbx prompts for the value, so the key does not land in your shell history. Service secrets are global by default, meaning every sandbox can request them. To limit the key to a single sandbox, add --sandbox <name>. Sandbox-scoped secrets take precedence over global ones, and changes take effect in existing local sandboxes without a restart.
The value lives in your OS keychain. You can confirm what is stored, and at what scope, with:
sbx secret ls
Storing the key is only half the story. Third-party kits need an approved credential binding before the proxy will use a stored secret for them. The first time you run the kit interactively, sbx asks you to approve sending the firecrawl credential to api.firecrawl.dev, and it records that approval in ~/.config/sbx/credentials.yaml (or %APPDATA%\sbx\credentials.yaml on Windows). The binding holds the approval, never the key itself.
For CI or --detach runs there is nobody to answer that prompt, and the sandbox starts with the credential withheld. Pre-create the binding instead, either by running the kit interactively once or by writing the entry by hand using the documented bindings format:
bindings:
firecrawl:
apiKey:
domains: [api.firecrawl.dev]
Step 2: Run a workload with the Firecrawl mixin
The guide uses a plain shell workload with no coding agent, which is the fastest way to poke at the SDK directly. From your project directory:
sbx run docker.io/docker/sbx-kit-shell:1.0.0 --name firecrawl-shell \
--kit docker.io/firecrawl/sbx-kit-firecrawl:1.0.0
The first positional argument is an OCI reference to the shell workload. --name gives the sandbox a stable name so you can target it later. --kit adds a mixin and can be repeated to stack several mixins. The CLI reference marks --kit as experimental, so expect it to evolve. Approve the credential request when prompted. sbx pulls both kits, runs the install hook, and drops you into a shell inside the sandbox.
You can attach the same mixin to any other compatible v3 workload, including one that runs a coding agent. There is one important limit. Built-in shortcuts such as sbx run claude use v2 kits, and v2 agents only accept v2 mixins. Firecrawl publishes a separate v2 form of the kit for those agents. Check the kit repository for v2 usage rather than trying to force the v3 mixin onto a built-in agent.
Step 3: Verify the kit from inside the sandbox
Each check below covers a different layer of the kit. Run them in the firecrawl-shell sandbox.
First, confirm the SDK is installed at the pinned version and in the agent user’s site-packages:
python3 -c "import firecrawl, importlib.metadata as m; print(m.version('firecrawl-py'), firecrawl.__file__)"
The guide shows this printing version 4.44.0 and a path under /home/agent/.local/lib/, which proves the install hook ran as the agent user rather than root.
Second, confirm the key inside the sandbox is the placeholder and not your real secret:
echo "$FIRECRAWL_API_KEY"
The documented output is simply proxy-managed. If you see your real fc- key here, something other than the proxy is setting the variable and isolation is broken.
Third, run an end to end scrape. This exercises the SDK, the network rule and credential injection together, and it does consume Firecrawl credits:
python3 - <<'EOF'
from firecrawl import Firecrawl
fc = Firecrawl()
doc = fc.scrape("https://docs.docker.com/ai/sandboxes/", formats=["markdown"])
print(doc.markdown[:300])
EOF
Notice that Firecrawl() is called with no arguments. The SDK picks up the placeholder from the environment, and the proxy turns it into a real Bearer token on the way to api.firecrawl.dev. The output should be the first few hundred characters of the page as Markdown.
Step 4: Let the agent use Firecrawl
Because the kit ships agent context, a coding agent running in a workload with this mixin already knows the SDK is available. The main calls documented in the guide are:
from firecrawl import Firecrawl
fc = Firecrawl() # The proxy adds the API key
fc.scrape("https://example.com", formats=["markdown"]) # One page as Markdown
fc.search("docker sandboxes kits", limit=5) # Web search results
fc.crawl("https://docs.example.com", limit=20) # Pages across a site
Every crawled page costs credits. The guide recommends keeping limit low and preferring a search followed by a targeted scrape when the agent only needs one fact. For structured extraction with a schema and the rest of the API, see the Firecrawl Python SDK documentation.
How the kit interacts with network policy
This is the part that makes the design worth studying. Without organization governance, your default network policy plus the kit-defined rules decide which domains the sandbox can reach. Under organization governance, the organization policy controls which domains can be allowed. Local and kit-defined allow rules become inactive, although deny rules can still narrow access. In other words, an admin can block api.firecrawl.dev and the kit cannot override that.
The second point is subtle. Firecrawl fetches target pages on its own servers. When the agent scrapes docs.docker.com, the sandbox never talks to docs.docker.com. It only talks to api.firecrawl.dev. That is how the agent gets broad web access without you opening the broad web in the sandbox policy. You can see this for yourself from the host:
sbx policy log firecrawl-shell
The log lists allowed requests per sandbox with the host, proxy, matching rule, last seen time and count. After the steps above, you should only see api.firecrawl.dev, files.pythonhosted.org and pypi.org. The scraped site does not appear, because the sandbox never contacted it directly.
Keep in mind that this is a trade-off, not a free pass. Content still flows from arbitrary sites into the agent through Firecrawl, so treat scraped text as untrusted input, the same way you would treat any web page an agent reads.
Local sandboxes vs Cloud Sandboxes
The Firecrawl guide is written for local sandboxes, where sbx runs on your machine and the credential proxy runs on your host. If you also use Docker Cloud Sandboxes, the docs are clear that the two backends keep separate resources:
- Secrets: local sandboxes read from the local
sbx secretstore. Cloud sandboxes read from a separatesbx --cloudsecret store. A key you stored withsbx secret set firecrawlis not available in the cloud. - Network policy: cloud sandboxes use a separate, network-only account and sandbox policy, and local policies are not copied. The account default is set with
sbx --cloud policy init balanced. Unlike local init, cloud init can be run again and keeps existing allow and deny rules. - Listing: a sandbox shown by
sbx lsdoes not appear insbx --cloud ls, and vice versa. - Moves:
sbx movecopies a filesystem snapshot between backends, but it does not carry managed secrets or local network policy. You must configure credentials and rules in the destination.
The cloud account policy can be initialized like this:
sbx --cloud policy init balanced
The guide does not document running the Firecrawl mixin on a cloud sandbox, so validate that path yourself before relying on it.
Troubleshooting tips from the docs
- Unauthorized from Firecrawl: the proxy did not add your key. Check that you stored the secret under the exact service name
firecrawland that you approved the kit’s credential request. - PaymentRequiredError: authentication worked, but the Firecrawl account is out of credits.
- Credential missing in –detach or CI runs: there was no binding, so sbx started the sandbox with the credential withheld. Add the
firecrawlentry tocredentials.yamlor run the kit interactively once. - Install hook failures: sandbox creation fails if the
firecrawl-pyinstall fails. Check that your policy allowspypi.organdfiles.pythonhosted.orgduring install, and that organization governance is not blocking them. - Mixin rejected by a built-in agent: shortcuts like
sbx run claudeare v2 and only accept v2 mixins. Use the v2 form of the kit.
Clean up
Sandboxes persist after you exit. Remove the one from this guide with:
sbx rm firecrawl-shell
Your workspace files are unaffected. To delete the stored key as well:
sbx secret rm firecrawl
Key takeaways
- The Firecrawl v3 mixin gives a sandboxed agent search, scrape and crawl through one allowed host,
api.firecrawl.dev. - The real API key stays on the host. Inside the sandbox
FIRECRAWL_API_KEYis justproxy-managed. - Storing a secret and approving its use are separate steps. Pre-create the binding in
credentials.yamlfor unattended runs. sbx policy logproves the sandbox only talks to Firecrawl and PyPI, not to the sites being scraped.- Built-in agents use v2 kits, so they need the v2 form of the Firecrawl kit.
- Cloud Sandboxes keep separate secret stores and network policies, so local setup does not carry over automatically.
References
Source guide: Give sandboxed agents live web access with Firecrawl. Related docs: Manage credentials, Use kits, Build a tool mixin, Compare local and cloud sandboxes, sbx run reference, sbx secret set reference and sbx policy init reference.