arcflow-server overview
arcflow-server is the HTTP front door to the ArcFlow engine for backends, cron jobs, and services that should not embed the Python or TypeScript SDK. One Rust binary wraps arcflow-core with Postgres-backed run persistence, a semver workflow registry, Human-in-the-Loop (HITL) endpoints, external callback ingress, and the admin API that powers the static product.
Choose the server when you need durable run records, registry-based workflow resolution, operator provisioning of sites, or centralized API keys. Choose an embedded SDK when a single process owns the workflow and Postgres is optional.
What the server adds beyond the SDK
| Capability | Embedded SDK | arcflow-server |
|---|---|---|
POST /v1/runs with inline workflow | Via SDK only | Yes |
| Run status polling over HTTP | No | Yes |
| Workflow registry (semver publish/resolve) | No | Yes |
| HITL approve endpoint | In-process only | Yes |
| External callback ingress with HMAC | In-process | Yes |
| Admin sites, knowledge ingest, chat publish | No | Yes |
Trace export GET /v1/runs/{id}/trace | In-process store | Postgres-backed |
Postgres is required for POST /v1/runs. If ARCFLOW_POSTGRESQL_URL is unset or the pool is unavailable, create-run returns 503. Embedded SDK runs do not need Postgres unless you enable recovery or registry features locally.
Architecture
Relay is a separate binary (arcflow-relay) that proxies browser traffic to the server with site tokens and origin checks. See relay/overview.md.
Authentication tiers
Two primary keys protect different route groups:
| Tier | Env var | Routes |
|---|---|---|
| Runtime | ARCFLOW_SERVER_API_KEY | /v1/runs, registry, trace, approve, external |
| Admin | ARCFLOW_ADMIN_API_KEY | /v1/admin/* |
Public probes: /health (liveness), /ready (Postgres + migrations at head). Debug routes require localhost and ARCFLOW_DEBUG=true when compiled with the debug feature.
Scoped runtime keys (ARCFLOW_STATIC_RUNTIME_KEYS) limit which workflow names a key may start. Relay upstream calls use these keys so browsers never hold the master server key.
Full auth detail: authentication.md.
CORS
ARCFLOW_CORS_ORIGINS accepts a comma-separated list of allowed browser origins for direct server calls. Production static sites should use Relay instead of exposing the server API key in the browser. CORS on the server is mainly for local development with mode: "direct" in the static SDK.
Deferred: server SSE (streaming deferred)
GET /v1/runs/{run_id}/events (Server-Sent Events) is not implemented. Poll GET /v1/runs/{run_id} or fetch the trace. SDK run_stream() works in-process only..
Contract drift (K-10)
Normative server-api-v1.md lists only /health, /ready, and deprecated POST /v1/workflows/run. The implemented router matches HTTP API reference. When integrating, prefer this HTTP API reference.
Quick verification
Start the local stack from the repo root:
Create a stub run (see Server API quickstart for the full payload):
Related pages
| Topic | Page |
|---|---|
| Auth tiers and rotation | authentication.md |
| Full route reference | http-api-reference.md |
| Run lifecycle | run-state-machine.md |
| Idempotent create | idempotency.md |
| Schema | postgres-schema.md |
| Known gaps | maturity-and-known-gaps.md |