Track B: Server API
Track B introduces the HTTP execution surface: Docker Compose, migrations, POST /v1/runs, status polling, and trace export. You complete the same linear stub pipeline as Track A, but through arcflow-server and Postgres persistence.
Goal
Start the server via Docker Compose, confirm readiness, create a run with POST /v1/runs, poll until terminal status, and retrieve the execution trace with GET /v1/runs/{run_id}/trace.
Prerequisites
| Item | Required |
|---|---|
| Docker Compose v2 | Yes |
curl | Yes (use curl.exe on Windows PowerShell if aliased) |
| API keys | Compose dev keys only (dev-secret, dev-admin) |
| Prior track | Track A recommended but not mandatory |
| Primary guide | Server API quickstart |
Embedded SDK runs do not require Postgres. The server returns 503 on run create when the database pool is unavailable.
Primary example
Two-step research pipeline payload (stub agents, no LLM keys). Same logical workflow as Track A with HTTP status strings in PascalCase.
Step 1: Start the stack
Services: Postgres (5432), arcflow-migrate (init), arcflow-server (8080), arcflow-relay (8090, unused in this track).
Step 2: Confirm health and readiness
Expect /health body OK and /ready HTTP 200. 503 on /ready means migrations or Postgres are not ready yet; wait and retry.
Step 3: Create a run
Save payload as run-payload.json:
Submit:
Copy run_id from 201 response. Optional: add Idempotency-Key: <uuid> header for deduplication.
Step 4: Poll until terminal status
Poll until status is Completed, Failed, Cancelled, or Interrupted. Stub runs typically finish in seconds.
Bash loop:
Track B pass criteria: Completed with non-empty result.output.
Step 5: Retrieve trace
Verify event kinds include WorkflowStarted, StepCompleted, and WorkflowCompleted. Payloads are metadata-only trace only.
Optional CLI:
Step 6: Verification checklist
| Check | Expected |
|---|---|
/ready | HTTP 200 |
| Create run | HTTP 201 with run_id |
| Final status | Completed |
| Trace export | Lifecycle kinds present |
| Auth without key | HTTP 401 on /v1/runs |
Expected output
Create response shape:
Completed run includes result.output string. HTTP uses PascalCase; Python SDK embedded runs use lowercase completed for the same state.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
503 on POST /v1/runs | Postgres down or migrations pending | Check docker compose logs arcflow-migrate and /ready |
| 401 Unauthorized | Missing or wrong API key | Use dev-secret from compose file |
Stuck in Running | Server error or hung provider | Inspect server logs; stub should finish quickly |
| Empty trace | Wrong run id | Copy id from create response exactly |
What you learned
Track B maps the embedded SDK loop to durable server execution: auth tiers, run persistence, polling contract, and trace HTTP export. Platform engineers use this surface for backends, cron, and services that should not embed the SDK.
Next tracks
| Track | Focus |
|---|---|
| C | RAG and Qdrant |
| G | Migrations, /ready, operator CLI |
| E | HITL and external callbacks on server |
Stop the stack when finished: