Skip to main content
The Rust SDK is the primary interface. The Python/TypeScript SDKs and all API servers are thin wrappers over this same engine. The default embedding path is runtime-backed SessionService, which keeps Rust aligned with the same session lifecycle semantics used by every other Meerkat surface while still avoiding subprocess or JSON-RPC overhead.

Method overview

Installation

1

Add the dependency

2

Choose feature flags

The default includes all three LLM providers and nothing else — add subsystems as needed:

Quick start

Production surfaces (CLI, REST, RPC, MCP) use the runtime-backed path where SessionService is substrate and MeerkatMachine owns keep-alive, Queue/Steer routing, and comms drain. See the JSON-RPC API or REST API for those entry points. For the main production embedding path, use the runtime-backed persistent flow:
For testing or embedded use where runtime semantics are intentionally not needed, build_ephemeral_service remains available as a direct Queue-only substrate.

Sessions

SessionService is the canonical lifecycle API. All surfaces (CLI, REST, MCP, RPC) route through it.

Multi-turn conversations

Append a System message at a turn boundary

system_prompt appends one ordinary ordered System message immediately before that turn. It may be used on any turn; prior System messages and the rest of the transcript remain unchanged.

Error handling


Direct agent APIs

Agent::run(...) and AgentBuilder are expert-level escape hatches. Prefer SessionService for normal embedding so your Rust code follows the same runtime-backed session semantics as CLI, REST, RPC, MCP, Python, and TypeScript.

Running agents directly

Basic run

Run with event streaming

Agent methods

Error handling


Events


Core types

Message and ContentBlock

ContentInput

ContentInput is the prompt type accepted by CreateSessionRequest and StartTurnRequest. It supports both text-only and multimodal prompts:

ToolCall and ToolResult

RunResult


See also

  • Tools and stores - tool system, session stores, MCP integration
  • Advanced - expert-only direct agent construction, providers, budgets, and hooks
  • API reference - quick-lookup type index