Skip to content

Welcome to TraitClaw

Build production-grade AI agents in Rust with type-safe tools, streaming, persistent memory, multi-agent teams, and reasoning strategies — all with zero-cost abstractions.

🧩 Composable Traits

8 core traits (Provider, Tool, Memory, Guard, Hint, Tracker, ContextManager, OutputTransformer) compose into any agent topology. No vendor lock-in.

🔧 Type-Safe Tools

#[derive(Tool)] generates JSON schemas from Rust structs at compile time. Catch tool errors before runtime, not in production.

🧠 Multi-Strategy Reasoning

Built-in ReAct, Chain-of-Thought, and Monte Carlo Tree Search strategies via the AgentStrategy trait. Or build your own.

🦀 Zero-Cost Abstractions

No garbage collector, no runtime overhead, single static binary. Perfect for edge devices, embedded systems, and high-throughput servers.

use traitclaw::prelude::*;
use traitclaw_openai_compat::OpenAiCompatProvider;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let agent = Agent::builder()
.provider(OpenAiCompatProvider::openai("gpt-4o-mini", api_key))
.system("You are a helpful assistant")
.build()?;
let output = agent.run("Hello!").await?;
println!("{}", output.text());
Ok(())
}