Skip to main content

Install

Cargo.toml
[dependencies]
meerkat = "0.5"
tokio = { version = "1", features = ["full"] }

Run an agent

use std::sync::Arc;
use meerkat::{AgentBuilder, AgentFactory, AnthropicClient, JsonlStore};
use meerkat_store::StoreAdapter;

let api_key = std::env::var("ANTHROPIC_API_KEY")?;
let store_dir = std::env::current_dir()?.join(".rkat").join("sessions");
std::fs::create_dir_all(&store_dir)?;

let factory = AgentFactory::new(store_dir.clone());
let client = Arc::new(AnthropicClient::new(api_key)?);
let llm = factory.build_llm_adapter(client, "claude-sonnet-4-5").await;
let store = Arc::new(StoreAdapter::new(Arc::new(JsonlStore::new(store_dir))));
let tools = Arc::new(meerkat_tools::EmptyToolDispatcher);

let mut agent = AgentBuilder::new()
    .model("claude-sonnet-4-5")
    .system_prompt("You are a helpful assistant.")
    .max_tokens_per_turn(1024)
    .build(Arc::new(llm), tools, store)
    .await;

let result = agent.run("What is the capital of France?".to_string()).await?;
println!("{}", result.text);
To share state across processes/surfaces, pass the same explicit realm (--realm for CLI, realm_id/realmId for SDK clients). See realms.

Switch providers

Same code, different model. The provider is inferred from the model name:
rkat run --model claude-sonnet-4-5 "Explain monads"
rkat run --model gpt-5.2 "Explain monads"
rkat run --model gemini-3-flash-preview "Explain monads"

Add tools

Register an MCP server and its tools are available to the agent immediately:
rkat mcp add filesystem -- npx -y @modelcontextprotocol/server-filesystem /tmp
rkat run "List the files in /tmp"

Enforce budgets

Cap token usage, wall-clock time, or tool calls:
rkat run --max-tokens 10000 --max-duration 30s --max-tool-calls 5 "Analyze this codebase"
The agent completes its current turn when a limit is hit, then stops.

What’s next