Verifying with a minimal crew run
Why this matters
Before building complex multi-agent systems, you need to verify that crewai runs at all on your machine. A minimal crew is your smoke test: it confirms imports work, the LLM connection works, and the execution loop completes without hanging. This saves hours of debugging later.
Explanation
A minimal crew is the smallest working crewai system: one Agent, one Task, and one Crew that runs it. The agent is given a role and a simple instruction. The task tells the agent what to do. The crew orchestrates them and executes.
Mechanically: you instantiate an Agent with a role and goal, create a Task that assigns work to that agent, wrap both in a Crew, and call crew.kickoff(). The crew handles the LLM calls, agent execution, and task completion: you just watch it run.
Use this to: (1) verify your LLM API key works, (2) confirm crewai installed correctly, (3) see the execution flow in real time with verbose=True, and (4) understand the three core components before adding complexity.
Analogy
A minimal crew is like a recipe test: you make a single simple dish to check your oven works before attempting a seven-course meal. You're not building dinner; you're confirming your kitchen is operational.
Code
from crewai import Agent, Task, Crew, Process
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="gpt-4o-mini", api_key="your-api-key-here")
researcher = Agent(
role="Research Analyst",
goal="Find and summarize information",
backstory="You are an expert at gathering and organizing factual information.",
llm=llm,
max_iter=10,
verbose=True
)
research_task = Task(
description="What are the three most important Python features released in the last 2 years? Provide a brief summary.",
expected_output="A numbered list with three Python features and one sentence about each.",
agent=researcher
)
crew = Crew(
agents=[researcher],
tasks=[research_task],
process=Process.sequential,
verbose=True
)
result = crew.kickoff(inputs={"topic": "Python features"})
print("\n=== Final Result ===")
print(result) === Crew Execution Output === [Agent Starting Task] Research Analyst is working on: What are the three most important Python features released in the last 2 years? [Agent Reasoning] I need to research recent Python releases and identify significant features. Python 3.12 and 3.13 were released recently. Let me think about notable additions. [Agent Action] Calling LLM for research summary. [Task Complete] === Final Result === 1. PEP 701 – Syntactic formalization of f-strings (Python 3.12) – Allows nesting quotes and multiline expressions inside f-strings without escaping. 2. PEP 698 – Override decorator for type checkers (Python 3.12) – Explicitly marks methods as overrides, improving type safety in inheritance. 3. PEP 688 – Making the buffer protocol accessible in Python (Python 3.13) – Enables better interoperability with C extensions and memory-efficient data handling.
What just happened?
You created an Agent with a role and backstory, defined a Task with a description and expected output format, wrapped both in a Crew set to run sequentially, then called <code>kickoff()</code>. The crew sent the task description to the LLM (gpt-4o-mini) via the agent, the LLM generated a response, and the crew returned the result. The <code>verbose=True</code> logs showed each step. No actual research happened: the LLM generated a plausible answer based on its training data.
Common gotcha
Developers often forget to set max_iter=10 on the Agent. Without it, the agent defaults to 15 iterations, which can cause long execution times or unnecessary retries. In crewai 0.70.x, max_iter is not optional: always set it explicitly. Also, if your API key is invalid, the error happens at kickoff(), not at import time, so test early.
Error recovery
AuthenticationError: Incorrect API key providedTypeError: __init__() missing required argument 'agent'AttributeError: 'Crew' object has no attribute 'kickoff'RateLimitError: Rate limit exceededExperienced dev note
A minimal crew is your canary in the coal mine. Before you spend a week designing a 10-agent system with memory, databases, and tools, run a one-liner minimal crew first. It takes 30 seconds and catches 90% of configuration problems. Senior teams always do this. Also: the verbose=True output is noisy but invaluable: it shows you exactly where the crew is stuck if something goes wrong. Keep it on during development, turn it off in production.
Check your understanding
Why does setting max_iter=10 matter for a minimal crew that only has one simple task, and what happens if you remove it?
Show answer hint
A correct answer explains that max_iter controls how many times the agent can retry or loop to solve the task. Even a simple task might take multiple LLM calls (reasoning, reflection, correction). Without setting it, the agent uses the default (15 in 0.70.x), which wastes time and API calls for a test. You should show understanding that it's about controlling agent iterations, not task count.