3 unstable releases
Uses new Rust 2024
| new 0.3.2 | Feb 15, 2026 |
|---|---|
| 0.3.0 | Feb 14, 2026 |
| 0.1.0 | Feb 12, 2026 |
#1774 in Development tools
2MB
48K
SLoC
Meerkat
A modular, high-performance agent harness built in Rust.
Quick Start • Capabilities • Surfaces • Architecture • Docs
Why Meerkat?
Meerkat is a library-first, modular agent harness — a set of composable Rust crates that handle the hard parts of building agentic systems: state machines, retries, budgets, streaming, tool execution, MCP, multi-agent coordination.
It is designed to be stable (deterministic state machine, typed errors, compile-time guarantees) and fast (<10ms cold start, ~20MB memory, single 5MB binary).
The library comes first; surfaces come second. The CLI, REST API, JSON-RPC server, MCP server, Python SDK, and TypeScript SDK are all thin layers over the same engine. Pick the entry point that fits your architecture.
How it compares
| Meerkat | Claude Code / Codex CLI / Gemini CLI | |
|---|---|---|
| Design | Library-first, modular crates | CLI-first, SDK bolted on |
| Modularity | Compose only what you need — from bare agent loop to full-featured harness | Monolithic, all-or-nothing |
| Languages | Rust core + Python & TypeScript SDKs | TypeScript or Python |
| Interface | CLI, REST, JSON-RPC, MCP server, language SDKs | Rich interactive TUI |
| Memory system | Semantic memory with HNSW indexing + auto-compaction | File-based context |
| Multi-agent | Native Ed25519-authenticated P2P messaging | No |
| Deployment | Single 5MB binary, <10ms startup, ~20MB RAM | Runtime + dependencies |
Those tools excel at interactive development with rich terminal UIs. Meerkat has no TUI — the CLI is a thin, scriptable surface — but you still get first-class features like hooks, skills, semantic memory, and rich session management. Meerkat is for automated pipelines, embedded agents, multi-agent systems, and anywhere you need programmatic control.
Quick Start
As a Library
[dependencies]
meerkat = "0.1"
tokio = { version = "1", features = ["full"] }
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let result = meerkat::with_anthropic(std::env::var("ANTHROPIC_API_KEY")?)
.model("claude-sonnet-4-5")
.system_prompt("You are a helpful assistant.")
.run("What is the capital of France?")
.await?;
println!("{}", result.text);
Ok(())
}
As a CLI
cargo install rkat
export ANTHROPIC_API_KEY=sk-...
rkat run "What is the capital of France?"
rkat run --model gpt-5.2 "Write a haiku about Rust"
rkat run --model gemini-3-flash-preview "Explain async/await"
Core Capabilities
| Capability | Description |
|---|---|
| Multi-provider | Anthropic, OpenAI, Gemini with a unified streaming interface |
| MCP Native | Connect to any Model Context Protocol server |
| Budget Controls | Strict token limits, time limits, tool call caps |
| Session Persistence | Resume conversations from disk (JSONL or redb) |
| Hooks | 8 hook points with observe/rewrite/guardrail semantics |
| Structured Output | JSON-schema-validated extraction from any provider |
| Semantic Memory | Auto-compact long conversations, recall via memory_search |
| Sub-Agents | Spawn/fork child agents with budget and tool isolation |
| Multi-Agent Comms | Ed25519-authenticated peer-to-peer messaging |
| Skills | Composable knowledge packs with capability gating |
| Built-in Tools | Task management, shell, datetime, and more |
| Streaming | Real-time token output via event channels |
Modularity
Pick only what you need:
# Minimal: just the agent loop + one provider
meerkat = { version = "0.1", default-features = false, features = ["anthropic"] }
# Add persistence and compaction
meerkat = { version = "0.1", features = ["anthropic", "session-store", "session-compaction"] }
# Everything
meerkat = { version = "0.1", features = ["all-providers", "session-store", "session-compaction", "memory-store-session"] }
Disabled capabilities return typed errors (SessionError::PersistenceDisabled, etc.) — no panics, no silent degradation.
Surfaces
All surfaces share the same SessionService lifecycle and AgentFactory construction pipeline.
| Surface | Use Case | Docs |
|---|---|---|
| Rust crate | Embed agents in your Rust application | SDK guide |
| Python SDK | Script agents from Python | Python SDK |
| TypeScript SDK | Script agents from Node.js | TypeScript SDK |
CLI (rkat) |
Terminal, CI/CD, cron jobs, shell scripts | CLI guide |
| REST API | HTTP integration for web services | REST guide |
| JSON-RPC | Stateful IDE/desktop integration over stdio | RPC guide |
| MCP Server | Expose Meerkat as tools to other AI agents | MCP guide |
Architecture
┌──────────────────┐
│ Your Surface │ CLI / REST / RPC / MCP / SDK
└────────┬─────────┘
│
┌────────▼─────────┐
│ meerkat │ Facade crate
└────────┬─────────┘
│
┌───────────┬───────┬───────┼───────┬───────────┬───────────┐
│ │ │ │ │ │ │
┌────▼────┐ ┌───▼───┐ ┌─▼───┐ ┌─▼─────┐ ┌───▼───┐ ┌─────▼─────┐
│ client │ │session│ │store│ │ mcp │ │ tools │ │ memory │
├─────────┤ ├───────┤ ├─────┤ ├───────┤ ├───────┤ ├───────────┤
│Anthropic│ │Service│ │JSONL│ │Router │ │ Reg. │ │ HNSW │
│ OpenAI │ │Compact│ │ redb│ │Stdio │ │ Valid.│ │ redb │
│ Gemini │ │Events │ │ │ │HTTP │ │ │ │ │
└─────────┘ └───────┘ └─────┘ └───────┘ └───────┘ └───────────┘
│
┌───────▼───────┐
│ meerkat-core │ Traits, state machine
│ No I/O deps │ Pure logic
└───────────────┘
Crates
| Crate | Purpose |
|---|---|
meerkat |
Facade: re-exports, AgentFactory, SDK helpers |
meerkat-core |
Agent loop, state machine, trait contracts |
meerkat-client |
LLM providers (Anthropic, OpenAI, Gemini) |
meerkat-session |
Session orchestration, compaction, event store |
meerkat-store |
Session persistence (JSONL, redb, in-memory) |
meerkat-memory |
Semantic memory (HNSW + redb) |
meerkat-tools |
Tool registry, built-in tools |
meerkat-hooks |
Hook engine and runtime adapters |
meerkat-skills |
Skill resolution and rendering |
meerkat-mcp |
MCP protocol client and tool router |
meerkat-comms |
Ed25519 encrypted P2P messaging |
meerkat-contracts |
Wire types, error codes, capability registry |
rkat |
CLI binary |
meerkat-rest |
REST API server |
meerkat-rpc |
JSON-RPC stdio server |
meerkat-mcp-server |
MCP server (expose Meerkat as tools) |
Examples
Custom Tools
use meerkat::{AgentToolDispatcher, ToolCallView, ToolDef, ToolResult};
use meerkat::error::ToolError;
use async_trait::async_trait;
use serde_json::json;
use std::sync::Arc;
struct Calculator;
#[async_trait]
impl AgentToolDispatcher for Calculator {
fn tools(&self) -> Arc<[Arc<ToolDef>]> {
vec![Arc::new(ToolDef {
name: "add".into(),
description: "Add two numbers".into(),
input_schema: json!({
"type": "object",
"properties": {
"a": {"type": "number"},
"b": {"type": "number"}
},
"required": ["a", "b"]
}),
})].into()
}
async fn dispatch(&self, call: ToolCallView<'_>) -> Result<ToolResult, ToolError> {
#[derive(serde::Deserialize)]
struct AddArgs { a: f64, b: f64 }
match call.name {
"add" => {
let args: AddArgs = call.parse_args()
.map_err(|e| ToolError::InvalidArguments(e.to_string()))?;
Ok(ToolResult::success(call.id, (args.a + args.b).to_string()))
}
_ => Err(ToolError::not_found(call.name)),
}
}
}
Streaming
let (tx, mut rx) = mpsc::channel(100);
tokio::spawn(async move {
while let Some(event) = rx.recv().await {
if let AgentEvent::TextDelta { delta } = event {
print!("{}", delta);
}
}
});
agent.run_with_events("Write a poem".into(), tx).await?;
See the full documentation for more: MCP tools, session lifecycle, structured output, hooks, sub-agents, skills, and multi-agent comms.
Configuration
export ANTHROPIC_API_KEY=sk-...
export OPENAI_API_KEY=sk-...
export GOOGLE_API_KEY=...
# .rkat/config.toml or ~/.rkat/config.toml
[agent]
model = "claude-opus-4-6"
max_tokens = 4096
See the configuration guide for the full reference.
Documentation
Full documentation is available at docs.rkat.ai.
| Section | Topics |
|---|---|
| Getting Started | Introduction, quickstart |
| Core Concepts | Sessions, tools, providers, configuration |
| Guides | Hooks, skills, memory, sub-agents, comms, structured output |
| CLI & APIs | CLI reference, REST, JSON-RPC, MCP |
| SDKs | Rust, Python, TypeScript |
| Reference | Architecture, capability matrix, built-in tools |
Development
cargo build --workspace # Build
cargo rct # Fast tests (unit + integration-fast)
cargo unit # Unit tests only
cargo int # Integration-fast only
cargo int-real # Integration-real (ignored by default)
cargo e2e # E2E tests (ignored; requires API keys)
Contributing
- Run
cargo rctto verify all checks pass - Add tests for new functionality
- Submit PRs to
main
License
Licensed under either of Apache-2.0 or MIT, at your option.
Dependencies
~28–71MB
~1M SLoC