Skip to content

VM Agent Reference

The VM Agent is a Go binary (packages/vm-agent/) that runs on each provisioned node. It listens on port 8443 (HTTPS) and provides HTTP/WebSocket endpoints for terminal sessions, container management, and AI coding agent sessions (Claude Code, OpenAI Codex, Gemini CLI, Google Antigravity, Mistral Vibe, OpenCode, and Amp).

GET /health

Unauthenticated liveness check. Returns only { "status": "healthy" } — no workspace IDs or other sensitive data are exposed. Richer diagnostics are available via the authenticated /system-info, /metrics/export, and /debug-package endpoints.

WebSocket /terminal/ws
WebSocket /terminal/ws/multi

Opens a PTY terminal session inside the workspace container. Supports:

  • Binary and text frames
  • Terminal resize events
  • Ring buffer replay on reconnect (catches up missed output)
  • Multi-session terminal tabs
WebSocket /agent/ws

Opens an AI coding agent session using the Agent Communication Protocol (ACP). The full session lifecycle is also exposed through control-plane-authenticated HTTP endpoints:

GET /workspaces/{workspaceId}/agent-sessions
POST /workspaces/{workspaceId}/agent-sessions
POST /workspaces/{workspaceId}/agent-sessions/{sessionId}/start
POST /workspaces/{workspaceId}/agent-sessions/{sessionId}/prompt
GET /workspaces/{workspaceId}/agent-sessions/{sessionId}/prompt-receipts/{deliveryId}
POST /workspaces/{workspaceId}/agent-sessions/{sessionId}/checkpoint-rollovers
GET /workspaces/{workspaceId}/agent-sessions/{sessionId}/checkpoint-rollovers/{operationId}
GET /workspaces/{workspaceId}/agent-capabilities
POST /workspaces/{workspaceId}/agent-sessions/{sessionId}/cancel
POST /workspaces/{workspaceId}/agent-sessions/{sessionId}/stop
POST /workspaces/{workspaceId}/agent-sessions/{sessionId}/suspend
POST /workspaces/{workspaceId}/agent-sessions/{sessionId}/resume
POST /workspaces/{workspaceId}/agent-sessions/{sessionId}/hibernate
POST /workspaces/{workspaceId}/agent-sessions/{sessionId}/restore

Protocol version 1 adds an optional exact-once delivery envelope to both the session start request (for its initialPrompt) and the existing prompt endpoint. Existing callers may omit deliveryId and preserve the legacy behavior. A versioned follow-up caller sends:

JSON
{
"protocolVersion": 1,
"deliveryId": "stable-control-plane-delivery-id",
"messageId": "chat-message-id",
"prompt": "Prompt text"
}

For start, place the same protocolVersion, deliveryId, and optional messageId alongside the existing agentType and initialPrompt fields. The VM persists the receipt before invocation. Repeating the same delivery ID and identical request never invokes the agent twice. After a lost HTTP response, read the receipt endpoint before deciding what to do. An in_flight receipt discovered after the VM Agent runtime has restarted becomes ambiguous; it is deliberately never replayed because the prior agent invocation may have occurred. Receipts store a request hash and lifecycle metadata, not prompt text.

Capabilities are VM-authoritative. Version 1 uses the following nested shape; callers must retain the returned runtimeIdentity when reconciling a lost response:

JSON
{
"protocolVersion": 1,
"runtimeIdentity": "vm-runtime-id",
"promptReceipts": {
"supported": true,
"lookup": true,
"states": ["accepted", "in_flight", "completed", "ambiguous"]
},
"checkpointRollover": {
"supported": true,
"automatic": false,
"states": ["accepted", "in_progress", "completed", "superseded", "failed"],
"defaultGraceMs": 30000,
"maxGraceMs": 120000,
"operationTimeoutMs": 120000
}
}

A newly accepted versioned prompt returns HTTP 202; an identical duplicate returns HTTP 200. Both use the same response envelope:

JSON
{
"status": "accepted",
"sessionId": "acp-session-id",
"receipt": {
"deliveryId": "stable-control-plane-delivery-id",
"state": "in_flight",
"runtimeIdentity": "vm-runtime-id",
"acceptedAt": 1786312800123,
"completedAt": null
}
}

