In short.
BoxdSandbox is a capability in the Pydantic AI Harness Python package. It is for developers who want a coding agent's commands and file edits to run in an isolated boxd cloud machine, not on their own computer. It needs boxd credentials. The quick start uses BOXD_API_KEY, but the page also documents BOXD_TOKEN, credentials from the boxd machine it runs in, and a boxd client you supply. Ending a run does not delete its machine. You delete it explicitly with destroy(ref), or your boxd organization's idle-destroy or delete-after defaults may delete it automatically. BoxdSandbox itself sets no delete timer. Technically, it supplies a workspace backend to Pydantic AI. Tools such as Coder, Shell and FileSystem then run each command and file operation in a boxd microVM as a non-root user. The machine's reference can be stored, so your code can reattach to, fork or destroy the machine later. The harness is on 0.x releases, so the API may change. The page does not state a package version, a licence or boxd pricing. This analysis is based on the documentation alone, and nothing was run.
Researched and written by an AI model and checked by a second AI model. How it works
This analysis covers the single documentation page at [https://pydantic.dev/docs/ai/harness/boxd-sandbox/index.md], captured in full on 2026-11-15. Pages it links to were not read: the Shell, FileSystem and Coder guides, the Workspaces and instrumentation pages, the harness version policy, boxd's own site and documentation, and the source repository. No licence file or release notes were captured, so licence, package version and boxd pricing are unknown. Nothing was installed, executed or tested, so every behavioural statement is the documentation's own claim.
The overview
What this resource is
BoxdSandbox is a capability in the Pydantic AI Harness Python package (the page's install command is pip install "pydantic-ai-harness[coder,boxd,anthropic]"). It gives a Pydantic AI agent an isolated machine hosted by boxd [https://boxd.sh/] as its workspace. The page describes it as running your agent's commands and file edits in a boxd cloud machine instead of on your machine.
In the page's API reference, BoxdSandbox is a subclass of AbstractCapability. It supplies the workspace only. You combine it with capabilities that use a workspace, such as Coder, Shell and FileSystem. The related class BoxdSandboxBackend is a WorkspaceBackend that supports commands, filesystem operations and realpath. The page links its source to the pydantic/pydantic-ai repository under src/pydantic_ai_harness/pydantic_ai_harness/boxd_sandbox/. That source was not read for this analysis.
Overall assessment
On the documentation alone, this is a well-specified, narrowly scoped integration. It covers the lifecycle of a remote machine in detail: creation, reattachment, forking, cleanup, timeouts, output limits, rate limits and the security boundary. The page is open about its own limits. It notes the 0.x API-change policy and asyncio-only support. It also says that ending a run does not delete the machine. BoxdSandbox sets no delete timer, so the machine stays until you call destroy(ref) or your boxd organization's idle-destroy or delete-after defaults remove it.
It looks like a fit if you already use or plan to use Pydantic AI and boxd, and you want agent-run code kept off your own machine. This page documents Pydantic AI integration only; compatibility with other frameworks is unknown. The page gives no evidence about how it performs or how reliable it is. No benchmarks, test results, pricing or licence appear on this page, and nothing was run for this analysis.
Who it is for
The page assumes Python developers who build agents with Pydantic AI and want agent-run code to execute remotely. Typical cases from the examples are a coding agent that clones a repository and works on it, several agents trying different approaches from the same starting point, and agents running inside durable workflows on Temporal.
Beginners should note that you need a boxd account, an API key and a model provider key before the first example works. You also need to be comfortable with Python async code, because the fork, destroy and cleanup examples use asyncio. The page does not say whether boxd has a free tier or trial.
What it can do
Per the page, it can: create an isolated boxd machine on first use; run shell commands there under sh -c as the non-root boxd user, who has passwordless sudo; read and write files through boxd's file API; and keep the machine between runs so a follow-up run can reuse its files. The follow-up can find the machine through the message history or through a stored reference (a WorkspaceRef) passed as workspace=. Passing workspace='new' forces a fresh machine.
It can also fork a machine, copying its disk, memory and running processes into a new isolated machine so that two agents can work independently from the same state. It can destroy machines by reference, build a lazy backend for an existing machine, and expose the underlying boxd.Machine record through get_sandbox() for boxd features it does not wrap, such as snapshots, checkpoints and public URLs.
Configuration covers: an optional shared boxd client; the organization; a starting snapshot; machine size of 1, 2, 4 or 8 vCPUs with 4 GiB of memory each; an auto-suspend timeout; a working directory; and environment variables for every command. You can write your own tool that calls ctx.workspace.run(...), as the page's run_python example shows. The page also shows a Temporal durable-execution setup and says Coder, Shell and FileSystem work under DBOS, Temporal and Prefect.
Using it
What you need
From the page: Python with the pydantic-ai-harness package and the boxd extra. The examples also use the coder and anthropic extras, and the page says to swap the anthropic extra for your model provider's. A BOXD_API_KEY is created with boxd auth keys create, and each key belongs to one boxd organization. The examples also need ANTHROPIC_API_KEY. The backend can read BOXD_TOKEN, else BOXD_API_KEY, else the boxd machine it runs in. The design implies network access to boxd.
The backend works only on the asyncio event loop; under Trio it raises UserError. The Temporal example needs a Temporal dev server on localhost:7233 and the temporalio package, which the page does not list in the install command. The page does not state minimum Python or Pydantic AI versions, and the package version is not stated.
How it works
BoxdSandbox implements get_workspace, which builds a backend for the run and does no network I/O at that point. The first workspace operation creates a machine named pydantic-ai- followed by hex digits, or attaches to the machine named by a reference. Attaching wakes or starts a suspended or stopped machine. Commands run inside a boxd microVM. Output streams while the command runs and is returned when it exits. File operations use boxd's file API as the same boxd user, so Unix permissions apply. On a machine whose boxd agent predates that API, such as one from an older snapshot, file operations fall back to shell commands until the machine reboots.
The machine's reference holds no credentials. It is saved in the message history and on the run result (result.workspace.ref). A later run can use it to reattach. If the machine has been deleted, the run raises WorkspaceUnavailableError instead of silently starting an empty one.
Timeouts: a command timeout starts after the machine is ready. A timeout or cancelled run stops the command and its process group, and the machine keeps running. WorkspaceTimeoutError carries the output printed so far. Even with timeout=None, boxd ends a command that prints nothing for 30 minutes. A command whose combined output passes 10 MiB is stopped and raises WorkspaceOutputLimitError, with the first 64 KiB of each stream attached. run() returns when the command exits, even if a background child is still running.
Setup steps
The page's order is: install with pip or uv using the extras shown; create an API key with boxd auth keys create; set BOXD_API_KEY and your model provider key; then add BoxdSandbox() and Coder() to an Agent's capabilities list. With Coder, RepoContext creates the machine when the run starts, even without a tool call. Coder(repo_context=False) makes creation lazy.
Optional steps: set working_dir (created on a new machine; it must already exist on an attached one); build a snapshot with the project's dependencies using boxd snapshots save and pass snapshot='name'; choose vcpu (it cannot be combined with a snapshot); and pass one shared boxd.AsyncBoxd client with client=, which you are responsible for closing. By default, each run opens a boxd client from the environment and closes it when the run ends. A BoxdSandboxBackend you build yourself opens its own client on first use and keeps it until you call aclose(); a later operation then opens a new one. The durable-execution section is where the page tells you to pass one client=. There, it says that without one, every workspace operation opens a new client that logs in to boxd again, and boxd allows 30 logins a minute from one IP address, so a busy worker fails with RateLimitError. With one client, every activity on the worker's event loop shares its session token.
Worked example from the page
The quick start builds Agent('anthropic:claude-opus-5-5', capabilities=[BoxdSandbox(), Coder()]) and calls run_sync with a prompt asking the agent to clone the Pydantic AI repository [https://github.com/pydantic/pydantic-ai] and summarize how capabilities work. Coder's shell and file tools then run in the boxd machine. A second call with message_history=result.all_messages() continues in the same machine, so the clone is still there.
The fork example runs a setup prompt, takes setup.workspace.ref, calls sandbox.fork(ref), and runs two agents in parallel with asyncio.gather. One speeds up the slowest test by caching, and the other by mocking network calls. Finally it destroys both machines. These examples come from the documentation. They were not run or checked for this analysis, and the model name appears exactly as written there.
Assessment & evidence
Limitations and risks
Stability: the page says that while Pydantic AI Harness is on 0.x releases the API may change between minor releases, with deprecation warnings and release-note migration guidance. Pin your versions.
Cleanup: Pydantic AI never stops or deletes the machine. A run that ends before its reference is stored leaves a machine behind. A failed run returns no result, so you need an on_run_error hook to delete its machine. Treat stored references as sensitive: a reference can name any isolated machine your credentials can see, so the page says to keep them server-side.
Isolation is not network lockdown. The page says code in the machine can reach the internet. Like every boxd machine, it also has a public HTTPS address that serves the port its code listens on. Exposure through that address comes from a service listening on that port; commands and files are not automatically published merely by running or storing them. The agent user has passwordless sudo inside the machine. The page does not describe or evaluate protection against the agent leaking data it has fetched or sent out, or against prompt-injection attacks. Host environment variables are not forwarded automatically; the page says nothing from your machine's environment reaches the machine. Values you supply explicitly through env do reach every command. The machine holds no boxd credentials. BoxdSandbox refuses to attach to or fork machines that are not isolated or are on a named boxd network. A machine made from a snapshot keeps the networks of the machine the snapshot came from, so snapshots should be saved from a machine on no network.
Other limits: asyncio only; a 10 MiB output cap per command; a 30-minute silence limit; background-child output is not returned after run() returns; and a snapshot that is unknown or still saving fails on first use. Reliability, latency, startup time and behaviour at scale are not described, and no tests were run.
Why this assessment
The assessment rests on the documentation's concrete statements: explicit defaults, error types, size limits, cleanup behaviour and security rules. These make the behaviour specific enough to describe without guessing. The documentation is also candid about its drawbacks (0.x instability, leftover machines, public HTTPS address, rate limits), which makes it more credible than a marketing description.
Confidence is limited by the evidence type. This is one first-party documentation page. It is not an independent test, review or user report. The behaviour described, such as isolation guarantees, fork semantics and timeouts, is the documentation's claim and has not been confirmed by running the code. The page gives no performance, pricing, uptime or adoption data.
Alternatives
The page names no competing products and makes no comparison. What it does show is the documented relationship: BoxdSandbox is a capability that supplies the run's workspace through BoxdSandboxBackend, and BoxdSandboxBackend is the class that implements Pydantic AI's WorkspaceBackend. Without the sandbox, tools such as Coder run commands and file edits on your own machine, and the page's introduction frames the sandbox as the alternative to that. The page also points to Shell and FileSystem as narrower options than Coder, and to a Workspaces concept page, which was not read.
If you do not want to depend on boxd, other workspace backends or other sandbox services may exist. This page does not list or evaluate them, so any comparison needs separate research.
Evidence base
The only evidence is the captured documentation page at [https://pydantic.dev/docs/ai/harness/boxd-sandbox/index.md] (about 30 KB). It includes the overview, install and quick-start code, usage sections, the security model, a configuration table, the durable-execution example, telemetry notes and the API reference for BoxdSandbox and BoxdSandboxBackend. It also contains a diagram description of the flow between the model, tools, the get_workspace hook and the boxd API.
Linked material was not reviewed. That includes the source code, release notes, licence file, the Shell, FileSystem, Coder, Workspaces and instrumentation pages, the harness version policy, and boxd's own documentation. Nothing was installed or run, so there is no execution evidence, and every behavioural statement here is the documentation's own claim.
Access & freshness
Costs
The page states no prices for BoxdSandbox, boxd machines or snapshots, so the cost of boxd is unknown from this evidence. It does say machines keep running until boxd suspends them for idleness, and keep their disk until deleted. Running or stored machines may therefore accrue boxd charges, but the page does not say how or how much. The examples also use an Anthropic model. Model-provider pricing and any associated charges are also unknown from this page.
The cost-relevant controls the page documents are: auto_suspend_timeout (seconds of network inactivity before suspend, 0 disables it); vcpu sizing; destroy(ref); and boxd's organization defaults for suspend, hibernate, idle-destroy and delete-after timers. BoxdSandbox sets no delete timer, so a machine is deleted automatically only if your organization's defaults say so. Machines left behind by a crash, Ctrl-C or killed worker are possible and have to be found with boxd list.
Rights and licence
The selected page does not state a licence or usage terms for the pydantic-ai-harness package, the documentation text, or the boxd service. Package licensing, documentation licensing and boxd service terms are all unknown from this evidence. Check the source repository linked on the page, and boxd's own terms of service, before commercial or redistributed use. The documentation page was captured, but permission to redistribute it is not established by this evidence.
Freshness
The page was captured on 2026-11-15. It shows no publication date, last-updated date, package version number or changelog entry, so how current it is relative to the code is unknown. It refers to the Pydantic AI Harness 0.x series and a version policy, and warns that APIs may change between minor releases. It uses the model identifier anthropic:claude-opus-5-5 in its examples. Model names and the boxd CLI and API may change, so check the current documentation and your installed package version before relying on the details.
Suggested next steps
If you want to try it: confirm boxd pricing and terms and the package licence first; create a boxd API key; install the package with the boxd extra and your model provider's extra; and start with the quick start in a throwaway project. Set auto_suspend_timeout and a working_dir deliberately.
Before using it for real work: store each run's workspace reference server-side; add an on_run_error hook that destroys failed runs' machines; set a routine to find leftover pydantic-ai-named machines with boxd list; share one boxd client if you run many operations; and pin the harness version because of 0.x changes. Assume code the agent runs can reach the internet. Remember that any service it starts listening on the machine's port is reachable through the machine's public HTTPS address, although running commands or storing files does not by itself publish them. Host environment variables are not forwarded automatically, but values you pass through env reach every command, so supply only what the agent needs.
