{ "openapi": "3.1.0", "info": { "title": "agent-runtime", "version": "0.1.0" }, "paths": { "/healthz": { "get": { "tags": [ "health" ], "summary": "Healthz", "operationId": "healthz_healthz_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HealthResponse" } } } } } } }, "/runs": { "get": { "tags": [ "runs" ], "summary": "List Runs", "description": "Paginated run list; supports status/text filter and keyset cursor.", "operationId": "list_runs_runs_get", "parameters": [ { "name": "status", "in": "query", "required": false, "schema": { "type": "array", "items": { "$ref": "#/components/schemas/RunStatus" }, "default": [], "title": "Status" } }, { "name": "q", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Q" } }, { "name": "cursor", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Cursor" } }, { "name": "limit", "in": "query", "required": false, "schema": { "type": "integer", "maximum": 200, "minimum": 1, "default": 50, "title": "Limit" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RunListView" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "post": { "tags": [ "runs" ], "summary": "Post Runs", "operationId": "post_runs_runs_post", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RunCreateBody" } } } }, "responses": { "201": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RunCreateResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/runs/{run_id}": { "get": { "tags": [ "runs" ], "summary": "Get Run", "operationId": "get_run_runs__run_id__get", "parameters": [ { "name": "run_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Run Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RunView" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/runs/{run_id}/steps": { "get": { "tags": [ "steps" ], "summary": "List Steps", "operationId": "list_steps_runs__run_id__steps_get", "parameters": [ { "name": "run_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Run Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/StepListView" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/runs/{run_id}/steps/{step_idx}": { "get": { "tags": [ "steps" ], "summary": "Get Step Detail", "operationId": "get_step_detail_runs__run_id__steps__step_idx__get", "parameters": [ { "name": "run_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Run Id" } }, { "name": "step_idx", "in": "path", "required": true, "schema": { "type": "integer", "title": "Step Idx" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/StepDetailView" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/runs/{run_id}/events": { "get": { "tags": [ "events" ], "summary": "Stream Run Events", "description": "Stream typed events for a run via SSE. Supports Last-Event-ID reconnect (header or query param).", "operationId": "stream_run_events_runs__run_id__events_get", "parameters": [ { "name": "run_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Run Id" } } ], "responses": { "200": { "description": "SSE stream; each data frame is a JSON-encoded EventEnvelope.", "content": { "text/event-stream": { "schema": { "additionalProperties": false, "description": "Typed event stored as a row in the event table (ev jsonb column).\n\nseq: monotonic per-run sequence number; stable across reconnects.\ntype: e.g. 'run.started', 'step.done', 'run.err'.\nrun_id: FK to run table.\npayload: domain-specific event data (depends on type).", "properties": { "seq": { "title": "Seq", "type": "integer" }, "type": { "title": "Type", "type": "string" }, "ts": { "title": "Ts", "type": "number" }, "run_id": { "title": "Run Id", "type": "string" }, "payload": { "additionalProperties": true, "title": "Payload", "type": "object" } }, "required": [ "seq", "type", "ts", "run_id", "payload" ], "title": "EventEnvelope", "type": "object" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/admin/runs/{run_id}": { "get": { "tags": [ "admin" ], "summary": "Admin Get Run", "operationId": "admin_get_run_admin_runs__run_id__get", "parameters": [ { "name": "run_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Run Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RunView" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/admin/runs/{run_id}/replay": { "post": { "tags": [ "admin" ], "summary": "Admin Replay Run", "operationId": "admin_replay_run_admin_runs__run_id__replay_post", "parameters": [ { "name": "run_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Run Id" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ReplayRequest" } } } }, "responses": { "202": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RunCreateResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/admin/runs/fork": { "post": { "tags": [ "admin" ], "summary": "Admin Fork Run", "operationId": "admin_fork_run_admin_runs_fork_post", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ForkRequest" } } }, "required": true }, "responses": { "202": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RunCreateResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/admin/runs/{run_id}/trace": { "post": { "tags": [ "admin" ], "summary": "Admin Export Trace", "operationId": "admin_export_trace_admin_runs__run_id__trace_post", "parameters": [ { "name": "run_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Run Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TraceExportResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/admin/runs/{run_id}/trace/content": { "get": { "tags": [ "admin" ], "summary": "Admin Get Trace Content", "description": "Return inline trace JSON (events + status) without local file access.", "operationId": "admin_get_trace_content_admin_runs__run_id__trace_content_get", "parameters": [ { "name": "run_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Run Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TraceView" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } } }, "components": { "schemas": { "ForkRequest": { "properties": { "source_run_id": { "type": "string", "title": "Source Run Id" }, "from_step_idx": { "type": "integer", "title": "From Step Idx" }, "from_node_idx": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "From Node Idx" }, "new_run_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "New Run Id" } }, "additionalProperties": false, "type": "object", "required": [ "source_run_id", "from_step_idx" ], "title": "ForkRequest", "description": "Fork a run from step N with a new run_id (C2D+)." }, "HTTPValidationError": { "properties": { "detail": { "items": { "$ref": "#/components/schemas/ValidationError" }, "type": "array", "title": "Detail" } }, "type": "object", "title": "HTTPValidationError" }, "HealthResponse": { "properties": { "ok": { "type": "boolean", "title": "Ok" } }, "additionalProperties": false, "type": "object", "required": [ "ok" ], "title": "HealthResponse", "description": "Response body for GET /healthz." }, "ReplayMode": { "type": "string", "enum": [ "freeze", "live" ], "title": "ReplayMode", "description": "Replay mode contract for admin replay endpoint." }, "ReplayRequest": { "properties": { "run_id": { "type": "string", "title": "Run Id" }, "from_step_idx": { "type": "integer", "title": "From Step Idx", "default": 0 }, "from_node_idx": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "From Node Idx" }, "mode": { "$ref": "#/components/schemas/ReplayMode", "default": "live" } }, "additionalProperties": false, "type": "object", "required": [ "run_id" ], "title": "ReplayRequest", "description": "Request body for replay/fork operations (C2D+)." }, "RunCreateBody": { "properties": { "user_text": { "type": "string", "title": "User Text" }, "run_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Run Id" } }, "additionalProperties": false, "type": "object", "required": [ "user_text" ], "title": "RunCreateBody", "description": "Request body for POST /runs." }, "RunCreateResponse": { "properties": { "run_id": { "type": "string", "title": "Run Id" }, "status": { "$ref": "#/components/schemas/RunStatus" } }, "additionalProperties": false, "type": "object", "required": [ "run_id", "status" ], "title": "RunCreateResponse", "description": "Response from POST /runs." }, "RunListItem": { "properties": { "run_id": { "type": "string", "title": "Run Id" }, "status": { "$ref": "#/components/schemas/RunStatus" }, "created_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Created At" }, "duration_ms": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Duration Ms" }, "last_step_kind": { "anyOf": [ { "$ref": "#/components/schemas/StepKind" }, { "type": "null" } ] }, "last_step_idx": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Last Step Idx" } }, "additionalProperties": false, "type": "object", "required": [ "run_id", "status" ], "title": "RunListItem", "description": "Run summary for list responses; additive fields optional for backward compat." }, "RunListView": { "properties": { "items": { "items": { "$ref": "#/components/schemas/RunListItem" }, "type": "array", "title": "Items" }, "next_cursor": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Next Cursor" } }, "additionalProperties": false, "type": "object", "required": [ "items" ], "title": "RunListView", "description": "Paginated run list response." }, "RunStatus": { "type": "string", "enum": [ "PENDING", "RUNNING", "DONE", "ERR" ], "title": "RunStatus" }, "RunView": { "properties": { "run_id": { "type": "string", "title": "Run Id" }, "status": { "$ref": "#/components/schemas/RunStatus" } }, "additionalProperties": false, "type": "object", "required": [ "run_id", "status" ], "title": "RunView", "description": "Read-only run summary returned by GET /runs/{id}." }, "StepDetailView": { "properties": { "run_id": { "type": "string", "title": "Run Id" }, "step_idx": { "type": "integer", "title": "Step Idx" }, "kind": { "$ref": "#/components/schemas/StepKind" }, "started_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Started At" }, "ended_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Ended At" }, "duration_ms": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Duration Ms" }, "input": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "title": "Input" }, "output": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "title": "Output" } }, "additionalProperties": false, "type": "object", "required": [ "run_id", "step_idx", "kind" ], "title": "StepDetailView", "description": "Full step detail for GET /runs/{id}/steps/{idx}: timing + envelopes." }, "StepKind": { "type": "string", "enum": [ "normalize", "model_call", "code_exec", "tool_call", "mcp_call", "reduce", "artifact", "finalize" ], "title": "StepKind" }, "StepListView": { "properties": { "run_id": { "type": "string", "title": "Run Id" }, "steps": { "items": { "$ref": "#/components/schemas/StepView" }, "type": "array", "title": "Steps" } }, "additionalProperties": false, "type": "object", "required": [ "run_id", "steps" ], "title": "StepListView", "description": "Paginated step list response." }, "StepView": { "properties": { "run_id": { "type": "string", "title": "Run Id" }, "step_idx": { "type": "integer", "title": "Step Idx" }, "kind": { "$ref": "#/components/schemas/StepKind" } }, "additionalProperties": false, "type": "object", "required": [ "run_id", "step_idx", "kind" ], "title": "StepView", "description": "Step summary for GET /runs/{id}/steps." }, "TraceExportResponse": { "properties": { "run_id": { "type": "string", "title": "Run Id" }, "trace_uri": { "type": "string", "title": "Trace Uri" } }, "additionalProperties": false, "type": "object", "required": [ "run_id", "trace_uri" ], "title": "TraceExportResponse", "description": "Trace export response with artifact URI." }, "TraceView": { "properties": { "run_id": { "type": "string", "title": "Run Id" }, "status": { "$ref": "#/components/schemas/RunStatus" }, "events": { "items": { "additionalProperties": true, "type": "object" }, "type": "array", "title": "Events" } }, "additionalProperties": false, "type": "object", "required": [ "run_id", "status", "events" ], "title": "TraceView", "description": "JSONL-exportable run trace (C2D+)." }, "ValidationError": { "properties": { "loc": { "items": { "anyOf": [ { "type": "string" }, { "type": "integer" } ] }, "type": "array", "title": "Location" }, "msg": { "type": "string", "title": "Message" }, "type": { "type": "string", "title": "Error Type" }, "input": { "title": "Input" }, "ctx": { "type": "object", "title": "Context" } }, "type": "object", "required": [ "loc", "msg", "type" ], "title": "ValidationError" } } } }