Skip to main content
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. The MeerkatClient 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, and parseLiveObservation

Core types

RunResult

The result returned by session.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.
The 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.
The helper stores the 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 no total_tokens field.

SessionInfo

Summary returned by client.listSessions().

Capability

A single runtime capability entry, as returned by client.capabilities.
Status values may be emitted as externally-tagged Rust enum objects (e.g. { DisabledByPolicy: { ... } }). The SDK normalizes these to the key string automatically.

ContentBlock

Content blocks are used in multimodal prompts and tool results. Both createSession() 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 structured SkillKey.

SkillRuntimeDiagnostics

Runtime diagnostics from the skill subsystem. Present on RunResult.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 all text_delta events and returns the joined string alongside the result:

Typed events

All events are discriminated on the type field (snake_case, matching the wire protocol). All other fields are camelCase.

AgentEvent union

Event parsing fails closed: a 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

Emitted when inbound peer content is committed into the session’s context (both queued deliveries and steered mid-turn context). 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 extend MeerkatError. Catch it as a base class or use the specific subclasses for targeted handling.

Error classes

Common error codes


Skills

Both createSession() 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.0 onwards, standard semver applies: major versions must match.
Version checking happens automatically during connect(). A MeerkatError with code VERSION_MISMATCH is thrown if versions are incompatible.

See also