@rkat/sdk) is a thin wrapper over Meerkat’s settled runtime-backed contracts. It spawns a local rkat-rpc subprocess and exposes the same session lifecycle used by the CLI, REST, JSON-RPC, and MCP surfaces as TypeScript-native Session and DeferredSession handles.
Getting started
1
Install the SDK
2
Install the RPC binary
rkat-rpc for the current platform, so a manual binary install is optional unless you want to control the binary path yourself.You also need an API key for at least one LLM provider (e.g. ANTHROPIC_API_KEY).3
Configure tsconfig
The SDK is ESM. Your
tsconfig.json must use Node16 module resolution:4
Connect and run
Method overview
MeerkatClient methods
Schedule methods parse the canonical flattened response shape: planning,
timestamps, labels, and other schedule configuration are top-level fields,
not a nested
config, and internal machine_state is never public. Missing or
malformed schedule, occurrence, and tool arrays—or required facts within their
entries—throw MeerkatError with INVALID_RESPONSE instead of becoming empty
or zero-valued results.
Auth wrappers
The SDK also exposes the auth-profile wrappers from the RPC surface:authProfileList(...),authProfileGet(...),authProfileCreate(...),authProfileDelete(...)authLoginStart(...),authLoginComplete(...),authLoginDeviceStart(...),authLoginDeviceComplete(...),authLoginProvisionApiKey(...)authStatusGet(...),authLogout(...)realmList(...),realmGet(...)sendPeerResponseTerminal(...)mcpAdd(...),mcpRemove(...),mcpReload(...)getBlob(...),listSkills()
Generated assistant images
When a session model calls the built-ingenerate_image tool, generated images appear in committed history as SessionAssistantBlock entries with blockType === "image". The SDK preserves imageId, blobId, mediaType, width, height, revisedPrompt, and provider metadata.
WireGenerateImageRequest, WireGenerateImageExecutionPlan, WireImageGenerationToolResult, WireImageOperationPhase, and WireAssistantImageRef.
Capability methods
Session methods
Live channel helper
RealtimeChannel and the old realtime convenience helpers are no longer part of
the public SDK. Use LiveChannel.session(client, session.id, options?) for a
session-bound wrapper around the live/* methods. The SDK returns the transport
bootstrap from live/open; callers still own the WebSocket connection to
openResult.transport.url.
seedMaxChars maps to live/open.seed_max_chars. Use a positive value to
bound serialized seed messages and request a core-selected whole-turn suffix;
omit it for the complete canonical seed. Every ordered System message must fit; an existing
compaction summary may be retained, and any truncation reports
degraded continuity. Canonical image identity, tombstone, and accounting
sidecars remain complete. The server rejects zero.
Mob methods
MeerkatClient
Constructor
$PATH for rkat-rpc. If not found, automatically downloads the correct binary for the current platform and caches it in ~/.cache/meerkat/bin/rkat-rpc. Pass an explicit path or set MEERKAT_BIN_PATH to override.
connect()
rkat-rpc, performs initialize handshake, checks contract version compatibility, and fetches capabilities. Returns this for chaining.
realmId and isolated are mutually exclusive. If realmId is omitted and isolated is not set, the spawned rkat-rpc process uses its normal isolated-mode default rather than a shared default realm. Reuse realmId explicitly to share sessions and config across processes or surfaces.
Set liveWs: true when you need the live/* adapter surface; the SDK starts
rkat-rpc with an ephemeral live WebSocket listener and live/open returns the
transport URL/token for your client to connect.
createSession()
prompt, and returns a Session object. The Session holds the last RunResult and exposes convenience accessors for the most recent text, usage, and tool call counts.
createSessionStreaming()
EventStream for the first turn. Iterate the stream to receive typed events as they arrive. The final RunResult is available on stream.result after iteration completes.
SessionOptions
All fields are camelCase:Session
createSession() and createSessionStreaming() both produce a Session object that acts as the handle for all subsequent turns on the same conversation. The SDK does not own a second execution path; it only wraps the canonical runtime session identity.
Identity
Last-result shortcuts
These accessors always reflect the most recent completed turn:turn()
RunResult. Also updates the session’s last-result shortcuts.
stream()
EventStream. Iterating it yields typed AgentEvent objects. The session’s last-result shortcuts are updated when iteration completes.
interrupt()
turn/interrupt for this session. Has no effect if no turn is running.
archive()
Session object should not be used after calling archive().
invokeSkill()
requireCapability("skills"), then runs a turn with the provided structured SkillKey injected:
send() and peers()
comms capability.
subscribeEvents()
EventSubscription that yields typed AgentEventEnvelope objects.
Capabilities
Capabilities are fetched automatically duringconnect(). Use them to guard code paths that depend on optional features.
Known capability IDs
Known capability IDs
Config management
Examples
Structured output
Structured output
Multi-turn conversation
Multi-turn conversation
Streaming a turn
Streaming a turn
Invoking a skill
Invoking a skill
Multimodal prompt (image input)
Multimodal prompt (image input)
Using collectText() for simple streaming
Using collectText() for simple streaming
See also
- TypeScript SDK reference - types, events, errors, and version compatibility
- Rust SDK overview - Rust library API
- RPC reference - JSON-RPC protocol specification
