CrewAI — Quick reference

Code-first Python framework for teams of role-playing AI agents that collaborate on a task.

free + open-source (MIT)  The framework is free — you only pay your own LLM provider for the tokens agents use. Needs Python 3.10+. CrewAI is model-agnostic (bring your own key) and built from scratch, independent of LangChain.

Install & run

CommandWhat it does
pip install crewaiInstall the open-source framework. Nothing to sign up for.
crewai create crew my_first_crewScaffold a whole runnable project folder — a researcher + writer agent and the config that wires them, generated not hand-typed.
crewai runRun from inside the project folder. Set your LLM key in .env first or the run fails to reach a model.
After create, open the generated .env and add your LLM API key (OpenAI, Anthropic, a local model — your choice).

Core building blocks

Agent
A role-playing worker
Defined in config/agents.yaml by three plain-English fields: role, goal, backstory. Can be given tools.
Task
A unit of work
Defined in config/tasks.yaml with a description and an expected output, assigned to one agent. Tasks are the work; agents are the workers.
Crew
The assembled team
Assembled in crew.py: it imports the YAML and binds agents + tasks into a Crew that collaborates. Autonomous — agents decide how to hand off.
Flow
Structured control
CrewAI's second paradigm: deterministic, event-driven — explicit steps, branching, ordering. Use when the process must be repeatable.

Build your first crew

  1. Scaffold: pip install crewai then crewai create crew my_first_crew.
  2. Add your key to the generated .env.
  3. Edit who the agents are in config/agents.yaml (role / goal / backstory).
  4. Edit what they do in config/tasks.yaml (description / expected output).
  5. Run: crewai run — watch the researcher reason, hand off to the writer, and print a finished report.
Project layout
my_first_crew/
  .env              # your LLM API key
  config/
    agents.yaml     # role · goal · backstory
    tasks.yaml      # description · expected output
  crew.py           # binds agents + tasks
You rarely touch the Python at first — edit the YAML. Small wording changes to a goal visibly steer the result; run again and compare.

Connect a model, tools & memory

LLM
Model-agnostic
Pick your provider/model via .env / config. Run the same crew on different providers or a local model — you supply the key and model name.
Tools
Turn talkers into doers
Attach a tool (e.g. a web-search or file-reading tool from CrewAI's tools library) to an agent in code. The agent calls it mid-task, then feeds the result onward.
Crews vs Flows
When to add structure
Crew = emergent collaboration (open-ended research-and-write). Flow = controlled, repeatable pipeline. They compose: a Flow step can itself run a Crew.

Deploy & monitor (CrewAI AMP)

Optional hosted platform on top of the open-source framework — adds a visual editor and one-screen deploys.

StepWhat happens
Push to GitHubIn AMP choose Deploy your crews from GitHub, select repo + branch — no servers to manage by hand.
Set env varsAdd the variables your crew needs (e.g. LLM API key); optionally tick Automatically deploy new commits to redeploy on each push.
Get endpointAfter build (first deploy can take several minutes / up to ~10 min) AMP shows a live URL + a Bearer Token to call your crew securely over HTTP.
ManageDashboard lists all crews with URL, token (with Reset), and Manage / Re-deploy / Delete controls.
Basic: free  Visual editor, AI copilot, GitHub integration, 50 workflow executions/month.
Enterprise: custom quote  50 hours of development/month, CrewAI-hosted or private infrastructure.
Either way you still bring your own LLM key — that usage is billed separately by your provider.

Tips

• Code-first, not from-scratch: one crewai create command gives you a real, owned multi-agent project you can read and run.
• Keep structure clear — who (agents.yaml), what (tasks.yaml), how (crew.py). Edit YAML, not Python, while iterating.
• A small report run typically costs a few cents in LLM tokens — the framework itself stays free.
• Reach for Crews when you want emergent collaboration; reach for Flows when you need a controlled, repeatable pipeline.
• Docs: docs.crewai.com · Home: crewai.com