PersistentSessionService with MeerkatMachine; the service is the
session substrate and the machine owns runtime transitions. The direct
EphemeralSessionService path remains useful for small embedded programs and
tests that intentionally do not need runtime-backed persistence or delivery.
Method overview
Mob orchestration is layered on this facade by the separate
meerkat-mob
crate. The live feature composes meerkat-live into the runtime; direct
adapter types remain owned by meerkat-live.
Installation
1
Add the dependency
2
Choose feature flags
The default feature set enables the Anthropic, OpenAI, and Gemini clients
plus GitHub Copilot OAuth/backend support; add optional gates as needed:
Feature flag reference
Feature flag reference
Quick start
Production surfaces (CLI, REST, RPC, MCP) use the runtime-backed path wherePersistentSessionService is substrate and MeerkatMachine owns keep-alive,
Queue/Steer routing, interruption, terminal publication, and archive. Start a
native host with both halves:
Use this dependency set for the persistent example. The explicit
meerkat-store dependency supplies RealmBackend and realm_paths_in;
transitive dependencies are not available as direct crate imports.
Sessions
The examples below use the directEphemeralSessionService lifecycle. The
same request and result types are used inside production hosts, but persistent
follow-up turns, interruption, and archive are machine-owned transitions and
must not call these trait methods directly.
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
Running agents directly
Basic run
Run with event streaming
turn_completed carries optional usage for one provider call while run_completed
carries the session-cumulative total, and their input_tokens fields use
different denominators. usage: None means no accounting exists for that
turn, not zero usage. Read
Usage accounting before aggregating either.Agent methods
Error handling
Events
All event types
All event types
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