acceptedAt and completedAt are Unix epoch milliseconds. HTTP 409 with envelope status not_ready proves non-acceptance for the current attempt; HTTP 409 with status conflict means the delivery ID belongs to different prompt intent. Receipt lookup returns HTTP 404 with a not_found receipt carrying the current VM runtime identity. Automatic replay is allowed only for that positive same-runtime not_found result. A changed runtime identity, an unstructured 404, or an unavailable capability/receipt probe is terminally ambiguous and must not be replayed.

Checkpoint rollover is opt-in and inert until the control plane calls it. Discover support and configured bounds from GET /workspaces/{workspaceId}/agent-capabilities, then submit:

JSON
{
"protocolVersion": 1,
"operationId": "stable-rollover-operation-id",
"graceMs": 30000
}

The operation moves through accepted, in_progress, then completed, superseded, or failed. The VM sends ACP session/cancel and session/close, waits the bounded grace, force-stops the harness if necessary, restarts it, and requires LoadSession of the exact previous ACP session ID. Failure to load that session is explicit; the VM never creates a fresh session as fallback. Natural completion and explicit user cancellation supersede checkpoint preemption. Repeat the same operation ID to reconcile a lost response; a different request with the same ID returns operation_id_conflict.

Activity reports use one immutable promptStartedAt epoch for the accepted prompt. Periodic re-reports reuse it, and only a newly accepted prompt gets a new epoch. Hard deadlines report terminal error, not idle, so an errored host cannot appear available with stale work.

GET /workspaces/{workspaceId}/tabs

Returns the list of open tabs (shell and agent sessions) for a workspace. Used to restore tabs on page refresh.

GET /workspaces
POST /workspaces
POST /workspaces/{workspaceId}/stop
POST /workspaces/{workspaceId}/restart
POST /workspaces/{workspaceId}/rebuild
DELETE /workspaces/{workspaceId}
GET /workspaces/{workspaceId}/events

Create, list, and manage workspace containers. Called by the API Worker during workspace provisioning and lifecycle operations.

GET /workspaces/{workspaceId}/git/status
GET /workspaces/{workspaceId}/git/diff
GET /workspaces/{workspaceId}/git/file
GET /workspaces/{workspaceId}/git/branches

Read git state for the workspace repository. Used by the project chat “Changes” view.

GET /workspaces/{workspaceId}/files/list
GET /workspaces/{workspaceId}/files/find
GET /workspaces/{workspaceId}/files/raw
GET /workspaces/{workspaceId}/files/download
POST /workspaces/{workspaceId}/files/upload
GET /workspaces/{workspaceId}/worktrees
POST /workspaces/{workspaceId}/worktrees
DELETE /workspaces/{workspaceId}/worktrees

Browse, stream, upload, and download files inside the workspace container, and manage git worktrees.

GET /workspaces/{workspaceId}/ports
/workspaces/{workspaceId}/ports/{port}/{path...}
/workspaces/{workspaceId}/local-forward/{port}/{path...}

List detected listening ports and proxy HTTP traffic to a service running inside the container (powers exposed-port preview URLs).

GET /debug-package
GET /system-info
GET /events
GET /events/export
GET /metrics/export
GET /logs
GET /logs/stream
GET /containers

The /debug-package endpoint bundles cloud-init logs, journald, Docker logs, system info, events/metrics databases, provisioning timings, and network config into a single downloadable archive — the fastest way to diagnose a node without SSH.

Node-wide diagnostics require a node-scoped management token issued by the control plane. Workspace browser sessions and workspace-scoped management tokens are not accepted for these routes because a single node can host multiple workspaces. User-facing node observability should go through the control-plane /api/nodes/{nodeId}/... proxy routes, which verify node ownership and sign the node-scoped token for the VM Agent.

Manages terminal sessions with:

  • Session multiplexing — multiple terminals per workspace
  • Ring buffer — stores recent output for replay on reconnect
  • Lifecycle management — automatic cleanup on disconnect

Handles Docker operations:

  • devcontainer up — build and start devcontainer from repo config
  • docker exec — execute commands inside containers
  • Git credential injection — injects GitHub tokens for push access
  • Named volume management — persistent storage across container restarts

