Skip to main content

Introduction

CrewAI provides the ability to kickoff a crew asynchronously, allowing you to start the crew execution in a non-blocking manner. This feature is particularly useful when you want to run multiple crews concurrently or when you need to perform other tasks while the crew is executing. CrewAI offers two approaches for async execution:
MethodTypeDescription
akickoff()Native asyncTrue async/await throughout the entire execution chain
kickoff_async()Thread-basedWraps synchronous execution in asyncio.to_thread
For high-concurrency workloads, akickoff() is recommended as it uses native async for task execution, memory operations, and knowledge retrieval.

Native Async Execution with akickoff()

The akickoff() method provides true native async execution, using async/await throughout the entire execution chain including task execution, memory operations, and knowledge queries.

Method Signature

Code

Parameters

  • inputs (dict): A dictionary containing the input data required for the tasks.

Returns

  • CrewOutput: An object representing the result of the crew execution.

Example: Native Async Crew Execution

Code

Example: Multiple Native Async Crews

Run multiple crews concurrently using asyncio.gather() with native async:
Code

Example: Native Async for Multiple Inputs

Use akickoff_for_each() to execute your crew against multiple inputs concurrently with native async:
Code

Thread-Based Async with kickoff_async()

The kickoff_async() method provides async execution by wrapping the synchronous kickoff() in a thread. This is useful for simpler async integration or backward compatibility.

Method Signature

Code

Parameters

  • inputs (dict): A dictionary containing the input data required for the tasks.

Returns

  • CrewOutput: An object representing the result of the crew execution.

Example: Thread-Based Async Execution

Code

Example: Multiple Thread-Based Async Crews

Code

Async Streaming

Both async methods support streaming when stream=True is set on the crew:
Code

Potential Use Cases

  • Parallel Content Generation: Kickoff multiple independent crews asynchronously, each responsible for generating content on different topics. For example, one crew might research and draft an article on AI trends, while another crew generates social media posts about a new product launch.
  • Concurrent Market Research Tasks: Launch multiple crews asynchronously to conduct market research in parallel. One crew might analyze industry trends, while another examines competitor strategies, and yet another evaluates consumer sentiment.
  • Independent Travel Planning Modules: Execute separate crews to independently plan different aspects of a trip. One crew might handle flight options, another handles accommodation, and a third plans activities.

Choosing Between akickoff() and kickoff_async()

Featureakickoff()kickoff_async()
Execution modelNative async/awaitThread-based wrapper
Task executionAsync with aexecute_sync()Sync in thread pool
Memory operationsAsyncSync in thread pool
Knowledge retrievalAsyncSync in thread pool
Best forHigh-concurrency, I/O-bound workloadsSimple async integration
Streaming supportYesYes