Step 1: install and configure CrewAI
**Install the package.** CrewAI ships as a standalone package with optional tool integrations: `pip install crewai crewai-tools`. `crewai-tools` includes pre-built tools for web search (Serper, Tavily), web scraping, PDF reading, and code execution — most production crews use at least one of these. For a minimal install without the tools bundle: `pip install crewai`. Source: CrewAI installation docs.
**Configure your LLM.** CrewAI accepts any LangChain-compatible chat model. For Claude Sonnet 4.6: `from langchain_anthropic import ChatAnthropic; llm = ChatAnthropic(model='claude-sonnet-4-6', temperature=0.1, max_tokens=1500)`. For GPT-5.5: `from langchain_openai import ChatOpenAI; llm = ChatOpenAI(model='gpt-5.5', temperature=0.1)`. CrewAI also supports setting a default LLM via environment variable (`OPENAI_MODEL_NAME`) for OpenAI models, but explicit instantiation gives you more control over max_tokens and temperature per agent.
**Configure a cheaper manager LLM.** The manager agent in `Process.hierarchical` handles delegation and coordination — it doesn't need frontier model reasoning. Set a cheaper model for it: `manager_llm = ChatAnthropic(model='claude-haiku-4-5') # or ChatOpenAI(model='gpt-5.4-mini')`. Using Haiku 4.5 or GPT-5.4-mini for the manager saves $0.01-$0.02 per task on manager overhead vs using Sonnet or GPT-5.5. At 10K tasks/month, that is $100-$200/month in manager cost reduction. See pricing at Anthropic and OpenAI.
**Set environment variables.** CrewAI tools often require their own API keys: `SERPER_API_KEY` for SerperDev web search, `TAVILY_API_KEY` for Tavily search, `OPENAI_API_KEY` if using OpenAI embeddings for memory. Set these in your shell or `.env` file and load with `python-dotenv`: `from dotenv import load_dotenv; load_dotenv()`. For production deployments, use a secrets manager — never hardcode keys in source files.
**Verify the setup with a minimal crew.** `from crewai import Agent, Task, Crew; agent = Agent(role='Tester', goal='Say hello', backstory='A test agent.', llm=llm); task = Task(description='Say hello world.', expected_output='The string hello world', agent=agent); crew = Crew(agents=[agent], tasks=[task]); result = crew.kickoff()`. If you see the output, your LLM integration is working. If you see an API authentication error, your keys are missing. If you see a model-not-found error, check the model name spelling. Source: CrewAI quickstart.
**CrewAI vs LangGraph: choose based on abstraction level.** CrewAI is the right choice when: (1) your agents can be cleanly described by roles and goals (Researcher, Writer, Editor), (2) you want a simpler API with less boilerplate, (3) your workflow is primarily sequential or simple hierarchical. LangGraph is better when: (1) you need fine-grained control over state structure, (2) you need non-standard routing logic (conditional loops, parallel branches), (3) you need production-grade persistence and streaming from day one. Most teams start with CrewAI for speed and migrate to LangGraph when they need the extra control. For the LangGraph equivalent, see our LangGraph tutorial.