The agent samples Linux memory pressure (PSI) and bounded Docker statistics, and watches Docker OOM events. Heartbeats include per-container memory use, memory limit, CPU use, and process count. These measurements describe observed consumption; admission still uses the configured workspace reservations and effective host reserve.

ResourceGuard chooses a running workspace under critical pressure and rechecks ownership and pressure before stopping its container. An OOM event must match the workspace’s current container and container start time. Warning pressure is observable without triggering an eviction. Sustained critical pressure can trigger another attempt after the configured cooldown, using fresh metrics.

Before stopping a running container, the agent requires a bounded session snapshot. A snapshot failure leaves that container running and does not mark or report an eviction. Docker reports an OOM exit after the victim has already stopped, so that path creates a short-lived isolated helper from the exact stopped container and its volumes, captures the snapshot without running the original entrypoint, and removes the helper image and container. If that capture fails, the eviction remains fail-closed instead of silently resuming from stale state. A successful stop or already-stopped OOM capture transitions the workspace to evicted; the control plane closes its compute-usage interval and active sessions. Failed stops do not report a completed eviction.

The pre-stop capture comes from a live container, so it cannot prove the agent’s last files were saved. After docker stop, and before the eviction is recorded, the agent therefore takes a final capture of the stopped container through the same helper (captureQuiescedEvictionSnapshot in internal/server/eviction_final_snapshot.go). The completion reports quiesced only when the source never ran again during the capture and no other container, running or exited since the capture began, mounts the workspace volume, the host clone or a directory above it (requireNoForeignWorkspaceWriters), checked before the capture and again just before completion. A container started with --rm and removed again inside the window leaves no record and is not detected; no SAM component starts one against a workspace’s storage. A degraded final capture is reported as failed rather than completed, so it never replaces the pre-stop capture’s artifacts. An OOM victim captured through the helper is already final. The control plane treats only a quiesced capture as preserved, which is what lets it delete the evicted source after the conversation resumes elsewhere. A final capture that fails or times out (EVICTION_FINAL_SNAPSHOT_TIMEOUT_SECONDS) keeps the pre-stop capture: the conversation still relocates, the source files stay on the node, and the node’s normal retirement deadline bounds them. From the stop’s write-ahead intent until the eviction is recorded, the workspace is marked as finalizing in memory (markEvictionFinalizing): the heartbeat’s callback retry leaves that intent to the controller instead of reconciling it as an interrupted stop, and ordinary snapshot requests are refused (requireWorkspaceNotEvicting, HTTP 409 for synchronous and background sleep requests, checked under the workspace lifecycle lock before the request touches the runtime) so no later capture can replace the final one. After an agent restart nothing is in flight, so the reconciler owns the intent as before; the intent records that the pre-stop capture succeeded.

Helpers are bounded. Each helper is removed when its capture ends; if that removal fails or the agent crashes, the startup reaper, the periodic stale-helper reaper or workspace deletion removes it later. The capture waits for that removal only within its own deadline. One headroom check and its docker commit run at a time per node, because concurrent commits share the Docker root. Each helper container and committed image carries a sam.snapshot-helper.workspace label, a memory and process limit (SNAPSHOT_HELPER_MEMORY_LIMIT, SNAPSHOT_HELPER_PIDS_LIMIT), and is created only when the Docker root keeps SNAPSHOT_HELPER_MIN_FREE_BYTES free beyond the source’s writable layer. The agent removes leftover helpers at startup before eviction can start, and workspace deletion removes that workspace’s helpers before removing its volume, because a helper’s --volumes-from reference would otherwise make the volume removal fail on every retry. The helper runs with no network, no capabilities and no-new-privileges; it inherits the source’s mounts, and the devcontainer is an environment boundary, not a security boundary.

PSI thresholds must be finite percentages greater than zero and at most 100, with warning no higher than critical.

The agent persists the eviction fence before stopping, then retries a token-free callback record across transient failures and agent restarts. Retry eligibility is bounded below by the complete operation lease (60 seconds with default settings), even if the configured backoff cap is smaller; the heartbeat cadence determines when an eligible row is attempted. Ordinary browser reconnects, automatic recovery, legacy bootstrap, and replayed create requests cannot clear that fence. An admitted restart rotates the generation and clears it. Older local metadata without a proven project identity is ineligible for automatic eviction until an authenticated workspace/session metadata update supplies that identity; monitoring and existing host cgroup limits remain active.

