> ## Documentation Index
> Fetch the complete documentation index at: https://docs-omnicoreagent.omnirexfloralabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Workflow Agents

> Sequential, parallel, and router workflows for multi-agent orchestration

# 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:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
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:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
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:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
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

| Pattern             | Best For                                                        | Example                              |
| ------------------- | --------------------------------------------------------------- | ------------------------------------ |
| **SequentialAgent** | Tasks that depend on each other (output of one → input of next) | Research → Write → Review            |
| **ParallelAgent**   | Independent tasks that can run simultaneously for speed         | Code + Security + Performance review |
| **RouterAgent**     | Intelligent task routing to specialized agents                  | Route "analyze sales" to data agent  |

<Tip>
  Combine patterns for complex workflows. For example, use a Router to select a pipeline, which then runs a Sequential or Parallel agent.
</Tip>
