Multi-Agent Teams
TraitClaw’s traitclaw-team crate enables multi-agent collaboration with routing, delegation, and verification.
Quick Example
Section titled “Quick Example”use traitclaw_team::{Team, AgentRole, SequentialRouter};
let team = Team::builder() .name("research") .router(SequentialRouter) .add_role(AgentRole::new("researcher", researcher_agent)) .add_role(AgentRole::new("writer", writer_agent)) .add_role(AgentRole::new("reviewer", reviewer_agent)) .build()?;
let result = team.run("Write a report on quantum computing").await?;Router Strategies
Section titled “Router Strategies”| Router | Behavior |
|---|---|
SequentialRouter | Runs agents in order |
LeaderRouter | LLM decides which agent handles each task |
ConditionalRouter | Rule-based routing with conditions |
| Custom | Implement TeamRouter trait |
Agent Factory & Pool
Section titled “Agent Factory & Pool”use traitclaw_core::{AgentFactory, AgentPool};
// Factory creates agents with shared providerlet factory = AgentFactory::new(provider.clone()) .with_tools(vec![WebSearch, Calculator]);
let researcher = factory.create("researcher", "Research topics thoroughly");let writer = factory.create("writer", "Write clear, concise content");
// Pool manages named agentslet pool = AgentPool::new() .add("researcher", researcher) .add("writer", writer);
let agent = pool.get("researcher").unwrap();