Skip to main content
Swarm Type: ConcurrentWorkflow

Overview

The ConcurrentWorkflow swarm type runs independent tasks in parallel, significantly reducing processing time for complex operations. This architecture is ideal for tasks that can be processed simultaneously without dependencies, allowing multiple agents to work on different aspects of a problem at the same time. Key features:
  • Parallel Execution: Multiple agents work simultaneously
  • Reduced Processing Time: Faster completion through parallelization
  • Independent Tasks: Agents work on separate, non-dependent subtasks
  • Scalable Performance: Performance scales with the number of agents

Architecture

All agents start at once and work independently. No agent waits on another.

Use Cases

  • Independent data analysis tasks
  • Parallel content generation
  • Multi-source research projects
  • Distributed problem solving

API Usage

Basic ConcurrentWorkflow Example

Example Response:

Output Shape

Every swarm run is executed through a SwarmRouter with output_type forced to "dict" server-side (see api/swarm_completions.py), so output is a list of {"role": ..., "content": ...} conversation turns rather than a single string. For ConcurrentWorkflow specifically, each requested agent receives the same original task independently and runs on a thread pool — there is one turn per agent. The agents run in parallel, but their turns are added to output in the order the agents appear in the request, not the order they finished. No agent sees another agent’s output, so an agent you add as a “synthesizer” works from the raw task like the others and cannot combine their answers. For a real synthesis step, use AgentRearrange with a flow that ends at the synthesizer (e.g. "A, B, C -> Synthesizer") or SequentialWorkflow. If one agent fails, the request still returns 200. That agent’s turn has the role "<agent_name> (failed)" and content "Error: <message>", and the other agents’ turns are returned as usual. Check output for a (failed) role before using the results.

Best Practices

  • Design independent tasks that don’t require sequential dependencies
  • Use for tasks that can be parallelized effectively
  • Ensure agents have distinct, non-overlapping responsibilities
  • Ideal for time-sensitive analysis requiring multiple perspectives