Skip to content
AGH RuntimeSandbox

Daytona Sandbox Provider

Configure and operate the implemented Daytona sandbox backend.

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

The Daytona backend prepares a remote sandbox, syncs workspace files, opens the provider tool host, and starts the ACP agent through AGH's sandbox launcher.

Rendering diagram...

The Daytona provider creates or reuses a remote runtime, syncs workspace files, launches the agent, and applies the configured persistence mode.

Required credential

Set DAYTONA_API_KEY in the daemon environment before starting AGH:

export DAYTONA_API_KEY="..."
agh daemon start

The key is used by the Daytona SDK and SSH access flow. Do not put the raw token in session prompts, channel messages, logs, or extension payloads.

AGH requests Daytona SSH access during launch. The credential belongs in the daemon environment, not in config.toml, because config can be printed, edited, and shared by agents.

Profile example

[sandboxes.daytona-dev]
backend = "daytona"
sync_mode = "session-bidirectional"
persistence = "reuse"
runtime_root = "/home/daytona/workspace"

[sandboxes.daytona-dev.daytona]
api_url = "https://app.daytona.io/api"
target = "team-default"
snapshot = "snap-agent-base"
image = "ubuntu:24.04"
class = "cpu-2"
auto_stop = "30m"
auto_archive = "24h"
FieldPurpose
api_urlDaytona API base URL. Defaults to https://app.daytona.io/api.
targetDaytona target or organization routing value.
snapshotPreferred startup source when present.
imageImage startup source when snapshot is empty.
classProvider class metadata passed with the profile.
auto_stopDaytona auto-stop interval.
auto_archiveDaytona auto-archive interval.

Run a workspace in Daytona

agh workspace add /Users/you/project --name project --sandbox daytona-dev
agh session new --workspace project --agent general
agh session status <session-id> -o json

The session payload includes a sandbox object with backend, profile, provider instance, state, and sync details.

Persistence

ValueBehavior
transientDelete the Daytona sandbox when AGH stops the session.
archiveArchive the sandbox on stop.
reuseLeave the sandbox available for reattachment.

Daemon restart reconciliation uses sandbox_id, provider state, and Daytona labels to reattach or clean up recoverable remote sandboxes.

Verify the run

EvidenceCommandWhat it proves
Workspace selected Daytonaagh workspace info project -o jsonThe workspace resolves daytona-dev.
Session prepared remotelyagh session status <session-id> -o jsonThe sandbox.backend is daytona and has an instance_id.
Sync occurredagh session events <session-id> --last 50 -o jsonsandbox.sync.* events include direction and reason.
Agent actually produced workagh session history <session-id>The remote ACP process emitted turns, tool calls, or output.
Persistence matched intentSession status after stopThe sandbox state aligns with transient, archive, or reuse.

Troubleshooting

SymptomCheck firstLikely fix
Prepare fails before syncDaemon environmentSet DAYTONA_API_KEY before agh daemon start.
Daytona creates a new sandbox each runpersistence and provider labels in statusUse persistence = "reuse" when reattachment is desired.
Remote workspace is emptyruntime_root, sync rules, and sync eventsPoint runtime_root at the expected remote path and narrow excludes.
Session hangs after preparesandbox.transport.* events and daemon logsCheck Daytona SSH access and sidecar launch health.
Files did not return to the hostsandbox.sync.* events with from_runtimeConfirm the session reached stop/crash handling and sync-back ran.

On this page