Skip to main content

Workflow Agents

Multi-agent orchestration patterns for complex task pipelines: Sequential, Parallel, and Router agents.

Sequential Agent

Run agents in order where each agent’s output feeds into the next:
from omnicoreagent import OmniCoreAgent, SequentialAgent

# Define specialized agents
researcher = OmniCoreAgent(
    name="researcher",
    system_instruction="Research the given topic thoroughly.",
    model_config={"provider": "openai", "model": "gpt-4o"}
)

writer = OmniCoreAgent(
    name="writer",
    system_instruction="Write a report based on research findings.",
    model_config={"provider": "openai", "model": "gpt-4o"}
)

reviewer = OmniCoreAgent(
    name="reviewer",
    system_instruction="Review and improve the report.",
    model_config={"provider": "openai", "model": "gpt-4o"}
)

# Chain them together
pipeline = SequentialAgent(
    sub_agents=[researcher, writer, reviewer],
    model_config={"provider": "openai", "model": "gpt-4o"}
)
result = await pipeline.run(task="Write a report on quantum computing")

Parallel Agent

Run multiple agents simultaneously for independent tasks:
from omnicoreagent import OmniCoreAgent, ParallelAgent

code_agent = OmniCoreAgent(
    name="code_reviewer",
    system_instruction="Review code for bugs.",
    model_config={"provider": "openai", "model": "gpt-4o"}
)

security_agent = OmniCoreAgent(
    name="security_reviewer",
    system_instruction="Check for security vulnerabilities.",
    model_config={"provider": "openai", "model": "gpt-4o"}
)

perf_agent = OmniCoreAgent(
    name="performance_reviewer",
    system_instruction="Identify performance issues.",
    model_config={"provider": "openai", "model": "gpt-4o"}
)

# Run all three simultaneously
parallel = ParallelAgent(
    sub_agents=[code_agent, security_agent, perf_agent],
    model_config={"provider": "openai", "model": "gpt-4o"}
)
result = await parallel.run(task="Review this codebase")

Router Agent

Intelligently route tasks to the best-suited specialist:
from omnicoreagent import OmniCoreAgent, RouterAgent

code_agent = OmniCoreAgent(
    name="code_expert",
    system_instruction="You handle coding tasks.",
    model_config={"provider": "openai", "model": "gpt-4o"}
)

data_agent = OmniCoreAgent(
    name="data_expert",
    system_instruction="You handle data analysis.",
    model_config={"provider": "openai", "model": "gpt-4o"}
)

research_agent = OmniCoreAgent(
    name="research_expert",
    system_instruction="You handle research tasks.",
    model_config={"provider": "openai", "model": "gpt-4o"}
)

# Router: Intelligent task routing
router = RouterAgent(
    sub_agents=[code_agent, data_agent, research_agent],
    model_config={"provider": "openai", "model": "gpt-4o"}
)
result = await router.run(task="Find and summarize AI research")

When to Use Each Pattern

PatternBest ForExample
SequentialAgentTasks that depend on each other (output of one → input of next)Research → Write → Review
ParallelAgentIndependent tasks that can run simultaneously for speedCode + Security + Performance review
RouterAgentIntelligent task routing to specialized agentsRoute “analyze sales” to data agent
Combine patterns for complex workflows. For example, use a Router to select a pipeline, which then runs a Sequential or Parallel agent.