Skip to main content
Sandboxes give agents an isolated workspace for files, code, browser sessions, and tools. A writable local workspace is available automatically. Configure three independent behaviors:
  • isolation controls which sandbox a run acquires.
  • lifecycle controls what happens to that sandbox after the run ends.
  • volumes optionally narrows the agent’s persistent-volume grants for one run.
This example starts from a clean sandbox, attaches only the granted reference volume as read-only, keeps one lease for the entire run, returns it to the pool, stops compute after 30 idle minutes, and deletes sandbox storage 60 minutes after the stop.

Isolation

reuse never gives the same sandbox to concurrent outer runs. A sandbox only becomes reusable after its current lease has been released. fresh creates one sandbox for the whole outer request. Root tool calls, deterministic loop steps, and nested agent steps all use that same filesystem until the request or task finishes.
Use shared only when concurrent runs are expected to collaborate. They can read and modify the same files, so your workflow must handle write conflicts.

Lifecycle

Lifecycle timers only apply to onRelease: "pool". Combining either timer with onRelease: "destroy" is invalid. The deprecated idleTtlMinutes field is accepted for compatibility and maps to stop-after-idle with stopped storage retained; do not combine it with the explicit fields.

Common policies

If sandbox is omitted, Polpo uses reuse and returns the sandbox to the pool.

Precedence

Polpo resolves each sandbox field independently, from lowest to highest precedence:
  1. project settings
  2. agent configuration
  3. task or request payload
A request can therefore override only isolation while inheriting the agent’s lifecycle. Persistent volume selection is stricter: higher-precedence settings may remove volumes or narrow access/writeback, but cannot add an ungranted volume or widen its policy.

Persistent volumes

The local workspace is implicit and is not represented by a local volume mode. Project volumes use only mounted or hydrated strategy. Agents receive explicit grants; requests and tasks can select a narrower subset by name:
For a manually managed hydrated volume, the runtime exposes sandbox_volume_checkpoint. Root steps and nested agent steps share the same outer lease, so a checkpoint sees all filesystem changes made earlier in that run. Finalization occurs once, before the Run becomes terminal. shared isolation supports mounted volumes. Hydrated volumes are rejected with shared because independent hydrate/writeback cycles cannot safely share one live filesystem. See Storage for volume creation, grants, writeback, and revision conflict behavior.

Configure an agent

Use an agent policy as the default for every run assigned to that agent:

Override one chat request

Configure a task

The same sandbox object is available in schedule execution settings.

Observe sandbox activity

Sandbox lifecycle events are attached to the canonical Run trace. The Events timeline shows acquisition, resume, release, rejection, and failure events with their sandbox ID and timestamp. This is consistent across direct chat, tasks, Agentic Loops, channel messages, and scheduled executions because those are execution surfaces of the same Run model. For chat integrations, retrieve the transcript and its correlated Run traces together:
The response includes messages and a minimal runs projection. Runtime configuration, checkpoints, and other private execution state are not exposed by this endpoint.

Files and persistent state

Sandbox policy controls compute and the implicit local workspace. Persistent volumes, memory, Connections, task state, and chat sessions follow their own persistence rules. On Polpo Cloud, the managed sandbox provider implements pooling, TTLs, and project-scoped sharing. In self-hosted deployments, the configured provider decides how these policies map to local processes, containers, or another sandbox service.