1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! # Multi-Agent Orchestration Framework
//!
//! This module provides a comprehensive framework for orchestrating multiple AI agents
//! to collaborate on complex tasks. It supports various orchestration patterns including
//! sequential, parallel, hierarchical, debate, and routing modes.
//!
//! ## Features
//!
//! - **Flexible Orchestration Patterns**: 5+ built-in patterns for different use cases
//! - **Type-Safe Agent Interface**: Strongly typed agent definitions with Rust's trait system
//! - **Async-First Design**: Full async/await support with Tokio
//! - **Execution Tracking**: Comprehensive execution traces for debugging and monitoring
//! - **Error Recovery**: Built-in retry logic and graceful degradation
//! - **Extensible**: Easy to add custom agents and orchestrators
//!
//! ## Quick Start
//!
//! ```rust,no_run,ignore
//! use claude_agent_sdk::orchestration::{
//! Agent, AgentInput, AgentOutput,
//! SequentialOrchestrator, Orchestrator,
//! };
//! use async_trait::async_trait;
//!
//! // Define a simple agent
//! struct Researcher;
//!
//! #[async_trait]
//! impl Agent for Researcher {
//! fn name(&self) -> &str {
//! "Researcher"
//! }
//!
//! fn description(&self) -> &str {
//! "Researches topics and gathers information"
//! }
//!
//! async fn execute(&self, input: AgentInput) -> Result<AgentOutput> {
//! // Agent implementation...
//! Ok(AgentOutput {
//! content: "Research complete".to_string(),
//! data: serde_json::json!({}),
//! confidence: 0.9,
//! metadata: std::collections::HashMap::new(),
//! })
//! }
//! }
//!
//! // Use orchestrator
//! # async fn example() -> anyhow::Result<()> {
//! let agents: Vec<Box<dyn Agent>> = vec
//![Box::new(Researcher)];
//! let orchestrator = SequentialOrchestrator::new(agents);
//! let output = orchestrator.orchestrate(input).await?;
//! # Ok(())
//! # }
//! ```
// Re-export commonly used types
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;