pub struct AgentOrchestrator { /* private fields */ }Expand description
Advanced SubAgent control plane.
This API is for explicit SubAgent lifecycle control: spawn, pause, resume,
cancel, inspect, and subscribe to events. Routine model-visible delegation
should use task / parallel_task.
Implementations§
Source§impl AgentOrchestrator
impl AgentOrchestrator
Sourcepub fn new_memory() -> Self
pub fn new_memory() -> Self
Create a memory-backed control plane.
This is useful for inspecting an empty control plane in tests. Spawning
SubAgents requires Self::from_agent.
Sourcepub fn new(config: OrchestratorConfig) -> Self
pub fn new(config: OrchestratorConfig) -> Self
Create a memory-backed control plane with custom config.
Sourcepub fn from_agent(agent: Arc<Agent>) -> Self
pub fn from_agent(agent: Arc<Agent>) -> Self
Create an orchestrator backed by a real Agent for LLM execution.
SubAgents spawned by this orchestrator will run the actual agent
definition (permissions, system prompt, model, max_steps) loaded from
the agent’s configuration and any extra agent_dirs provided in
SubAgentConfig.
Sourcepub fn from_agent_with_config(
agent: Arc<Agent>,
config: OrchestratorConfig,
) -> Self
pub fn from_agent_with_config( agent: Arc<Agent>, config: OrchestratorConfig, ) -> Self
Create an orchestrator backed by a real Agent with custom config.
Sourcepub fn subscribe_all(&self) -> Receiver<OrchestratorEvent>
pub fn subscribe_all(&self) -> Receiver<OrchestratorEvent>
Subscribe to all SubAgent events.
返回一个接收器,可以接收所有 SubAgent 的事件。
Sourcepub fn subscribe_subagent(&self, id: &str) -> SubAgentEventStream
pub fn subscribe_subagent(&self, id: &str) -> SubAgentEventStream
Subscribe to events for a specific SubAgent.
返回一个过滤后的接收器,只接收指定 SubAgent 的事件。
Sourcepub async fn spawn_subagent(
&self,
config: SubAgentConfig,
) -> Result<SubAgentHandle>
pub async fn spawn_subagent( &self, config: SubAgentConfig, ) -> Result<SubAgentHandle>
Spawn a new 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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more