503 (not an empty list) when the underlying store is missing.
Quick Start
1
Attach a ledger and serve
Attaching a
SQLiteRunLedger unlocks /api/runs and /api/runs/{run_id}.2
Read runs over HTTP
Enabling Each Endpoint
Each endpoint reads a store you attach to theAgentOS instance.
- Runs
- Sessions
- Approvals
Endpoint Reference
Five read-only routes, each returning503 naming what to configure when its store is absent.
Response Shapes
Every response matches the endpoint’s contract exactly.GET /api/runs
GET /api/runs
Each run is the record’s own
as_dict() (or vars()) — ledgers with extra fields are not truncated.GET /api/runs/{run_id}
GET /api/runs/{run_id}
The record’s dict directly — no wrapper.
GET /api/sessions
GET /api/sessions
GET /api/sessions/{session_id}
GET /api/sessions/{session_id}
The chat history as the store returns it.
GET /api/approvals
GET /api/approvals
Why the Errors Look Like This
A missing store returns
503 naming what to configure, not an empty list. An empty list is indistinguishable from “no runs yet” and lets an operator debugging a missing run conclude the run never happened. An unknown run or session is 404, not an empty object, for the same reason. Out-of-range limit values return 422 — SQLite treats LIMIT -1 as unlimited, so the bounds are pinned deliberately.Choosing an Endpoint
This decision diagram maps a question to the endpoint that answers it.How Operators Interact
An operator lists runs; the ledger either answers or the endpoint says what to attach.Best Practices
Attach a ledger in production
Attach a ledger in production
The
503 names what to attach, but you want the endpoint to actually work. Attach a SQLiteRunLedger before deploying.Treat 503 as a config bug, not a request bug
Treat 503 as a config bug, not a request bug
A
503 means the store is missing, not that the request was malformed. Do not retry it — fix the configuration.Read-only on purpose
Read-only on purpose
Mutating a run over HTTP is a much larger design question. Use the SDK for changes; these endpoints only read.
Keep limit conservative
Keep limit conservative
The upper bounds (
runs ≤ 500, sessions ≤ 200) exist because clients can otherwise ask for a full-table scan. Request only what you need.Related
AgentOS
The AgentOS platform and its routes.
Run Ledger
Attach a SQLiteRunLedger to record runs.
SQLite Transcript Store
Persist session transcripts for replay.
Approval Protocol
Require approval for sensitive tools.

