Public SDK interfaces use camelCase by default. Protocol-bound multimodal content keys (
media_type, blob_id, duration_ms) intentionally remain wire-shaped.Imports
Everything public is re-exported from the package root:Additional client wrappers
The package exports more than the core session lifecycle. TheMeerkatClient also exposes:
- auth-profile helpers:
authProfileList,authProfileGet,authProfileCreate,authProfileDelete - auth-login helpers:
authLoginStart,authLoginComplete,authLoginDeviceStart,authLoginDeviceComplete,authLoginProvisionApiKey,authStatusGet,authLogout - realm helpers:
realmList,realmGet - typed ingress helper:
sendPeerResponseTerminal - MCP live-op helpers:
mcpAdd,mcpRemove,mcpReload - blob/skill helpers:
getBlob,listSkills - live-channel helpers:
liveOpen,liveStatus,liveClose,liveSendInput,liveSendInputImage,liveSendInputVideoFrame,liveCommitInput,liveInterrupt,liveTruncate,liveRefresh, andparseLiveObservation
Core types
RunResult
The result returned bysession.turn(), session.invokeSkill(), and deferred.startTurn(). Session creation returns runtime-backed Session or DeferredSession wrappers, and the latest RunResult remains available through session.lastResult or stream.result after an EventStream is fully consumed.
Session
client.createSession() returns a runtime-backed Session wrapper.
Session methods are thin conveniences over canonical runtime calls:
await session.turn(...)session.stream(...)await session.history(...)await session.archive()await session.interrupt()await session.invokeSkill(...)await session.subscribeEvents()
DeferredSession
client.createDeferredSession() reserves session identity now and runs the first turn later through await deferred.startTurn(...).
LiveChannel
LiveChannel is the session-bound helper for the live/* RPC surface.
RealtimeChannel was removed with the live-adapter surface; use
LiveChannel.session(client, sessionId, options?) instead.
channel_id returned by live/open. It does not own the
WebSocket transport; connect to opened.transport.url with the returned token
using the transport appropriate for your app.
The direct helper has the same required identity:
client.liveSendInputImage(channelId, idempotencyKey, mime, dataBase64).
LiveChannelOptions.seedMaxChars forwards as LiveOpenParams.seed_max_chars.
It must be positive, bounds serialized seed messages, and requests a
core-owned whole-turn suffix; omission preserves the complete canonical seed.
The resolved root must fit. Runtime context and complete image identity,
tombstone, and accounting sidecars remain outside the window. Any truncation
reports degraded continuity, and the server rejects zero.
Usage
Token usage for a single run. All fields are camelCase — there is nototal_tokens field.
SessionInfo
Summary returned byclient.listSessions().
Capability
A single runtime capability entry, as returned byclient.capabilities.
{ DisabledByPolicy: { ... } }). The SDK normalizes these to the key string automatically.
ContentBlock
Content blocks are used in multimodal prompts and tool results. BothcreateSession() and session.turn() accept string | ContentBlock[] as the prompt parameter.
SchemaWarning
Emitted when a structured output response did not fully conform to the requested schema.Skill types
SkillKey
Structured skill identifier.SkillRef
A skill reference is a structuredSkillKey.
SkillRuntimeDiagnostics
Runtime diagnostics from the skill subsystem. Present onRunResult.skillDiagnostics when the server emits skill health data.
EventStream
EventStream is an AsyncIterable<AgentEvent> returned by createSessionStreaming() and session.stream(). It yields typed events as the agent runs, then makes the final RunResult available on stream.result.
Iterating
collect()
Discards all events and returns the final result:collectText()
Accumulates alltext_delta events and returns the joined string alongside the result:
Typed events
All events are discriminated on thetype field (snake_case, matching the wire protocol). All other fields are camelCase.
AgentEvent union
type outside the generated KNOWN_AGENT_EVENT_TYPES inventory throws a MeerkatError with code UNKNOWN_EVENT_TYPE. A known type without a parser case in this SDK version is surfaced as UnknownEvent for forward-compatibility, and a known type with a malformed payload is preserved as a MalformedEvent (type: "malformed_event").
Session lifecycle events
Turn and LLM events
Tool execution events
Compaction events
Budget events
Retry events
Hook events
Skill events
SkillResolutionFailureReason is a typed union discriminated on reasonType
(not_found, capability_unavailable, load, parse, source_uuid_collision,
source_uuid_mutation_without_lineage, missing_skill_remaps,
remap_without_lineage, unknown_skill_alias, remap_cycle, unknown).
Comms events
Tool config events
Background job events
terminalStatus is the typed semantic status; detail is the human-readable description.
Stream management
Transcript rewrite events
Peer content ingestion events
sender_taint is the
sender’s own signed content-taint declaration; an absent value means the
sender made no declaration and must never be treated as "clean". Host
taint trackers should consume this event instead of parsing rendered peer
message text.
Type guard utilities
The SDK exports type guards for the most commonly used events:Error handling
All errors extendMeerkatError. Catch it as a base class or use the specific subclasses for targeted handling.
Error classes
Common error codes
Skills
BothcreateSession() and session.turn() accept structured skill parameters.
Version compatibility
- While the major version is
0, minor versions must match exactly between SDK and server. - From
1.0.0onwards, standard semver applies: major versions must match.
connect(). A MeerkatError with code VERSION_MISMATCH is thrown if versions are incompatible.
See also
- TypeScript SDK overview - getting started, client and session API
- Python SDK - Python SDK
- RPC reference - JSON-RPC protocol specification
