In short.
Sprites Sandbox is a setup and reference guide for Python agent developers who need files and installed tools to persist remotely, but the workspace survives completed and failed runs until explicitly deleted. It documents reusable workspace references, tool composition, client ownership and durable execution. Important constraints include asyncio-only support, best-effort command termination and Unix permissions that do not restrict the agent's file access. Exact prices, performance and isolation strength are not assessed.
Researched and written by an AI model and checked by a second AI model. How it works
Coverage includes the complete selected page at [https://pydantic.dev/docs/ai/harness/sprites-sandbox/index.md], including installation, examples, configuration, lifecycle, durable execution, telemetry and API reference. The 0.x API-change notice and billing, permission, timeout and cleanup caveats are included. Linked pages, source code, provider pricing and legal terms are excluded. No code was executed; runtime correctness, performance and isolation strength are not assessed.
The overview
identity
The resource is the Sprites Sandbox documentation page for Pydantic AI Harness. It describes SpritesSandbox, a capability that supplies an agent workspace backed by a persistent Fly.io Sprite. Coder, Shell, FileSystem and custom tools can use that workspace for commands and file operations. Original page: [https://pydantic.dev/docs/ai/harness/sprites-sandbox/index.md].
The page includes installation instructions, examples, lifecycle guidance, configuration, durable execution, telemetry and an API reference. It also links the implementation at [https://github.com/pydantic/pydantic-ai/tree/main/src/pydantic_ai_harness/pydantic_ai_harness/sprites_sandbox/]; that repository's contents are outside the supplied evidence.
assessment
The documented design fits agents that revisit a repository or project across multiple runs: files and installed packages remain available when the application reconnects to the same Sprite. Its practical tradeoff is lifecycle management. The application must retain workspace references, handle failed runs and delete workspaces when finished.
Suitability depends on accepting the documented permission and process-control limits. Runtime correctness, reliability, latency, throughput and isolation strength are not assessed, and the page supplies no comparative benchmarks.
users
The guide is most useful to Python developers building coding or repository-analysis agents with Pydantic AI. Beginners receive installation and continuation examples, but implementing them requires managing API credentials, Python dependencies and remote workspace cleanup.
More experienced developers get guidance on custom workspace tools, caller-owned clients and backends, failure hooks, and durable workflows. A Temporal example is included; the page also states that Coder, Shell and FileSystem work under DBOS and Prefect, while leaving engine-specific limits to linked guides.
capabilities
Documented capabilities include remote command execution and file operations, persistent files and installed packages, configurable working directories and command environments, and reconnection through message history or a WorkspaceRef. Applications can prepare files through Workspace before an agent starts and access the native sprites.AsyncSprite through get_sandbox().
SpritesSandbox supplies the workspace; tool capabilities provide the actions available to the model. The page demonstrates both Coder and the narrower Shell plus FileSystem combination, along with a custom Python-execution tool using ctx.workspace.
Core instrumentation can record the workspace provider and id on agent spans. Sprite creation also logs its name at INFO, which can help locate a workspace that survives its run. SpritesSandbox emits no spans of its own.
Using it
requirements
The integration requires the pydantic-ai-harness package with Sprites support and a Sprites API token supplied through SPRITE_TOKEN. The examples additionally use Coder and Anthropic support, with ANTHROPIC_API_KEY. Another model provider requires its corresponding package extra and credentials. Minimum Python and dependency versions are not stated.
The backend requires an asyncio event loop; under Trio it raises UserError. The page says new Sprites include git, Python and Node.js, but lack pytest and ripgrep. Project dependencies must be installed separately and then persist in that Sprite.
The local machine's environment is not automatically copied into the Sprite. Additional command environment variables must be supplied explicitly through the documented env settings.
mechanism
An agent's tools use ctx.workspace, which SpritesSandbox connects to a Sprite through the Sprites API. Creation normally occurs on first use, although Coder's default RepoContext creates the workspace when the run starts. Coder(repo_context=False) enables lazy creation.
A later run can recover the same workspace from message history or receive result.workspace.ref through workspace=. The reference contains no credentials, so reconnection still needs SPRITE_TOKEN. Without a reference, a run creates a fresh Sprite; workspace='new' explicitly requests one. A reference to a deleted Sprite raises WorkspaceUnavailableError rather than silently creating a replacement.
File authority metadata defaults to 'operator'. The page describes 'none' for third-party files and 'user' for user-owned files. path_authority overrides this by path, with the longest match winning. Capabilities that check authority use it when presenting file text to the model; this is distinct from filesystem access restrictions.
setup
The documented installation command is pip install "pydantic-ai-harness[coder,sprites,anthropic]"; uv add accepts the same package specification. The coder and anthropic extras support the examples and can be adjusted to match the chosen tools and provider. After configuring credentials, construct an Agent with SpritesSandbox() and the desired tool capabilities.
Set working_dir to choose where commands start and relative paths resolve. A newly created Sprite gets that directory created automatically; an attached or caller-supplied Sprite must already contain it, otherwise commands fail with WorkspaceError. runtime affects only new Sprites, while working_dir and env also apply after reconnection.
When constructing a backend directly, close its internally created client with aclose(). This leaves the Sprite intact. Caller-supplied clients and Sprite handles remain caller-owned, and workspace deletion requires a separate destroy(ref) call.
example
The main example combines SpritesSandbox() with Coder() and asks an agent to clone the Pydantic AI repository and summarize its capability system. A follow-up passes message_history=result.all_messages(), allowing the documented workflow to continue with the existing clone.
A second continuation pattern stores result.workspace.ref and supplies it as workspace=ref in a later run. This is useful when an application retains workspace identity separately from conversation history. These are documentation examples; successful execution and generated answers are not established by the supplied evidence.
Assessment & evidence
limitations
Commands run as the non-root sprite user, but the page explicitly says Unix permissions do not restrict that user: even a file with mode 000 remains readable. File writes follow symlinks to their targets and create missing parent directories. File reads reject FIFOs. These behaviours matter when deciding which paths tools may access.
A command deadline starts after the Sprite is ready and the exec connection opens; each connection attempt has a separate ten-second limit. On timeout, the backend closes the connection and requests stopping after one second, but process-group termination is best effort. The Sprite remains. timeout=None removes the command deadline without removing idle pauses or transport limits.
Sprites pause processes between commands unless they run as Sprites services. Background children that inherit stdout or stderr can keep run() waiting until their output streams close. The guide recommends redirecting long-running background output; Shell.start_command manages an output log.
A connection loss after execution starts can leave command completion uncertain. The backend raises a non-retryable error instead of replaying a command that may have side effects. Pre-execution handshake failures receive three retries over about five seconds. A post-command existence check can detect deletion, but if that check fails or exhausts its timeout, the command result is returned.
reasoning
A stored workspace reference lets project files outlive an individual conversation or worker run. This makes the design relevant to multi-step development work that needs the same checkout and installed dependencies later. Any reduction in repeated setup time is a plausible benefit of persistence, but it is not measured on this page.
The same persistence creates operational responsibility. Failed runs return no result from which to save a reference, so the guide provides an on_run_error cleanup hook and a creation log for recovery. after_run does not cover failures. Closing a backend and deleting its workspace are separate operations.
Durable orchestration also needs deployment care: the page warns that removing capabilities while workflows remain active changes replay history. It recommends draining those workflows or using Temporal worker versioning.
alternatives
Within the integration, Shell plus FileSystem is the documented alternative to Coder for agents needing a narrower tool set. Custom tools can also use the workspace directly.
The page mentions Modal and E2B sandboxes when explaining that Sprites have no lifetime timeout. It supplies no side-by-side pricing, security measurements, compatibility matrix or performance results, so it does not establish which provider would best fit a particular application.
evidence
The evidence consists of the complete supplied documentation page at [https://pydantic.dev/docs/ai/harness/sprites-sandbox/index.md]. It supports statements about documented configuration, interfaces, examples and stated failure behaviour.
The linked implementation, provider documentation and related Pydantic guides are not included. Execution results, independent security evaluations and benchmarks are absent. Consequently, documented behaviour is not evidence of tested performance or isolation guarantees.
Access & freshness
costs
The page specifies charges for compute while a Sprite is active and storage until it is deleted. Sleeping preserves files and does not end storage charges. Ending an agent run, timing out a command or closing a client does not delete the Sprite.
No rates, free-tier allowances, usage measurements or total cost estimates are supplied. Model-provider prices are also unknown from this page. Crashes or interrupted runs can leave persistent workspaces behind, making retained references and cleanup relevant to cost control.
rights
The page links source code but does not state the software licence, documentation licence or redistribution permissions. Those rights remain unknown from the supplied page. Sprites service terms and data-handling commitments are also not provided.
The cleanup guidance says to destroy only Sprites you own. It does not establish permission to use, modify or redistribute repositories and other files placed inside a workspace.
freshness
The supplied page was captured on 24 November 2026. It does not identify an exact package release, publication date or last-update date.
The page warns that Pydantic AI Harness APIs may change between minor releases while the project is on 0.x versions, with deprecation warnings and release-note migration guidance. Current package compatibility, service behaviour and availability of the example model identifier remain unverified.
actions
Before adopting the integration, confirm package compatibility and provider pricing, choose the tool capabilities required, and decide how workspace references will be retained. Configure authority metadata for third-party and user-owned files, and assess file-access requirements against the documented permission behaviour.
Build explicit cleanup for successful, failed and interrupted runs. Retain a reference before relying on future reconnection, use failure hooks where appropriate, and distinguish aclose() from destroy(ref). For commands with side effects or background children, validate interruption and recovery behaviour before depending on automatic termination.
