Getting started
Runtime scope
rkat-rest accepts:
--realm <id>--instance <id>--realm-backend <sqlite|redb|jsonl>
--realm is omitted, the server creates a new isolated opaque realm (realm-...).
Endpoint overview
| Method | Path | Description |
|---|---|---|
POST | /sessions | Create and run a new session |
GET | /sessions | List sessions |
GET | /sessions/{id} | Fetch session metadata and usage |
GET | /sessions/{id}/history | Fetch committed session transcript messages |
POST | /sessions/{id}/messages | Continue an existing session |
POST | /sessions/{id}/external-events | Queue a runtime-backed external event |
POST | /sessions/{id}/interrupt | Interrupt an in-flight turn |
DELETE | /sessions/{id} | Archive (remove) a session |
GET | /sessions/{id}/events | SSE stream for real-time updates |
POST | /sessions/{id}/mcp/add | Stage live MCP server addition (mcp feature) |
POST | /sessions/{id}/mcp/remove | Stage live MCP server removal (mcp feature) |
POST | /sessions/{id}/mcp/reload | Reload MCP server(s) (mcp feature) |
POST | /comms/send | Push comms message into a session (comms feature) |
GET | /comms/peers | List discoverable peers (comms feature) |
GET | /mob/prefabs | List mob prefab templates (mob feature) |
GET | /mob/tools | List mob tools (mob feature) |
POST | /mob/call | Call a mob tool (mob feature) |
GET | /mob/{id}/events | Mob event SSE stream (mob feature) |
GET | /skills | List skills with provenance |
GET | /skills/{id} | Inspect a skill’s full content |
GET | /health | Liveness check |
GET | /models/catalog | Curated model catalog with provider profiles |
GET | /capabilities | Runtime capabilities |
GET | /config | Read config |
PUT | /config | Replace config |
PATCH | /config | Merge-patch config (RFC 7396) |
POST | /requests/{request_id}/cancel | Cancel an uncommitted in-flight request |
Mob capability on REST is exposed through the same session endpoints by composing
meerkat-mob-mcp (MobMcpState + MobMcpDispatcher) into
SessionBuildOptions.external_tools in the host runtime.Request cancellation
REST request cancellation is opt-in and request-ID based.- send
X-Meerkat-Request-Id: <id>onPOST /sessionsorPOST /sessions/{id}/messages - call
POST /requests/{request_id}/cancelto cancel uncommitted in-flight work - duplicate in-flight request IDs are rejected
- pre-start / pre-commit work may return cancelled
- committed success is not rewritten to cancellation
- post-commit create failures still return session identity and remain resumable
Configuration
Server configuration details
Server configuration details
REST configuration is realm-scoped:API keys are provided via environment variables:
- macOS:
~/Library/Application Support/meerkat/rest/realms/<realm>/config.toml - Linux:
~/.local/share/meerkat/rest/realms/<realm>/config.toml - Windows:
%APPDATA%\\meerkat\\rest\\realms\\<realm>\\config.toml
realm_manifest.json (backend pinning) and config_state.json (generation CAS state).Key sections:ANTHROPIC_API_KEYOPENAI_API_KEYGOOGLE_API_KEY
Endpoints
POST /sessions
Create and run a new session.Request fields
The user prompt to send to the agent.
Override the system prompt for this session.
Model name (e.g.
"claude-opus-4-6", "gpt-5.2").Provider:
"anthropic", "openai", "gemini", "other".Max tokens per turn.
JSON schema for structured output extraction (wrapper or raw schema).
Max retries for structured output validation.
null/omitted uses the server default on create and inherits the persisted session value on continue.Enable verbose event logging (server-side).
Keep session alive after turn for comms. On create,
null/omitted uses the create default (false), true enables, and false explicitly disables. Requires comms_name when enabled.Agent name for inter-agent communication.
Friendly metadata for peer discovery (name, description, labels).
GET /sessions//history
Read committed transcript history for a session without changing the lightweight metadata shape ofGET /sessions/{id}.
Query parameters:
offset— skip this many messages from the start of the transcriptlimit— cap the number of returned messages
Enable built-in tools (task management, etc.). Omit to use factory defaults.
Enable shell tool (requires
enable_builtins). Omit to use factory defaults.Enable semantic memory. Omit to use factory defaults.
Response fields
UUID of the created session.
The agent’s response text.
Number of LLM calls made.
Number of tool calls executed.
Token usage breakdown.
Input tokens consumed.
Output tokens generated.
Total tokens (input + output).
Cache creation tokens (provider-specific).
Cache read tokens (provider-specific).
Parsed structured output (when
output_schema was provided).Schema compatibility warnings per provider.
Structured output example
Structured output example
output_schema is provided, the text field contains the schema-only JSON
string produced by the extraction turn (no extra prose). The structured_output
field contains the parsed JSON value for convenience.output_schema may be provided as a wrapper object (shown above) or as a raw
JSON Schema object. The wrapper enables explicit compat/format settings.GET /sessions
List sessions. Supports optional label filters via query parameters.Response
POST /sessions/{id}/messages
Continue an existing session.Request fields
Session ID (must match the path
{id}).Follow-up prompt.
Override the system prompt.
Model override for this turn. On materialized sessions this hot-swaps the LLM client for the remainder of the session.
Provider override for this turn. Typically inferred from
model. Used with model for mid-session provider switching.Max tokens override for this turn.
Structured output schema for this turn.
Max retries for structured output validation. Omit /
null to inherit the persisted session value on continue.Enable verbose event logging.
Keep-alive override for this turn.
null = inherit persisted session intent, true = enable, false = disable.Agent name for comms.
Run-scoped hook overrides.
Response fields
Same shape asPOST /sessions.
POST /sessions/{id}/interrupt
Interrupt an in-flight turn. No-op if the session is idle.Response
POST /requests/{request_id}/cancel
Cancel an uncommitted in-flight request that previously suppliedX-Meerkat-Request-Id.
Response
404 if the session is not found, 409 if the session is not running.
DELETE /sessions/{id}
Archive (remove) a session.Response
404 if the session is not found.
POST /sessions/{id}/external-events
Queue an external event through the runtime-backed admission path.This route keeps the optional
RKAT_WEBHOOK_SECRET header auth used for webhook
delivery, but the admitted event now flows through runtime input acceptance
instead of a surface-local injector path.Any JSON payload. Pretty-printed and injected as an event into the agent’s inbox.
Webhook secret for authentication. Required when
RKAT_WEBHOOK_SECRET env var is set on the server. Compared using constant-time equality (subtle::ConstantTimeEq).| HTTP Status | When |
|---|---|
| 202 | Event queued successfully |
| 404 | Session not found |
| 401 | Missing or invalid webhook secret |
| 503 | Event inbox is full |
GET /sessions/{id}
Fetch session metadata and usage.Response
GET /sessions/{id}/events
Server-Sent Events (SSE) stream for real-time updates. Event types:| Event | Description |
|---|---|
session_loaded | Emitted on connect with session metadata |
run_started | Agent execution began |
run_completed | Agent run finished |
run_failed | Agent run failed |
turn_started | New LLM call within the turn |
text_delta | Streaming text chunk from LLM |
text_complete | Full text for this turn |
tool_call_requested | LLM wants to call a tool |
tool_result_received | Tool result processed |
turn_completed | LLM call finished |
tool_execution_started | Tool dispatch began |
tool_execution_completed | Tool returned a result |
tool_execution_timed_out | Tool exceeded timeout |
compaction_started | Context compaction began |
compaction_completed | Compaction finished |
compaction_failed | Compaction failed |
budget_warning | Approaching resource limits |
retrying | Retrying after transient error |
hook_started | Hook execution began |
hook_completed | Hook finished |
hook_failed | Hook execution failed |
hook_denied | Hook blocked operation |
skills_resolved | Skills loaded for turn |
skill_resolution_failed | Skill resolution failed |
done | Emitted when the broadcast channel closes |
GET /skills
List all skills with provenance information. Returns active and shadowed entries.Response
404 if skills are not enabled.
GET /skills/{id}
Inspect a skill’s full content by its ID.Response
404 if the skill is not found or skills are not enabled.
GET /health
Returns"ok" (HTTP 200). Use for liveness checks.
GET /models/catalog
Return the curated model catalog with provider profiles, capability metadata, and parameter schemas.Response (abbreviated)
meerkat-models at build time. Each provider entry includes the default model and a list of models with their capabilities and parameter schemas.
GET /capabilities
Returns runtime capabilities with status resolved against config.Response (abbreviated)
sessions, streaming, structured_output, hooks, builtins, shell, comms, memory_store, session_store, session_compaction, skills, mcp_live. See the RPC capabilities endpoint for the complete example.
GET /config
Returns a realm config envelope:configgenerationrealm_idinstance_idbackendresolved_paths
PUT /config
Replaces config. Accepted request forms:- Direct config object (compat)
- Wrapped form with CAS:
{ "config": <Config>, "expected_generation": <u64|null> }
PATCH /config
Applies RFC 7396 merge patch. Accepted request forms:- Direct patch object (compat)
- Wrapped form with CAS:
{ "patch": <JSON>, "expected_generation": <u64|null> }
expected_generation is stale, the server returns 400 with a generation-conflict message.
POST /comms/send
Push a canonical comms command into a running session. Requires thecomms feature.
Session ID to dispatch the comms command to.
Command kind:
"peer_message", "peer_request", or "peer_response".Peer name to send to (required for
peer_message and peer_request).Message body (required for
peer_message).Request intent (required for
peer_request, e.g. "review", "delegate").Request parameters (optional for
peer_request).ID of the request being responded to (required for
peer_response).Response status:
"accepted", "completed", or "failed" (for peer_response).Response result data (optional for
peer_response).Optional source label.
Optional stream identifier.
Allow the session to send a message to itself (default: false).
Unlike
POST /sessions/{id}/external-events (which uses RKAT_WEBHOOK_SECRET
header auth), /comms/send has no authentication. It is intended for
trusted internal callers that already know the session ID.GET /comms/peers
List discoverable peers for a session. Requires thecomms feature.
Session ID to query peers for.
Response
Error responses
All errors are returned as JSON with an HTTP status code:| HTTP Status | Code | When |
|---|---|---|
| 400 | BAD_REQUEST | Invalid parameters, session ID mismatch, keep_alive without comms |
| 403 | HOOK_DENIED | Hook blocked the operation |
| 404 | SESSION_NOT_FOUND | Session does not exist |
| 404 | SKILL_NOT_FOUND | Requested skill does not exist |
| 409 | SESSION_BUSY | Turn already in progress |
| 409 | SESSION_NOT_RUNNING | Session not in running state |
| 422 | SKILL_RESOLUTION_FAILED | Skill resolution error |
| 429 | BUDGET_EXHAUSTED | Resource limits reached |
| 500 | AGENT_ERROR | LLM provider error, tool dispatch failure, agent loop error |
| 500 | INTERNAL_ERROR | Store initialization failure, unexpected server error |
| 501 | CAPABILITY_UNAVAILABLE | Required capability not compiled in or disabled |
| 502 | PROVIDER_ERROR | LLM provider issue (missing key, auth failure) |
Notes
Keep-alive mode requires
keep_alive: true and a comms_name. If keep_alive is
requested but the binary was not compiled with comms support, the server
returns a BAD_REQUEST error.POST /sessions/{id}/external-events queues a runtime-backed external event. It is a queue-only admission path, not a second direct execution loop.hooks_override allows per-request hook overrides including adding extra hook
entries and disabling specific hooks by ID. See Hooks for the
HookRunOverrides schema.