ConcurrentWorkflow runs multiple agents simultaneously on the same task, enabling parallel execution and high-throughput processing. This architecture is ideal when you need multiple perspectives or rapid parallel analysis.
When to Use
- High-throughput tasks: Process large volumes simultaneously
- Multiple perspectives: Get diverse viewpoints on the same input
- Parallel analysis: Market, financial, and risk analysis at once
- Time-critical operations: Minimize total execution time
- Independent processing: Tasks with no dependencies
Key Features
- True parallel execution with ThreadPoolExecutor
- Real-time dashboard monitoring (optional)
- Agent status tracking
- Streaming callbacks support
- Thread pool sized by agent count, capped at 32
- Conversation history aggregation, with a fresh conversation for every run
- Results recorded in agent order, one final answer per agent
Basic Example
With Dashboard Monitoring
With Streaming Callbacks
Key Parameters
str
default:"ConcurrentWorkflow"
Name identifier for the workflow
List[Agent]
required
List of agents to execute concurrently
int
default:"1"
Reserved for future use — currently stored but not applied. Each call to
run() executes every agent exactly once regardless of this value; use batch_run() to process multiple tasks.bool
default:"False"
Enable real-time dashboard display
str
default:"dict-all-except-first"
Output format for results. The default returns each agent’s message as a
{"role", "content"} dict, without the user’s task.bool
default:"False"
Accepted and stored, but never read. Setting it has no effect.
bool
default:"True"
Automatically save conversation history to the workflow workspace directory after each run
bool
default:"False"
Emit debug-level logging for workspace and autosave operations
str
default:"store"
How to handle an agent that raises.
"store" records the error as that agent’s output and lets the rest finish; "raise" propagates the first error and aborts the run.int
default:"None"
Thread pool size. Defaults to
len(agents) capped at 32. Agent calls are network-bound, so this is sized by agent count rather than CPU cores.Methods
run()
Execute all agents concurrently on a task. Each call starts with a fresh conversation, so a reused workflow returns only this task’s messages.batch_run()
Process multiple tasks sequentially (each task runs agents concurrently). Every task runs in its own conversation, so a result never includes messages from earlier tasks.Dashboard Features
Whenshow_dashboard=True, you get:
- Real-time Status: See each agent’s current state (pending, running, completed)
- Output Preview: Monitor agent outputs as they generate
- Progress Tracking: Visual progress indicators
- Error Detection: Immediate error visibility
- Completion Summary: Final dashboard with all results
Use Cases
Multi-Perspective Analysis
Parallel Research
Batch Document Processing
Performance Optimization
Thread pool sizing
The thread pool is sized by agent count, capped at 32 (MAX_CONCURRENT_AGENTS), since agent calls are network-bound rather than CPU-bound. Pass max_workers to override it, for example to stay under a provider’s rate limit:
Agent Configuration for Concurrency
Advanced Features
Agent Status Tracking
Conversation Aggregation
agents rather than completion order.
Output Types
Supported output formats include:"dict-all-except-first"(default): List of message dicts, without the user’s task"dict"/"list": List of every message dict, task included"str"/"all": The transcript as"role: content"text"str-all-except-first": The agents’ answers as text, without the task"final": The last agent’s answer
Best Practices
Performance Tip: Use concurrent workflow when agents can truly work independently
- Independent Agents: Ensure agents don’t need each other’s outputs
- Appropriate Size: 3-8 agents typically optimal for most systems
- Dashboard Usage: Enable for debugging, disable for production
- Resource Management: Monitor CPU/memory with large agent counts
- Error Handling: With the default
on_error="store", one agent failure doesn’t stop others
Error Handling
Related Architectures
- Sequential Workflow - For ordered execution
- Mixture of Agents - For synthesis of parallel outputs
- Agent Rearrange - For mixed patterns