agent.astart() from an async app; the crew kickoff runs natively on the event loop without thread offload.
Quick Start
How It Works
Non-blocking startup
Config loading, adapter setup, and workflow preparation run in a worker thread viaasyncio.to_thread, so a slow disk read or heavy adapter import never stalls the event loop.
The _aload_config and _aprepare_for_run helpers wrap the blocking open() / yaml.safe_load / adapter setup calls, keeping the loop free to serve other requests while startup work runs off-thread.
Sync/Async Parity: As of PR #1870, sync and async kickoff paths share the same prep logic (AutoGen version selection, AgentOps init, cli_backend validation), so behavior is identical between
generate_crew_and_kickoff() and agenerate_crew_and_kickoff().Extended in PR #2738: Config validation, merge, and dump logic live in a single
_build_yaml_workflow builder shared by both paths, so sync and async behavior can no longer drift apart.What’s actually async
| Adapter | Async path | Notes |
|---|---|---|
praisonai (praisonaiagents) | Native — AgentTeam.astart() | True cooperative async |
crewai | Thread offload (default fallback) | Until CrewAI exposes async |
autogen / ag2 | Thread offload (default fallback) | Adapter-specific implementation |
Workflow mode
YAML files withprocess: workflow also run natively async via YAMLWorkflowParser + workflow.astart() — no extra configuration needed.
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
agent_file | str | Required | Path to the agent YAML file |
framework | str | None | Framework to use (auto-detected if None) |
tools | list | None | Additional tools to make available |
agent_yaml | str | None | Direct YAML content as string |
cli_config | dict | None | CLI configuration overrides |
Common Patterns
FastAPI Background Task
Concurrent Crew Execution
Best Practices
Cancellation and timeouts propagate
Cancellation and timeouts propagate
Under native async,
asyncio.CancelledError and asyncio.wait_for now actually cancel SDK work instead of being trapped behind a worker thread:Use asyncio.gather for concurrent crews
Use asyncio.gather for concurrent crews
When running multiple crews, use
asyncio.gather for parallel execution:Framework detection works transparently
Framework detection works transparently
All supported frameworks work with async execution — praisonai-native uses true async, others fall back to thread offload automatically:
Handle errors gracefully in async contexts
Handle errors gracefully in async contexts
Wrap async crew execution in try-catch blocks:
Related
YAML Template Variables
Use placeholders safely alongside JSON literals
Framework Adapter Plugins
Custom framework adapters with async support