The eviction, not the agent supervisor, owns the agent’s exit. docker stop kills the agent’s docker exec process roughly 100ms before the stop returns, so without this rule the session host would treat the disconnect as a crash, fail to restart it against a stopped container, and report a terminal task failure that races the recovery. The session host’s eviction fence (PrepareEviction() in internal/acp/session_host_eviction.go, raised before the stop) is therefore read on both crash paths: a prompt disconnect (finishPromptAttemptWithError) and a process exit (monitorProcessExit) are parked while it is up, with no restart, no agent_restart_failed error and no task callback. The recorded eviction stops the host with StopForEviction(), which ends any in-flight prompt with the evicted stop reason; the task completion callback posts nothing for it, so the eviction callback’s interruptedWork decides what resumes. If the intent is never committed, the fence’s rollback replays the parked handling as an ordinary crash, so a genuine crash is never hidden. An unmanaged session’s prompt deadline (ACP_PROMPT_TIMEOUT) that lands while the fence is up is parked the same way (triggerPromptForceStopIfStuck). Parking is bounded: if the eviction has not stopped the host within EVICTION_PARK_TIMEOUT (for example docker stop keeps failing, or the intent was superseded without stopping the host), the parked handling replays as an ordinary crash rather than leaving the task in progress indefinitely; a later eviction callback can still resume the conversation.

An evicted workspace exposes Start and Restart in the workspace list. Resource and OOM eviction callbacks also start a fenced, idempotent recovery through ordinary placement, excluding the unhealthy source node. Duplicate callbacks converge on the same recovery task, while stale generations are rejected. The callback’s recovery work is registered with waitUntil (completeEvictionRecovery() in apps/api/src/routes/projects/workspace-eviction-callback-recovery.ts), so the wake still starts if the agent’s callback client times out and disconnects mid-request; the response still waits for it, so a retryable refusal reaches the agent. Before stopping, the agent records whether a prompt or background work is still in flight and closes prompt admission on that runtime. Recovery continues interrupted work in both task and conversation modes: as the first prompt of a fresh session, or as a durable SAM message after a saved session is restored and handed over. A session known to have returned control to its human with no work in flight receives no continuation. If an older agent or already-lost harness cannot supply that evidence, the continuation asks the agent to reconcile its transcript and workspace, respect newer human directions, avoid repeating external actions, and remain idle if its work had already finished. Explicit restart checks current membership, credentials, quota, and node capacity before allocating a new reservation and runtime generation. Delayed callbacks from an earlier generation cannot evict the restarted workspace. If restart fails before the VM request is dispatched, only that attempt’s compute interval is closed and the original evicted generation is restored; retry checks admission again. A failed response after dispatch leaves the new generation, reservation, and metering active until the runtime outcome is known, because the VM may already have started.

Implements the Agent Communication Protocol for AI coding agents:

  1. Initialize — establish protocol version and capabilities
  2. NewSession — create a session with working directory and MCP servers
  3. Prompt — send user prompts, receive streaming responses

Responses are serialized via orderedPipe to prevent token reordering from concurrent notification dispatch.

Multiple agent sessions can share one workspace container. Each Docker agent launch receives a unique process ownership marker and a captured launch-root identity before the adapter starts. Stopping or restarting a session signals only its proven processes and captured descendants, with PID start-time checks before signalling. Cleanup includes surviving children after the Docker client exits; it does not match other sessions by adapter command name.

The launcher caches successful capability probes per container ID, launch user and PATH. Failed probes are retried on later launches. When setsid --wait is available, a private Linux session and a small shell supervisor also clean children that clear their environment and become orphaned before Stop. Images without setsid, including implementations without --wait, still launch normally using the marker and captured ancestry. This fallback cannot recover an environment-cleared child whose ancestry was already lost before capture. A NUL-safe grep -Fxlz enables one batch environment scan per cleanup phase; tr is not required. Without that grep capability, cleanup uses the captured root, descendants and any proven private session. Missing capabilities produce a warning with the container ID and reason, never broader command matching. If /proc itself is unavailable, the adapter launches directly and cleanup reports that ownership cannot be established.

