a3s_code_core/orchestrator/
config.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone)]
7pub struct OrchestratorConfig {
8 pub event_buffer_size: usize,
10
11 pub control_buffer_size: usize,
13
14 pub max_concurrent_subagents: usize,
16
17 pub subject_prefix: String,
19}
20
21impl Default for OrchestratorConfig {
22 fn default() -> Self {
23 Self {
24 event_buffer_size: 1000,
25 control_buffer_size: 100,
26 max_concurrent_subagents: 50,
27 subject_prefix: "agent".to_string(),
28 }
29 }
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34pub struct SubAgentConfig {
35 pub agent_type: String,
37
38 pub description: String,
40
41 pub prompt: String,
43
44 #[serde(default)]
46 pub permissive: bool,
47
48 pub max_steps: Option<usize>,
50
51 pub timeout_ms: Option<u64>,
53
54 #[serde(skip_serializing_if = "Option::is_none")]
56 pub parent_id: Option<String>,
57
58 #[serde(default)]
60 pub metadata: serde_json::Value,
61}
62
63#[derive(Debug, Clone, Serialize, Deserialize)]
65pub struct SubAgentInfo {
66 pub id: String,
68
69 pub agent_type: String,
71
72 pub description: String,
74
75 pub state: String,
77
78 pub parent_id: Option<String>,
80
81 pub created_at: u64,
83
84 pub updated_at: u64,
86
87 pub current_activity: Option<SubAgentActivity>,
89}
90
91#[derive(Debug, Clone, Serialize, Deserialize)]
93#[serde(tag = "type", rename_all = "snake_case")]
94pub enum SubAgentActivity {
95 Idle,
97
98 CallingTool {
100 tool_name: String,
101 args: serde_json::Value,
102 },
103
104 RequestingLlm { message_count: usize },
106
107 WaitingForControl { reason: String },
109}
110
111impl SubAgentConfig {
112 pub fn new(agent_type: impl Into<String>, prompt: impl Into<String>) -> Self {
114 Self {
115 agent_type: agent_type.into(),
116 description: String::new(),
117 prompt: prompt.into(),
118 permissive: false,
119 max_steps: None,
120 timeout_ms: None,
121 parent_id: None,
122 metadata: serde_json::Value::Null,
123 }
124 }
125
126 pub fn with_description(mut self, description: impl Into<String>) -> Self {
128 self.description = description.into();
129 self
130 }
131
132 pub fn with_permissive(mut self, permissive: bool) -> Self {
134 self.permissive = permissive;
135 self
136 }
137
138 pub fn with_max_steps(mut self, max_steps: usize) -> Self {
140 self.max_steps = Some(max_steps);
141 self
142 }
143
144 pub fn with_timeout_ms(mut self, timeout_ms: u64) -> Self {
146 self.timeout_ms = Some(timeout_ms);
147 self
148 }
149
150 pub fn with_parent_id(mut self, parent_id: impl Into<String>) -> Self {
152 self.parent_id = Some(parent_id.into());
153 self
154 }
155
156 pub fn with_metadata(mut self, metadata: serde_json::Value) -> Self {
158 self.metadata = metadata;
159 self
160 }
161}