apps/server is a Bun backend (built with Hono and @hono/zod-openapi) that exposes the SDK over an HTTP surface. This page documents where the OpenAPI contract comes from and how to inspect it.
-
The running server serves the OpenAPI document at
GET /openapi.json(apps/server/src/app.tsregistersapp.doc("/openapi.json", …)). -
A committed snapshot is checked in at
apps/server/openapi.jsonso consumers can read it without running the server. -
The snapshot is regenerated with:
bun run --cwd apps/server gen:openapi # runs scripts/emit-openapi.tsThe snapshot is required to match the running server.
apps/server/tests/openapi-contract.test.tschecks both route coverage and snapshot freshness in CI.
app.ts mounts these route groups under /api:
| Group | Route file |
|---|---|
| Agents | routes/agents.ts |
| Sessions | routes/sessions/ |
| Config | routes/config.ts |
| Environments | routes/environments.ts |
| Vaults | routes/vaults.ts |
| Files | routes/files.ts |
| Skills | routes/skills.ts |
| Models | routes/models.ts |
Routes are defined with @hono/zod-openapi's createRoute, so request validation, typed responses,
and OpenAPI generation share the same Zod schemas. Multipart files and skill uploads use the same
route-definition seam while retaining their upload-specific validation.
The committed openapi.json (openapi: 3.0.0, title OpenAgentPack API) is the complete generated
reference for every /api/* operation. It covers config, agents, environments, vaults, sessions,
files, skills, and models. Read that file or GET /openapi.json for the exact methods, paths,
parameters, and schemas; this page intentionally does not maintain a second handwritten endpoint list.
The SSE stream emits frames with event types event, done, and ping. A 410 response means the event buffer is no longer active — the caller should fetch the session detail once.
Errors are normalized to { "error": { "message": "…" } } by the centralized error handler in app.ts.
bun install
bun run dev:server # hot-reloading dev server
# or
bun run dev # server + webui togetherThe server reads the same provider credentials as the CLI (.env and ~/.agents/config.json); see Provider reference.