Validates workspace and node-management JWTs using the API’s JWKS endpoint:

  • Fetches public keys from /.well-known/jwks.json
  • Caches keys with periodic refresh
  • Enforces workspace claims on workspace-scoped routes
  • Enforces node-scoped management tokens on node-wide diagnostic routes

The agent reads the following environment variables. Cloud-init supplies node identity and callback configuration; monitoring values use these defaults unless overridden in the agent service environment:

Variable Default Description
NODE_ID — Unique node identifier
CONTROL_PLANE_URL — API Worker URL for callbacks
CALLBACK_TOKEN_FILE /etc/sam/callback-token on cloud-init nodes Root-only file containing the callback JWT for authenticating callbacks. CALLBACK_TOKEN remains a legacy fallback for already-provisioned nodes/manual runs.
LOG_LEVEL info Log level: debug, info, warn, error
LOG_FORMAT json Output format: json or text
ACP_PROMPT_RETRY_MAX_RETRIES 2 Max transient provider prompt retries after the initial attempt
ACP_PROMPT_RETRY_INITIAL_BACKOFF 15s Initial backoff before retrying transient provider prompt errors
ACP_PROMPT_RETRY_MAX_BACKOFF 2m Max exponential backoff for transient provider prompt retries
ACP_CHECKPOINT_PREEMPT_GRACE 30s Grace after ACP cancel/close before force-stopping the harness
ACP_CHECKPOINT_PREEMPT_MAX_GRACE 2m Maximum graceMs accepted by the rollover endpoint
ACP_CHECKPOINT_ROLLOVER_TIMEOUT 2m Deadline for the complete stop, restart, and strict LoadSession operation
ACP_NOTIF_SERIALIZE_TIMEOUT 5s Timeout for ACP notification serialization
ACP_HARNESS_ACTIVITY_REPORT_DEBOUNCE 750ms Debounce window for coalescing ACP harness/tool-call activity reports before POSTing activity callbacks
STANDALONE_CLONE_FILTER blob:none Git partial-clone filter for standalone (Cloudflare Container) workspace clones, which run synchronously inside the control plane’s create-workspace request (cloneStandaloneRepository in internal/server/standalone_workspace.go). Set off to force full clones. The control plane forwards CF_CONTAINER_CLONE_FILTER here.
GRACEFUL_SHUTDOWN_TIMEOUT 30s Max time to wait for VM-agent HTTP server shutdown after SIGTERM
SYSTEM_PROVISIONING_TIMEOUT 15m Max time for workspace host provisioning before bootstrap
CF_IP_FETCH_TIMEOUT 10s Timeout for fetching Cloudflare IP ranges during firewall provisioning
BOOT_LOG_HTTP_TIMEOUT 10s Timeout for boot-log callbacks to the control plane
MCP_SHORT_COMMAND_TIMEOUT 10s Timeout for short MCP workspace probes such as branch and credential checks
MCP_DIFF_COMMAND_TIMEOUT 30s Timeout for MCP diff-summary git commands
MCP_BUILD_PREPARE_TIMEOUT 30s Timeout for MCP build/publish preparation probes
JWKS_FETCH_TIMEOUT 10s Timeout for VM-agent startup JWKS fetches
ACP_CREDENTIAL_SYNC_TIMEOUT 10s Timeout for ACP auth-file sync-back during shutdown
ACP_RESTART_ATTEMPT_TIMEOUT 5m Bounds one automatic agent restart attempt by the ACP process monitor
ACP_ACTIVITY_REPORT_TIMEOUT 10s Timeout for each ACP activity callback attempt
ACP_USAGE_PROBE_TIMEOUT 10s Bounds one post-turn provider usage probe (Codex rollout read or OpenCode Go usage request) that feeds the credential usage-limit windows
OPENCODE_GO_USAGE_URL https://opencode.ai/zen/go/v1/usage OpenCode Go usage endpoint probed with the session’s OPENCODE_API_KEY after each completed turn of an opencode-go session. OpenCode Zen has no balance API and is never probed Must be https unless the host is loopback (localhost, 127.0.0.1, ::1), because the probe sends the key as a bearer token; the probe never follows redirects.
DEVCONTAINER_CACHE_PUSH_TIMEOUT 10m Timeout for best-effort devcontainer cache image pushes
WORKSPACE_BUILD_QUEUE_DEPTH 1 Concurrent devcontainer build slots on each workspace VM. Supported values are 1 through 16; invalid values do not enable additional build slots and fall back to the default one-slot behavior. New cloud-init nodes receive this from the Worker env; older agents that do not know it keep their built-in one-slot queue.
DEPLOY_PREFLIGHT_COMMAND_TIMEOUT 15s Timeout for deployment preflight diagnostic commands
LOG_STREAM_PING_WRITE_TIMEOUT 10s Write deadline for log-stream WebSocket ping frames
DEFAULT_RESOURCE_EVENT_BUFFER_SIZE 64 Capacity of each bounded pressure/Docker event queue; positive integer
DEFAULT_PSI_POLL_INTERVAL_SECONDS 10 Linux memory PSI sampling interval, in seconds
DEFAULT_CONTAINER_STATS_INTERVAL_SECONDS 30 Docker resource statistics sampling interval, in seconds
DEFAULT_PSI_MEMORY_SOME_WARNING_THRESHOLD 25 Warning threshold for the maximum PSI some-memory avg10/avg60 percentage
DEFAULT_PSI_MEMORY_SOME_CRITICAL_THRESHOLD 50 Critical threshold for the maximum PSI some-memory avg10/avg60 percentage
DEFAULT_PSI_MEMORY_FULL_WARNING_THRESHOLD 10 Warning threshold for the maximum PSI full-memory avg10/avg60 percentage
DEFAULT_PSI_MEMORY_FULL_CRITICAL_THRESHOLD 25 Critical threshold for the maximum PSI full-memory avg10/avg60 percentage
DEFAULT_EVICTION_DEBOUNCE_SECONDS 30 Minimum cooldown between ResourceGuard eviction attempts, in seconds
DEFAULT_EVICTION_SNAPSHOT_TIMEOUT_SECONDS 120 Deadline for pre-stop ResourceGuard eviction snapshot capture, in seconds
DEFAULT_EVICTION_DOCKER_STOP_TIMEOUT_SECONDS 10 Grace period passed to docker stop --time during ResourceGuard eviction, in seconds
DEFAULT_EVICTION_CALLBACK_RETRY_MAX_SECONDS 300 Backoff cap for durable eviction callback retries, in seconds; the operation lease is a lower bound and can exceed this cap. Delivery starts on a later heartbeat
DEFAULT_EVICTION_RESOLVE_TIMEOUT_SECONDS 5 Deadline for resolving a pressured Docker container to a workspace before eviction, in seconds
EVICTION_FINAL_SNAPSHOT_TIMEOUT_SECONDS 300 Deadline for the post-stop final eviction capture; on timeout the pre-stop capture is kept, in seconds
EVICTION_PARK_TIMEOUT 15m Go duration an eviction may own an agent exit (no restart, no task verdict) before the session host applies ordinary crash handling; must strictly exceed the combined Docker stop (including wait delay), final capture, failure reporting and recording budgets: 2.5 × DEFAULT_EVICTION_DOCKER_STOP_TIMEOUT_SECONDS + EVICTION_FINAL_SNAPSHOT_TIMEOUT_SECONDS + SESSION_SNAPSHOT_PROGRESS_REPORT_TIMEOUT + HTTP_CALLBACK_TIMEOUT in consistent units (360s with defaults); invalid combinations are rejected
SNAPSHOT_HELPER_MEMORY_LIMIT 1g docker --memory value for a stopped-workspace snapshot helper; zero is rejected
SNAPSHOT_HELPER_PIDS_LIMIT 256 docker --pids-limit value for a stopped-workspace snapshot helper
SNAPSHOT_HELPER_MIN_FREE_BYTES 1073741824 Free space the Docker root must keep after committing a source’s writable layer for a helper
COMPOSE_OUTPUT_RETENTION_BYTES 65536 Retained tail of a deployment compose command’s combined output, in bytes (valid range 1024–1048576)
RESOURCE_HISTORY_SAMPLE_INTERVAL 5s Retained resource-history cgroup sampling cadence
RESOURCE_HISTORY_CHUNK_INTERVAL 15m Retained resource-history chunk duration before upload
RESOURCE_HISTORY_SPOOL_DIR /var/lib/vm-agent/resource-history Node-local retry spool for resource-history chunks
RESOURCE_HISTORY_SPOOL_MAX_BYTES 20971520 Max node-local resource-history retry spool bytes
RESOURCE_HISTORY_UPLOAD_TIMEOUT 10s Deadline for one resource-history upload callback
RESOURCE_HISTORY_MAX_SAMPLES 4096 Max resource samples packed into one uploaded chunk
WORKSPACE_CALLBACK_TOKEN_REFRESH_RATIO 0.5 Fraction of a workspace callback token’s lifetime after which the agent renews it (clamped to 0.1–0.9)
WORKSPACE_CALLBACK_TOKEN_RENEWAL_TIMEOUT 15s Timeout for one workspace callback token renewal request
WORKSPACE_CALLBACK_TOKEN_RENEWAL_RETRY_INITIAL 1m First backoff after a transient renewal failure
WORKSPACE_CALLBACK_TOKEN_RENEWAL_RETRY_MAX 30m Renewal backoff ceiling; also the wait after the control plane answers “not yet due”
MCP_TOKEN_ROTATION_TIMEOUT 10s Timeout for one SAM MCP token exchange after a restart or rebuild delivered a new workspace credential
MCP_TOKEN_ROTATION_MAX_ATTEMPTS 3 Attempts per SAM MCP token on transient failures (5xx, 429, network); capped at 10
MCP_TOKEN_ROTATION_RETRY_DELAY 1s First backoff between exchange attempts; doubles per attempt
MCP_TOKEN_ROTATION_BUDGET 1m Total time the exchange pass may delay a restart or rebuild before provisioning continues
MSG_AUTH_RENEWAL_WAIT 15m How long chat-message delivery may stay paused on a rejected workspace token before the pause is reported as an error; held messages are kept
GIT_TOKEN_TIMEOUT 25s Total time for fetching one Git credential from the control plane, across retries
GIT_TOKEN_ATTEMPT_TIMEOUT 10s Time for each attempt; can’t be longer than the control plane’s response-header timeout (10s)
GIT_TOKEN_MAX_ATTEMPTS 3 Attempts per Git credential fetch. Only network errors and HTTP 408, 429, and 5xx are retried; 401, 403, and other 4xx fail at once
GIT_TOKEN_RETRY_DELAY 500ms First delay between attempts; it doubles each time
GIT_CREDENTIAL_TIMEOUT 30s How long the Git credential helper inside a workspace waits for a credential. Workspaces created before this default changed keep their old 5s helper until recreated
SECRET_EXEC_TIMEOUT_MS 600000 (10 min) Default run time for an exec_with_secrets command
SECRET_EXEC_MAX_TIMEOUT_MS 3600000 (1 h) Longest run time a command may ask for
SECRET_EXEC_OUTPUT_BYTES 65536 Output kept per stream (stdout and stderr), from the start
SECRET_EXEC_MAX_ACTIVE 8 Commands that can run at once on one VM agent
Variable Default Description
LOG_RETRIEVAL_DEFAULT_LIMIT 200 Default entries per log page
LOG_RETRIEVAL_MAX_LIMIT 1000 Max entries per log page
LOG_STREAM_BUFFER_SIZE 100 Catch-up entries on stream connect
LOG_READER_TIMEOUT 30s Timeout for journalctl reads
LOG_STREAM_PING_INTERVAL 30s WebSocket ping interval
LOG_STREAM_PONG_TIMEOUT 90s WebSocket pong deadline
Terminal window
cd packages/vm-agent
# Build all platforms
make build-all
# Build for specific platform
GOOS=linux GOARCH=amd64 go build -o bin/vm-agent-linux-amd64 .

Output binaries:

  • vm-agent-linux-amd64 — production (x86)
  • vm-agent-linux-arm64 — production (ARM)
  • vm-agent-darwin-amd64 — local testing (Intel Mac)
  • vm-agent-darwin-arm64 — local testing (Apple Silicon)