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
- Automatic CPU core utilization
- Conversation history aggregation
Basic Example
With Dashboard Monitoring
With Streaming Callbacks
Key Parameters
Name identifier for the workflow
List of agents to execute concurrently
Maximum number of execution loops
Enable real-time dashboard display
Output format for results
Enable automatic prompt engineering
Automatically save conversation history
Methods
run()
Execute all agents concurrently on a task.batch_run()
Process multiple tasks sequentially (each task runs agents concurrently).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
CPU Core Utilization
The workflow automatically uses 95% of available CPU cores:Agent Configuration for Concurrency
Advanced Features
Agent Status Tracking
Conversation Aggregation
Output Types
Supported output formats:"dict-all-except-first": Dictionary excluding initial user message"dict": Complete conversation dictionary"str": Concatenated string output"list": List of all messages
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: 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