Expand description
Advanced SubAgent control plane.
This module is an advanced control-plane API for explicit SubAgent lifecycle
management. Routine multi-agent composition should use the task /
parallel_task delegation tools.
Broadcast-backed lifecycle APIs support:
- monitoring SubAgent behavior, planning, and execution
- dynamically controlling SubAgents: pause, resume, cancel, and inspect
§架构
AgentOrchestrator
+-- spawn_subagent(SubAgentConfig)
+-- AgentSession stream
+-- broadcast OrchestratorEvent
+-- pause/resume/cancel control signals§使用示例
ⓘ
use a3s_code_core::orchestrator::{AgentOrchestrator, SubAgentConfig};
// Create a control plane backed by a real Agent.
let agent = std::sync::Arc::new(a3s_code_core::Agent::from_config(config).await?);
let orchestrator = AgentOrchestrator::from_agent(agent);
// Subscribe to all events.
let mut events = orchestrator.subscribe_all();
// Spawn a SubAgent.
let handle = orchestrator
.spawn_subagent(
SubAgentConfig::new("general", "Use glob to find Python files")
.with_description("Analyze code")
.with_max_steps(10),
)
.await?;
// Monitor events.
tokio::spawn(async move {
while let Ok(event) = events.recv().await {
println!("Event: {:?}", event);
}
});
// Control the SubAgent lifecycle.
orchestrator.pause_subagent(&handle.id).await?;
orchestrator.resume_subagent(&handle.id).await?;
Structs§
- Agent
Orchestrator - Advanced SubAgent control plane.
- Orchestrator
Config - Orchestrator 配置
- SubAgent
Config - SubAgent 配置
- SubAgent
Event Stream - SubAgent 事件流(过滤特定 SubAgent 的事件)
- SubAgent
Handle - SubAgent 句柄
- SubAgent
Info - SubAgent 信息(元数据)
Enums§
- Control
Signal - 控制信号 - 主智能体发送给子智能体的指令
- Orchestrator
Event - Orchestrator 事件 - 统一的事件类型
- SubAgent
Activity - SubAgent 当前活动
- SubAgent
State - SubAgent 状态