keep_aliveis runtime/session behaviorsession/external_eventqueues runtime-backed external work- committed success is not rewritten to cancellation
Getting started
Start the server
rkat-rpc defaults to a new isolated realm each time. Use --realm <id> to share config/sessions with other surfaces or processes.Runtime scope
rkat-rpc accepts global scope flags:
--realm: explicit sharing/isolation key--instance: optional instance metadata--realm-backend: creation hint only; actual backend is pinned per realm manifest
Method overview
| Method | Category | Description |
|---|---|---|
initialize | Handshake | Returns server capabilities |
session/create | Session | Create session and run first turn |
session/list | Session | List active sessions |
session/read | Session | Get session state |
session/history | Session | Get committed session transcript messages |
session/archive | Session | Remove session from runtime |
session/external_event | Session | Queue a runtime-backed external event |
session/inject_context | Session | Append runtime-backed system context to the next turn |
turn/start | Turn | Start a new turn on existing session |
turn/interrupt | Turn | Cancel in-flight turn |
runtime/state | Runtime | Read runtime-backed ingress state |
runtime/accept | Runtime | Admit external work directly into runtime ingress |
runtime/retire | Runtime | Retire runtime-backed ingress |
runtime/reset | Runtime | Reset runtime-backed ingress |
input/state | Runtime | Read runtime input lifecycle state |
input/list | Runtime | List runtime input lifecycle records |
mob/prefabs | Mob | List mob prefab templates (mob feature) |
session/stream_open | Session | Open a standalone session event stream |
session/stream_close | Session | Close a standalone session event stream |
mob/create | Mob | Create a mob from a prefab or definition (mob feature) |
mob/list | Mob | List mobs (mob feature) |
mob/status | Mob | Get mob status (mob feature) |
mob/members | Mob | List mob members (mob feature) |
mob/spawn | Mob | Spawn a member into a mob (mob feature) |
mob/spawn_many | Mob | Spawn multiple members into a mob (mob feature) |
mob/retire | Mob | Retire a mob member (mob feature) |
mob/respawn | Mob | Respawn a mob member (mob feature) |
mob/wire | Mob | Wire two mob members for comms (mob feature) |
mob/unwire | Mob | Remove mob comms wiring (mob feature) |
mob/lifecycle | Mob | Stop, resume, complete, destroy, or reset a mob (mob feature) |
mob/send | Mob | Send work to a mob member (mob feature) |
mob/events | Mob | Read mob events by cursor (mob feature) |
mob/stream_open | Mob | Open mob or member event stream (mob feature) |
mob/stream_close | Mob | Close mob or member event stream (mob feature) |
mob/append_system_context | Mob | Stage system context for a member session (mob feature) |
mob/flows | Mob | List mob flows (mob feature) |
mob/flow_run | Mob | Start a mob flow run (mob feature) |
mob/flow_status | Mob | Get flow run status (mob feature) |
mob/flow_cancel | Mob | Cancel a flow run (mob feature) |
mob/spawn_helper | Mob | Spawn a helper member and wait for its result (mob feature) |
mob/fork_helper | Mob | Fork a helper from an existing member and wait for its result (mob feature) |
mob/force_cancel | Mob | Force-cancel a member’s active work (mob feature) |
mob/member_status | Mob | Read canonical status for a specific member (mob feature) |
mob/tools | Mob | Compatibility/escape-hatch mob tool inventory (mob feature) |
mob/call | Mob | Compatibility/escape-hatch mob tool call (mob feature) |
comms/send | Comms | Dispatch a comms command to a session |
comms/peers | Comms | List discoverable peers (comms feature) |
skills/list | Skills | List skills with provenance |
skills/inspect | Skills | Inspect a skill’s full content |
tools/register | Tools | Register additional callable tools with the runtime |
mcp/add | MCP | Stage live MCP server addition (mcp feature) |
mcp/remove | MCP | Stage live MCP server removal (mcp feature) |
mcp/reload | MCP | Reload one or all MCP servers (mcp feature) |
models/catalog | Models | List available models with capabilities and provider profiles |
capabilities/get | Capabilities | Runtime capability report |
config/get | Config | Read current config |
config/set | Config | Replace config |
config/patch | Config | Merge-patch config (RFC 7396) |
runtime/* and input/* methods are advertised only when the server is running with the runtime-backed ingress/control-plane surface enabled.RPC is the canonical typed substrate for the SDKs: use explicit
mob/* lifecycle, send, and observation methods from apps. mob/tools and mob/call remain available only as compatibility and escape-hatch surfaces. Inside running sessions, mob capability is still exposed by composing meerkat-mob-mcp (MobMcpState + MobMcpDispatcher) into SessionBuildOptions.external_tools, which provides mob_* tools to the agent.Protocol
Standard JSON-RPC 2.0 with"jsonrpc": "2.0" on every message. Three message types:
- Request (client -> server): has
id,method,params - Response (server -> client): has
id,resultorerror - Notification (server -> client): has
method,params, noid
Full lifecycle diagram
Full lifecycle diagram
Session methods
initialize
Handshake. Returns server capabilities.Server name.
Server version.
Protocol contract version.
List of supported method names.
session/create
Create a new session and run the first turn.session/history
Read committed transcript history for an existing session.session/read, including mob-owned session IDs when mob support is enabled.
Only prompt is required. All other fields are optional and fall back to config defaults. During execution, session/event notifications are emitted (see Notifications).
Parameter reference
The user prompt to send to the agent.
Model name (e.g.
"claude-opus-4-6", "gpt-5.2").Provider name:
"anthropic", "openai", "gemini", "other".Max tokens per turn.
Override system prompt.
JSON schema for structured output extraction (wrapper or raw schema).
Max retries for structured output validation.
Run-scoped hook overrides (entries to add, hook IDs to disable).
Enable built-in tools (task management, etc.).
Enable shell tool (requires
enable_builtins).Enable semantic memory (
memory_search tool + compaction indexing).Keep session alive after turn for comms.
null = inherit persisted session intent, true = enable, false = disable. Requires comms_name when enabled.Agent name for inter-agent communication.
Provider-specific parameters (e.g., thinking config, reasoning effort).
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.
Parsed structured output.
Schema compatibility warnings.
session/list
List active sessions.session/read
Get session state.Session ID to read.
session/archive
Remove a session from the runtime.Session ID to archive.
Turn methods
turn/start
Start a new turn on an existing session.session/create. Fails with error code -32001 (SESSION_BUSY) if a turn is already in progress.
Session ID to continue.
The follow-up prompt.
Model override for this turn. On pending (deferred) sessions this sets the model before materialization. On materialized sessions this hot-swaps the LLM client for the remainder of the session.
Provider override (e.g.
"anthropic", "openai", "gemini"). Typically inferred from model.Provider-specific parameters (e.g.
{"thinking_budget": 10000}). Applied alongside model/provider override.Max tokens override.
Skill IDs to resolve and inject for this turn.
turn/interrupt
Cancel an in-flight turn. No-op if the session is idle.Session ID to interrupt.
Event methods
session/external_event
Queue a runtime-backed external event for an existing session.Session ID to admit the external event to.
Any JSON value. Stored as the runtime external-event payload.
Optional source label. Defaults to
"rpc" and becomes the runtime external-event source.-32603 if runtime admission fails, -32602 if the session locator is invalid.
This is a queue-only runtime admission path; it does not create a second direct execution loop.
comms/peers
List discoverable peers from configuredTrustedPeers and active in-process registrations. Requires the comms feature.
Session ID to query peers for.
skills/list
List all skills with provenance information, including active and shadowed entries.List of
SkillEntry objects with id, name, description, scope, source, is_active, and optional shadowed_by.-32603 if skills are not enabled.
skills/inspect
Inspect a skill’s full content (body).Skill ID to inspect (e.g.
"task-workflow", "extraction/email").Load from a specific named source, bypassing first-wins resolution. Useful for inspecting shadowed skills.
MCP methods
mcp/add
Stage a live MCP server addition for a running session. The server is connected at the next turn boundary.Session ID to add the server to.
Name for the MCP server.
MCP server configuration (transport, command, args, url, etc.).
Whether to also write the server to disk config.
mcp/remove
Stage removal of an MCP server from a running session. Active tool calls drain before the server disconnects at the next turn boundary.Session ID to remove the server from.
Name of the MCP server to remove.
Whether to also remove from disk config.
mcp/reload
Reload one or all MCP servers for a running session. Useful after config changes.Session ID to reload servers for.
Specific server to reload. If null, reloads all servers.
Models
models/catalog
Return the curated model catalog with provider profiles, capability metadata, and parameter schemas.meerkat-models at build time. No parameters are required.
Contract version for the catalog response.
List of provider entries, each containing
provider, default_model_id, and models.Model profile with capability flags (
supports_temperature, supports_thinking, supports_reasoning) and params_schema.Capabilities
capabilities/get
Return runtime capabilities with status resolved against config. This lists every capability known to Meerkat with its current status (available, disabled by policy, not compiled, etc.).status values:
| Status | Shape | Meaning |
|---|---|---|
Available | "Available" | Compiled in, config-enabled, protocol supports it |
DisabledByPolicy | {"DisabledByPolicy": {"description": "..."}} | Compiled in but disabled by policy |
NotCompiled | {"NotCompiled": {"feature": "..."}} | Feature flag absent at compile time |
NotSupportedByProtocol | {"NotSupportedByProtocol": {"reason": "..."}} | This protocol surface does not support it |
Config methods
config/get
Read current realm config envelope.config/set
Replace config, optionally using generation CAS.config/patch
Merge-patch the config (RFC 7396).config/set also accepts a direct config object as params for compatibility. In that mode, no CAS check is applied.Notifications
During turn execution, the server emitssession/event notifications containing serialized AgentEvent payloads:
AgentEvent enum in meerkat-core:
| Event | Description |
|---|---|
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 |
hook_rewrite_applied | Hook rewrote content |
hook_patch_published | Hook published a patch |
skills_resolved | Skills loaded for turn |
skill_resolution_failed | Skill resolution failed |
tool_config_changed | Tool visibility or MCP config changed |
interaction_complete | Interaction-scoped stream completed |
interaction_failed | Interaction-scoped stream failed |
stream_truncated | Backpressure dropped intermediate events |
session/stream_event notifications
When a session event stream is open (viasession/stream_open), the server emits session/stream_event notifications. The notification payload mirrors session/event, but is scoped to the explicit stream handle.
mob/stream_event notifications
When a mob event stream is open (viamob/stream_open), the server emits mob/stream_event notifications. Requires the mob feature.
AttributedEvent (source + profile + envelope). For per-member streams the event is the raw EventEnvelope<AgentEvent>.
Error codes
Standard JSON-RPC codes plus Meerkat-specific application codes:| Code | Name | Description |
|---|---|---|
| -32700 | Parse error | Invalid JSON |
| -32600 | Invalid request | Not a valid JSON-RPC request |
| -32601 | Method not found | Unknown method |
| -32602 | Invalid params | Missing or invalid parameters |
| -32603 | Internal error | Server error |
| -32001 | Session not found | Session ID does not exist |
| -32002 | Session busy | Turn already in progress |
| -32003 | Session not running | Session not in running state |
| -32010 | Provider error | LLM provider issue (missing key, auth) |
| -32011 | Budget exhausted | Resource limits reached |
| -32012 | Hook denied | Hook blocked the operation |
| -32013 | Agent error | Internal agent error |
| -32020 | Capability unavailable | Required capability not available |
| -32021 | Skill not found | Requested skill does not exist |
| -32022 | Skill resolution failed | Skill resolution error |
Architecture
The RPC server is stateful: agents stay alive between turns. This is the key difference from REST (stateless per-request) and MCP (callback pattern).Agent. This solves the cancel(&mut self) requirement without mutex. Commands (StartTurn, Interrupt, Shutdown) are sent via channels.
Backpressure: The notification channel is bounded. When the client reads slowly, the agent naturally slows down.
Comparison with other surfaces
| CLI | REST | MCP | RPC | |
|---|---|---|---|---|
| Stateful | No | No | No | Yes |
| Streaming | stderr | SSE | Optional | JSONL notifications |
| Multi-session | No | No | No | Yes |
| Cancellation | Ctrl+C | N/A | N/A | turn/interrupt |
| Bidirectional | No | No (SSE one-way) | Partial | Yes |
