Skip to main content

setup_multi_agent

Function setup_multi_agent 

Source
pub fn setup_multi_agent(
    runtime: &AgentRuntime,
    config: MultiAgentConfig,
    lang: Language,
    business_tools: Vec<Arc<dyn Tool>>,
    error_recovery: Option<Arc<dyn ToolErrorRecovery>>,
    existing_tool_names: &HashSet<String>,
    tool_factory: Option<MultiAgentToolFactory>,
) -> AgentResult<Arc<MultiAgentRuntime>>
Expand description

Set up the MultiAgentRuntime, event bridge, and register tools on an already-built runtime.

ยงSafety / Runtime Requirement

This function uses tokio::task::block_in_place to register tools synchronously. It requires a multi-threaded tokio runtime. Calling it on a #[tokio::main] single-threaded (current_thread) runtime will panic.

The phi-agent CLI and all examples use the default multi-threaded runtime, so this is safe in practice.