cargo run --example <name>.
All examples require an Anthropic API key exported as
ANTHROPIC_API_KEY. Run any example from the repository root with cargo run --example <name>.Simple chat (simple.rs)
Simple chat (simple.rs)
Location: Builder chain breakdown:The result struct —
meerkat/examples/simple.rsThe minimal “hello world” of Meerkat. Uses the fluent SDK API to send a single prompt and print the result.AgentResult gives you everything you need:The model’s response.
For resuming conversations later.
How many LLM calls were made.
Token counts for cost tracking.
Custom tools (with_tools.rs)
Custom tools (with_tools.rs)
Location: Step 2 — Build and run:
meerkat/examples/with_tools.rsHow to give an agent access to custom tools using the full AgentBuilder API with explicit components.Step 1 — Implement AgentToolDispatcher:The agent loops automatically when the LLM wants to use a tool. A prompt involving two calculations produces 3 turns: call
add, call multiply, generate final response.Budget limits
Budget limits
You can constrain agent execution with The agent will stop and return whatever it has after reaching the turn limit, even if the LLM wanted to continue.
max_turns to prevent runaway tool loops:Streaming events
Streaming events
The agent emits
AgentEvent values during execution. When using the SDK directly you get the final result; when using the RPC or REST APIs, events stream to the client in real time.- JSON-RPC
- REST
Events are delivered as
session/event notifications: