pub struct AgentOrchestrator { /* private fields */ }Expand description
Agent Orchestrator - 主子智能体协调器
基于事件总线实现统一的监控和控制机制。 默认使用内存事件通讯,支持用户自定义 NATS provider。
Implementations§
Source§impl AgentOrchestrator
impl AgentOrchestrator
Sourcepub fn new_memory() -> Self
pub fn new_memory() -> Self
创建新的 orchestrator(使用内存事件通讯)
这是默认的创建方式,适用于单进程场景。
Sourcepub fn new(config: OrchestratorConfig) -> Self
pub fn new(config: OrchestratorConfig) -> Self
使用自定义配置创建 orchestrator
Sourcepub fn subscribe_all(&self) -> Receiver<OrchestratorEvent>
pub fn subscribe_all(&self) -> Receiver<OrchestratorEvent>
订阅所有 SubAgent 事件
返回一个接收器,可以接收所有 SubAgent 的事件。
Sourcepub fn subscribe_subagent(&self, id: &str) -> SubAgentEventStream
pub fn subscribe_subagent(&self, id: &str) -> SubAgentEventStream
订阅特定 SubAgent 的事件
返回一个过滤后的接收器,只接收指定 SubAgent 的事件。
Sourcepub async fn spawn_subagent(
&self,
config: SubAgentConfig,
) -> Result<SubAgentHandle>
pub async fn spawn_subagent( &self, config: SubAgentConfig, ) -> Result<SubAgentHandle>
启动新的 SubAgent
返回 SubAgent 句柄,可用于控制和查询状态。
Sourcepub async fn send_control(&self, id: &str, signal: ControlSignal) -> Result<()>
pub async fn send_control(&self, id: &str, signal: ControlSignal) -> Result<()>
发送控制信号到 SubAgent
Sourcepub async fn pause_subagent(&self, id: &str) -> Result<()>
pub async fn pause_subagent(&self, id: &str) -> Result<()>
暂停 SubAgent
Sourcepub async fn resume_subagent(&self, id: &str) -> Result<()>
pub async fn resume_subagent(&self, id: &str) -> Result<()>
恢复 SubAgent
Sourcepub async fn cancel_subagent(&self, id: &str) -> Result<()>
pub async fn cancel_subagent(&self, id: &str) -> Result<()>
取消 SubAgent
Sourcepub async fn adjust_subagent_params(
&self,
id: &str,
max_steps: Option<usize>,
timeout_ms: Option<u64>,
) -> Result<()>
pub async fn adjust_subagent_params( &self, id: &str, max_steps: Option<usize>, timeout_ms: Option<u64>, ) -> Result<()>
调整 SubAgent 参数
Sourcepub async fn get_subagent_state(&self, id: &str) -> Option<SubAgentState>
pub async fn get_subagent_state(&self, id: &str) -> Option<SubAgentState>
获取 SubAgent 状态
Sourcepub async fn get_all_states(&self) -> HashMap<String, SubAgentState>
pub async fn get_all_states(&self) -> HashMap<String, SubAgentState>
获取所有 SubAgent 的状态
Sourcepub async fn active_count(&self) -> usize
pub async fn active_count(&self) -> usize
获取活跃的 SubAgent 数量
Sourcepub async fn list_subagents(&self) -> Vec<SubAgentInfo>
pub async fn list_subagents(&self) -> Vec<SubAgentInfo>
获取所有 SubAgent 的信息列表
Sourcepub async fn get_subagent_info(&self, id: &str) -> Option<SubAgentInfo>
pub async fn get_subagent_info(&self, id: &str) -> Option<SubAgentInfo>
获取特定 SubAgent 的详细信息
Sourcepub async fn get_active_activities(&self) -> HashMap<String, SubAgentActivity>
pub async fn get_active_activities(&self) -> HashMap<String, SubAgentActivity>
获取所有活跃 SubAgent 的当前活动
Sourcepub async fn get_handle(&self, id: &str) -> Option<SubAgentHandle>
pub async fn get_handle(&self, id: &str) -> Option<SubAgentHandle>
获取 SubAgent 句柄(用于直接控制)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AgentOrchestrator
impl !RefUnwindSafe for AgentOrchestrator
impl Send for AgentOrchestrator
impl Sync for AgentOrchestrator
impl Unpin for AgentOrchestrator
impl UnsafeUnpin for AgentOrchestrator
impl !UnwindSafe for AgentOrchestrator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more