Python framework for orchestrating role-playing, autonomous AI agents. Agents collaborate via sequential or hierarchical processes to complete complex tasks. Built from scratch — independent of LangChain. Two core primitives: Crews (autonomous multi-agent collaboration) and Flows (event-driven, precise orchestration).
pip install crewaiVerified import paths — ran on the pinned version, not inferred.
Minimal two-agent crew with sequential process
Use Python 3.10, 3.11, or 3.12. Python 3.13 is supported but 3.14 is not yet.
Always specify expected_output in every Task definition, even if just a short description string.
pip install crewai-tools (or pip install 'crewai-tools[mcp]' for MCP support)
Use 'crewai create crew <name>' CLI command to scaffold the correct project structure with YAML configs.
Install from PyPI: pip install crewai-tools. Do not use the archived GitHub repo directly.
Use models with strong tool-call support: GPT-4o, Claude 3.5+, Gemini 2.0+, or Qwen3-72B+ for reliable agentic behavior.
Install Visual Studio Build Tools with the 'Desktop development with C++' workload before pip install crewai.
await crew.kickoff_async(inputs={...}) in async contexts.Use LLM(model='anthropic/claude-sonnet-4-5', api_key=...) or set the MODEL env var to 'provider/model-name'.
If using OpenAI, ensure your `OPENAI_API_KEY` is set as an environment variable or in a `.env` file. If using another LLM (e.g., Groq, Ollama, Google Generative AI), explicitly pass the `llm` parameter to your agents and crew. You might still need to set a dummy `OPENAI_API_KEY="sk-dummy"` in your `.env` file to bypass initial validation if the error persists.
Install `tiktoken` explicitly. It's often beneficial to install it along with the `crewai[embeddings]` or `crewai[tools]` extras to ensure all related dependencies are met: `pip install 'crewai[embeddings]'` or `pip install tiktoken`.
Review your agent and task definitions, especially if loading from YAML files. Ensure that where dictionaries are expected (e.g., for agent configurations), you are providing a dictionary-like structure and not a list. Check for incorrect indentation or syntax in your YAML.
Install the `crewai` package using pip in your active Python environment: `pip install crewai`.
Increase the `max_iter` and/or `max_execution_time` parameters when initializing your agent. For example, `Agent(..., max_iter=25, max_execution_time=120)`. If the problem persists, consider using a more powerful LLM or breaking down the task into simpler, more manageable sub-tasks.