Skip to main content
The 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
str
default:"ConcurrentWorkflow"
Name identifier for the workflow
agents
List[Agent]
required
List of agents to execute concurrently
max_loops
int
default:"1"
Maximum number of execution loops
show_dashboard
bool
default:"False"
Enable real-time dashboard display
output_type
str
default:"dict-all-except-first"
Output format for results
auto_generate_prompts
bool
default:"False"
Enable automatic prompt engineering
autosave
bool
default:"True"
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

When show_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
  1. Independent Agents: Ensure agents don’t need each other’s outputs
  2. Appropriate Size: 3-8 agents typically optimal for most systems
  3. Dashboard Usage: Enable for debugging, disable for production
  4. Resource Management: Monitor CPU/memory with large agent counts
  5. Error Handling: One agent failure doesn’t stop others
Concurrent execution means agents run simultaneously - ensure your LLM API can handle parallel requests

Error Handling