Kagex/Guides
TelemetryObservability & API · 4 min read

Observe AI MicroVMs with OpenTelemetry, Prometheus & Grafana

Treat local AI sandbox fleets like production infrastructure: inspect every scheduler reservation, vsock exec, firewall deny, and CoW sync millisecond by millisecond.

CLI trace
sandboxctl trace <sbx_id|exe_id>
OTLP flag
--otlp-endpoint http://127.0.0.1:4318
Grafana stack
infra/observability/docker-compose.yml
Enable OTLP tracing and launch Prometheus + Grafana
sandboxd serve --otlp-endpoint http://127.0.0.1:4318
docker compose -f infra/observability/docker-compose.yml up -d
sandboxctl trace "$ID"
sandboxctl events

Key Engineering Points · OpenAPI, Go/Python SDKs & WAL Storage

All 10 key points →
  • 1sandboxd serves a versioned REST/JSON + SSE API contracted cleanly in docs/openapi.yaml and live at GET /v1/openapi.yaml.
  • 2Public Go SDK in pkg/client requires zero cgo and handles automatic platform discovery across macOS, Linux, and Windows.
  • 3Python integration requires zero third-party pip packages — stdlib http.client + socket AF_UNIX / TCP streams SSE cleanly (docs/examples/python-harness/harness.py).
  • 4Asynchronous executions via wait=false stream chunked stdout, stderr, and final exit payloads over GET /v1/executions/{exec_id}/stream.
  • 5Oversized command logs stay searchable directly via GET /v1/executions/{exec_id}/grep without overflowing LLM token windows.
  • 6Persistence uses pure-Go SQLite (modernc.org/sqlite) in WAL mode with 1 writer and an 8-reader connection pool.

Per-Phase Latency Waterfalls

sandboxctl trace prints structured spans covering scheduler.reserve, vm.restore, guest.configure, workspace.sync, and exec duration so bottlenecks never hide in black-box scripts.

Pre-Built Prometheus & Grafana Stack

Scrape /metrics natively from sandboxd or spin up infra/observability/docker-compose.yml with grafana-dashboard.json preloaded.

Inspect this architecture live in 3D

Step through MCP ingress, Ghost Secrets, CoW blades, and run sandboxctl commands interactively in your browser.

Frequently Asked Questions

No! sandboxctl trace and sandboxctl events work natively in any terminal without Docker. Docker Compose is optional for Grafana/Prometheus charts.