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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//! Swarm definitions and validation.
//!
//! An **Swarm** is a collection of [`Agent`](crate::agent::Agent)s
//! used together. Swarms are the foundation of ObjectiveAI's multi-model approach.
//!
//! # Key Properties
//!
//! - **Immutable**: Any change produces a new Swarm ID
//! - **No weights**: Weights are execution-time parameters, not part of the Swarm
//! - **Content-addressed**: IDs are deterministically computed from the definition
//! - **Deduplicated**: Duplicate agents are merged with their counts summed
//! - **Bounded**: Total agent count must be between 1 and 128 (individual agents with
//! `count: 0` are skipped, but the sum of all counts must be at least 1)
//!
//! # Example
//!
//! ```
//! use objectiveai_sdk::swarm::{InlineSwarmBase, InlineSwarm};
//! use objectiveai_sdk::agent::{InlineAgentBase, InlineAgentBaseWithFallbacks, InlineAgentBaseWithFallbacksOrRemote, InlineAgentBaseWithFallbacksOrRemoteWithCount};
//! use objectiveai_sdk::agent::openrouter;
//! use objectiveai_sdk::agent::completions::message::{Message, SystemMessage, SimpleContent};
//!
//! let swarm_base = InlineSwarmBase {
//! agents: vec![
//! // A simple GPT-4 configuration
//! InlineAgentBaseWithFallbacksOrRemoteWithCount {
//! count: 1,
//! inner: InlineAgentBaseWithFallbacksOrRemote::AgentBase(InlineAgentBaseWithFallbacks {
//! inner: InlineAgentBase::Openrouter(openrouter::AgentBase {
//! model: "openai/gpt-4o".to_string(),
//! ..Default::default()
//! }),
//! fallbacks: None,
//! }),
//! },
//! // Claude with a system prompt
//! InlineAgentBaseWithFallbacksOrRemoteWithCount {
//! count: 1,
//! inner: InlineAgentBaseWithFallbacksOrRemote::AgentBase(InlineAgentBaseWithFallbacks {
//! inner: InlineAgentBase::Openrouter(openrouter::AgentBase {
//! model: "anthropic/claude-3.5-sonnet".to_string(),
//! output_mode: openrouter::OutputMode::JsonSchema,
//! prefix_messages: Some(vec![
//! Message::System(SystemMessage {
//! content: SimpleContent::Text("You are a careful evaluator.".to_string()),
//! name: None,
//! }),
//! ]),
//! ..Default::default()
//! }),
//! fallbacks: None,
//! }),
//! },
//! // Gemini with lower temperature
//! InlineAgentBaseWithFallbacksOrRemoteWithCount {
//! count: 2, // Include 2 instances
//! inner: InlineAgentBaseWithFallbacksOrRemote::AgentBase(InlineAgentBaseWithFallbacks {
//! inner: InlineAgentBase::Openrouter(openrouter::AgentBase {
//! model: "google/gemini-2.0-flash-001".to_string(),
//! output_mode: openrouter::OutputMode::ToolCall,
//! temperature: Some(0.3),
//! ..Default::default()
//! }),
//! fallbacks: None,
//! }),
//! },
//! ],
//! weights: None,
//! };
//!
//! let swarm: InlineSwarm = swarm_base.convert(None).unwrap();
//! println!("Swarm ID: {}", swarm.id);
//! ```
pub use *;
pub use *;