Skip to content
Agents API
Environments and sandboxesDevelopment preview

Sandbox lifecycle

Understand provisioning, persistence, pause and resume, and deletion.

On this pageProvisioningPersistenceEnding a TurnDeletion

A managed Environment is owned by one Session. Its Sandbox identity stays fixed for the lifetime of that binding.

Provisioning

Rebyte creates the Environment when a managed Session is created. Packages, files, and setup commands prepare the Session's compute. Creating a saved Agent alone does not create an Environment.

Retrieve the Session and its Environment to inspect state. The Environment resource is available at GET /v1/agents/environments/{environment_id}. Failed initialization is reported on the Session.

Persistence

Working files persist across Turns in the same Session. Sessions created from the same Agent have separate environments; using the same path in both does not share a file.

When a Sandbox pauses, later connection resumes the same Sandbox. A connection error does not replace the environment or discard its files. Applications should surface the failure and retain the Session and Environment IDs for diagnosis.

Ending a Turn

Completion, failure, and cancellation end a Turn without deleting the Session. A Session whose initialization succeeded can accept subsequent input. Disconnecting from the event stream also leaves execution running.

Deliverables in /workspace/outputs are published as immutable Artifacts when a Turn completes. See Files and artifacts.

Deletion

Explicit Session deletion removes its Sandbox and stored Artifacts. Deleting one Session does not delete another Session's environment. Deleting a saved Agent does not remove the environments of existing Sessions.

Protocol referenceOpenAI Agents API ↗