CrewAI Tutorial (Python): running agents in parallel for beginners

By Cyprian AaronsUpdated 2026-04-21
crewairunning-agents-in-parallel-for-beginnerspython

This tutorial shows you how to run multiple CrewAI agents in parallel from Python and collect their results in one place. You need this when one task can be split into independent sub-tasks, like researching different vendors, comparing insurance policies, or pulling data from separate sources at the same time.

What You'll Need

  • Python 3.10+
  • crewai
  • crewai-tools if you want extra tools later
  • An OpenAI API key set as OPENAI_API_KEY
  • Basic familiarity with Agent, Task, and Crew
  • A terminal and a virtual environment

Install the package first:

pip install crewai

Step-by-Step

  1. Create a small project and define a shared LLM-backed agent setup. For beginners, keep the agents simple and make each one responsible for a single independent job.
import os
from crewai import Agent, Task, Crew, Process

os.environ["OPENAI_API_KEY"] = "your-openai-api-key"

researcher_1 = Agent(
    role="Market Researcher",
    goal="Find key facts about insurance claims automation",
    backstory="You are precise and concise.",
    verbose=True,
)

researcher_2 = Agent(
    role="Risk Analyst",
    goal="Find key facts about fraud detection in claims",
    backstory="You focus on practical business risk.",
    verbose=True,
)
  1. Define two tasks that do not depend on each other. Parallel execution only makes sense when the tasks can run independently, so avoid chaining outputs between them at this stage.
task_1 = Task(
    description="Summarize 3 important trends in insurance claims automation.",
    expected_output="A short bullet list with 3 trends.",
    agent=researcher_1,
)

task_2 = Task(
    description="Summarize 3 important trends in fraud detection for insurance claims.",
    expected_output="A short bullet list with 3 trends.",
    agent=researcher_2,
)
  1. Build the crew using Process.parallel. This tells CrewAI to execute the tasks concurrently instead of one after another.
crew = Crew(
    agents=[researcher_1, researcher_2],
    tasks=[task_1, task_2],
    process=Process.parallel,
    verbose=True,
)

result = crew.kickoff()
print(result)
  1. If you want cleaner output, capture each task result separately. In parallel mode, CrewAI still returns a combined result object, but you can also inspect task outputs directly after execution.
for task in crew.tasks:
    print("\n--- TASK OUTPUT ---")
    print(f"Task: {task.description}")
    print(f"Output: {task.output}")
  1. Add a simple wrapper so your script is easy to rerun. This keeps your code production-friendly and makes it easier to plug into an API or batch job later.
def main():
    crew = Crew(
        agents=[researcher_1, researcher_2],
        tasks=[task_1, task_2],
        process=Process.parallel,
        verbose=True,
    )
    result = crew.kickoff()
    print("\n=== FINAL RESULT ===")
    print(result)

if __name__ == "__main__":
    main()

Testing It

Run the script from your terminal and watch both agents produce output without waiting for one another. If parallel execution is working, you should see interleaved logs or at least both tasks complete in a single kickoff call.

Check that each task output is relevant to its own prompt and not mixed together. If one task blocks the other or results look empty, confirm that you used Process.parallel and that both tasks are truly independent.

If you want to validate behavior more strictly, add timestamps before and after crew.kickoff() and compare runtime against sequential execution. With real LLM calls, parallel runs should usually finish faster than running the same tasks one by one.

Next Steps

  • Add tools like web search or file access to each agent
  • Use structured outputs so downstream code can parse results reliably
  • Move from simple parallel tasks to a hybrid flow where some tasks run in sequence after the parallel phase

Keep learning

By Cyprian Aarons, AI Consultant at Topiax.

Want the complete 8-step roadmap?

Grab the free AI Agent Starter Kit — architecture templates, compliance checklists, and a 7-email deep-dive course.

Get the Starter Kit

Related Guides