Skip to content

Architecture V2 Migration

Migrate from legacy V1 execution paths to the Architecture V2 durable kernel: control plane schedules work; workers execute steps; state lives in PostgreSQL.

Full operator detail lives in the monorepo: docs/v2-migration-guide.md. This page is the docs-site summary.

Mental model

PlaneResponsibility
Gateway (control)Accept runs, schedule WorkGraphs, lifecycle (pause/resume/cancel) — does not execute agents in pure V2
Worker (execution)Claim steps, run agents/tools, report results
Kernel storagePostgreSQL tables for runs, steps, events

Feature flags / env

VariableDefaultMeaning
COMMANDER_V2_MODE01 enables V2 (disables legacy routes)
NODE_ENV=productionOften forces V2 on
COMMANDER_LEGACY_EXECUTION0Temporary bridge to re-enable legacy routes
DATABASE_URLRequired for V2 kernel
COMMANDER_WORKER_*see monorepo guideWorker kind, concurrency, auth, tenants

Route mapping

LegacyV2
POST /api/runtime/executePOST /v1/runs
POST /api/orchestrator/executePOST /v1/runs (multi-step graph)
POST /api/chatPOST /v1/runs (single agent step)
POST /api/pause/:runIdPOST /v1/runs/:id/pause
POST /api/resume/:runIdPOST /v1/runs/:id/resume
POST /api/cancel/:runIdPOST /v1/runs/:id/cancel

Core V2 endpoints

  • POST /v1/runs · GET /v1/runs/:id · GET /v1/runs/:id/steps · GET /v1/runs/:id/events
  • Lifecycle: pause / resume / cancel
  • Interactions: human-in-the-loop
  • /health · /metrics · /v1/slo

Storage migration

LegacyV2
SQLite / pod-local filesPostgreSQL commander_* tables
In-memory chat mapsEvent-sourced reconstruction
Old checkpointsNot portable — re-submit runs
bash
# After setting DATABASE_URL
pnpm db:migrate   # from monorepo — see product scripts

Worker sketch

bash
export DATABASE_URL=postgres://...
export COMMANDER_WORKER_AUTH_TOKEN=...
export COMMANDER_WORKER_KIND=agent
# start worker process — see monorepo worker-plane package

Rollout strategy

  1. Dual-run in staging with COMMANDER_LEGACY_EXECUTION=1 if needed
  2. Point a canary tenant at POST /v1/runs
  3. Disable legacy routes (COMMANDER_V2_MODE=1)
  4. Monitor /v1/slo, DLQ, worker lease health

When you can stay on V1-style local CLI

Local cliEntry.ts / SDK CommanderClient for single-machine development remains the fastest path. V2 matters when you need durable multi-replica execution and gateway/worker split.

MIT Licensed — Built for multi-agent orchestration.