Skip to content
AGH RuntimeSandbox

Sandbox

How AGH runs sessions on the host or inside provider-backed sandboxes.

Audience
Operators running durable agent work
Focus
Sandbox guidance shaped for scanability, day-two clarity, and operator context.

Sandbox is the execution boundary AGH uses for agent sessions. A workspace can keep the default local sandbox, or it can point at a named sandbox profile that prepares a provider-backed runtime before the ACP agent starts.

The implemented providers are:

BackendUse whenStatus
localThe session should run on the host with AGH's normal local tool host.Implemented
daytonaThe session should run in a Daytona cloud sandbox with file sync enabled.Implemented

Use a sandbox when the runtime boundary matters as much as the agent prompt: dependency isolation, repeatable build environments, risky filesystem operations, or long-running agent work that should survive beyond a local terminal session.

Sandbox state is recorded on each session as sandbox_id, backend, profile, instance_id, state, sync timestamps, and provider state. Operators can inspect that state through session payloads, while extensions can use the sandbox lifecycle hooks and Host API methods.

Lifecycle

Rendering diagram...

A sandboxed session resolves a profile, prepares a runtime, syncs files, launches the agent, and reconciles provider state after stop or restart.
PhaseWhat AGH does
PrepareResolves the workspace sandbox profile, allocates sandbox_id, and prepares the backend.
SyncMoves files between host and runtime according to the profile's sync mode.
LaunchStarts the ACP agent through the sandbox launcher and provider tool host.
StopSyncs back when configured, then destroys, archives, or reuses the runtime.
ReconcileOn daemon boot, reattaches or cleans up recoverable remote sandbox state.

For sync_mode = "none", the sync phases are still lifecycle checkpoints, but no files are moved.

Agent-manageable surfaces

SurfacePurpose
agh workspace add --sandbox <name>Attach a workspace to a sandbox profile.
agh workspace edit --sandbox <name>Change a workspace's sandbox profile.
agh spawn --sandbox-profile <name>Grant a child session permission to use a sandbox profile.
/api/settings/sandboxesManage config-backed sandbox profiles through HTTP/UDS.
sandbox/list, sandbox/info, sandbox/execExtension Host API methods for operational sandbox access.

Lifecycle hooks use the sandbox.* taxonomy: sandbox.prepare, sandbox.ready, sandbox.sync.before, sandbox.sync.after, and sandbox.stop.

Operator checkpoints

CheckpointCommand or surfaceLook for
Workspace resolves the expected profileagh workspace info <name> -o jsonA sandbox value matching the configured profile name.
Session attached to a sandboxagh session status <session-id> -o jsonA sandbox object with backend, profile, and sandbox_id.
Lifecycle events were emittedagh session events <session-id> --last 50 -o jsonsandbox.prepare, sandbox.sync, and sandbox.stop spans.
Extension visibility is wiredHost API sandbox/list and sandbox/infoThe same sandbox identity shown in session status.
Reuse or archive behaved as expectedSession status after stop and daemon restartstate, instance_id, and provider state are stable.

Failure guide

SymptomLikely causeFirst check
Session starts on the hostWorkspace did not resolve a remote profile.agh workspace info <name> -o json
Session fails during prepareProfile name, backend, provider credential, or provider capacity is invalid.agh session events <id> --last 50
Files are missing inside the runtimesync_mode, include, exclude, or runtime_root does not cover them.Sandbox profile in config.toml
Local files did not update after stopSync-back is disabled or the session crashed before final sync completed.sandbox.sync.* events and sandbox.last_error
Reused provider instance has old statepersistence = "reuse" intentionally retained it.Provider state and session sandbox metadata
Child session cannot use the sandbox profileSpawn permission did not include the profile.agh spawn --sandbox-profile <name>

Next

  • Profiles documents the config.toml shape and workspace flags.
  • Daytona documents the implemented remote provider.

On this page