Multi-Agent
Multi-Agent and Composition
Section titled “Multi-Agent and Composition”Agiwo supports composing agents in two ways: agent-as-tool for lightweight delegation, and the scheduler for persistent orchestration.
Agent-as-Tool
Section titled “Agent-as-Tool”Wrap an agent as a tool that another agent can call:
from agiwo.agent import Agent, AgentConfigfrom agiwo.llm import OpenAIModel
researcher = Agent( AgentConfig( name="researcher", description="Researches topics thoroughly and returns summaries", system_prompt="You are a research specialist. Be thorough and cite sources.", ), model=OpenAIModel(id="gpt-4o", name="gpt-4o"),)
orchestrator = Agent( AgentConfig( name="orchestrator", description="Coordinates research tasks", system_prompt="Delegate independent research tasks to the researcher tool.", ), model=OpenAIModel(id="gpt-4o", name="gpt-4o"), tools=[researcher.as_tool()],)
result = await orchestrator.run("Compare Python and Rust for systems programming")How it works
Section titled “How it works”- The orchestrator sees
researcheras a regular tool. - When called, the researcher agent runs its own execution loop.
- The researcher’s final response returns as the tool result.
- The orchestrator continues reasoning with that output.
Scheduler Orchestration
Section titled “Scheduler Orchestration”For long-running, persistent multi-agent setups, use the scheduler:
from agiwo.scheduler import Scheduler
async with Scheduler() as scheduler: orchestrator_id = await scheduler.submit( orchestrator, "Coordinate the research pipeline", persistent=True, )
await scheduler.wait_for(orchestrator_id) await scheduler.enqueue_input(orchestrator_id, "Now analyze the cost implications")Scheduler Tools
Section titled “Scheduler Tools”Agents running under the scheduler automatically get orchestration tools such as:
spawn_agentquery_spawned_agentcancel_agentlist_agentssleep_and_wait
Patterns
Section titled “Patterns”Pipeline
Section titled “Pipeline”Chain agents sequentially when each step depends on the last output.
Fan-out / Fan-in
Section titled “Fan-out / Fan-in”Spawn multiple agents in parallel, then synthesize their results.
Supervisor Pattern
Section titled “Supervisor Pattern”Keep a persistent supervisor alive and let it create transient workers internally.