AI Code Reviewer with CrewAI
Build a two-agent AI crew that reviews Python code and generates targeted tests.
Introduction
30 Second Summary
Code reviews catch bugs before they reach users. They also take time and depend on who is available to look at your work.
In this project, you will build a multi-agent AI pipeline using CrewAI. You point it at any Python file and get back both a detailed code review and a set of unit tests that target the exact issues found.
What You'll Build
You run one command, drop in a Python file, and get back a professional code review saved as markdown plus a complete test file targeting the exact weaknesses found.
By the end of this project, you'll have:
- A Code Quality Reviewer agent that reads your Python files and produces a structured review identifying bugs, missing error handling, and style issues you can act on.
- A Test Engineer agent that receives the reviewer's findings as context and generates pytest-compatible tests targeting the identified weaknesses.
- A sequential crew that chains both agents so the test output is directly informed by the review analysis, producing better results than a single prompt could.
- Secret Mission: Add a Security Auditor as a third agent that scans for common vulnerabilities and feeds its findings into test generation.
Do I need to know Python?
This project requires basic Python reading ability (understanding functions, variables, and control flow). You also need a Google account to get a free Gemini API key.
Before We Start
Before we dive in, let's lock in what you're about to build and why it matters.
Install uv, Python 3.13, and CrewAI CLI
CrewAI requires a Python version between 3.10 and 3.13 inclusive. Your system has Python 3.14 installed, which is incompatible.
In this step, you will install uv (a fast Python package manager), use it to get Python 3.13, and then install the CrewAI CLI pinned to that version.
In this step, get ready to:
- Install uv, Astral's package manager that CrewAI uses for dependency management.
- Install Python 3.13 via uv so you have a compatible runtime.
- Install the CrewAI CLI as a global tool and verify it works.
Install uv
uv is Astral's ultra-fast Python package manager. CrewAI uses it under the hood to manage project dependencies and virtual environments.
- Open your terminal by pressing Cmd+Space (macOS) or the Windows key (Windows), typing Terminal (macOS) or PowerShell (Windows), and pressing Enter.
- Install uv by running this command:
macOS
curl -LsSf https://astral.sh/uv/install.sh | sh
Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
What does this command do?
This downloads and runs the official uv installer from Astral. It places the uv binary on your PATH so you can use it from any terminal session.
- Close and reopen your terminal so the PATH changes take effect.
- Confirm uv is installed by running:
uv --version
✔️ I see a version number
uv is ready to go. You will see something like uv 0.x.x followed by a build hash. The exact version does not matter for this project.
ⓧ Command not found
Your terminal cannot find the uv binary. Try these fixes:
- Make sure you closed and reopened your terminal after running the installer.
- On macOS/Linux, try opening a completely new terminal window rather than a new tab.
- On Windows, open a new PowerShell window (the installer modifies the PATH for new sessions only).
Install Python 3.13 via uv
Your system Python 3.14 is too new for CrewAI. uv can install and manage multiple Python versions side by side without touching your system install.
- Install Python 3.13 by running:
uv python install 3.13
- Confirm it installed correctly by running:
uv python list
You should see 3.13 listed among the available Python versions.
Why not just use Python 3.14?
CrewAI explicitly requires Python >=3.10 and <3.14. If you try to install CrewAI against Python 3.14, the installation will fail with a dependency resolution error.
uv manages Python versions in an isolated way. Your system Python stays untouched, and CrewAI gets the compatible version it needs.
Seeing an error during Python install?
Make sure you have a working internet connection. uv downloads Python from the official CPython standalone builds. If you see a permissions error on macOS/Linux, try running the command without sudo. uv installs to your user directory.
Help me troubleshoot this Python installation error
Install the CrewAI CLI and verify it works
The CrewAI CLI is the command-line tool you will use to create, install, and run your AI crew. You need to pin it to Python 3.13 so it uses the compatible runtime.
- Install the CrewAI CLI as a global tool pinned to Python 3.13 by running:
uv tool install --python 3.13 crewai
What does this command do?
The uv tool install command installs a Python package as a globally available CLI tool. The --python 3.13 flag tells uv to create the tool's isolated environment using Python 3.13 instead of your system Python 3.14.
After this, the crewai command is available from any terminal session.
Before you run the verify command, what do you think you will see if the install succeeded?
- Verify the installation by running:
crewai version
You should see the CrewAI version number printed in your terminal. The exact version does not matter as long as a version is displayed.
Command not found after installing?
- Close and reopen your terminal. uv adds the tool to your PATH, but existing sessions may not pick it up.
- On Windows, open a fresh PowerShell window.
- If you still get an error, run uv tool list to confirm crewai appears in the installed tools.
Help me fix my CrewAI CLI installation
Your toolchain is ready. Next up, you will scaffold a CrewAI project and see agents collaborating in real time.
Scaffold Your Crew and See Agents in Action
You have the CrewAI CLI ready to go, but no project to work with yet. Before building custom code review agents, you need a working project skeleton that proves your Gemini API connection works.
In this step, you will scaffold a brand new CrewAI project, install its dependencies, and run the default crew. This gives you an early visible win: real AI agents collaborating in your terminal.
In this step, get ready to:
- Scaffold a new CrewAI crew project with Gemini configured as the LLM provider.
- Install the project's virtual environment and dependencies.
- Run the default research crew and see agents produce a markdown report.
Create your crew project
The CrewAI CLI includes a project generator that creates a complete JSON-first project structure with agent definitions, task configuration, and environment files. It also walks you through an interactive setup to wire up your LLM provider.
- Scaffold your new crew project by running this command:
crewai create crew code_quality_crew
What happens when you run this?
The CLI creates a new code_quality_crew/ folder on your Desktop with a JSON-first project layout. It also launches an interactive setup wizard that asks you to choose an LLM provider and model.
The CLI will prompt you with a series of questions. Answer each one as follows:
- When prompted for LLM Provider, select Google (Gemini).
- When prompted for Model, enter gemini-2.5-flash.
- When prompted for your API Key, paste the Gemini API key you have on hand.
Where does my API key go?
The CLI stores your key in a .env file inside the project folder. This keeps your secret out of the code files and makes it easy to swap later.
- Confirm the project was created by running:
ls code_quality_crew
You should see files including crew.jsonc, an agents/ folder, a .env file, and several other directories like knowledge/, skills/, and tools/.
Don't see the folder?
Make sure you ran the command from your Desktop directory. If the command failed with a Python version error, confirm you installed the CrewAI CLI pinned to Python 3.13 in the previous step.
help me troubleshoot why crewai create crew failed
Install dependencies and run the default crew
The scaffold gives you a project structure, but the virtual environment and Python packages still need to be installed before you can run anything.
- Move into the project directory by running:
cd code_quality_crew
- Set up the virtual environment and install all dependencies by running:
crewai install
You should see output confirming packages were installed and the environment is ready.
Seeing install errors?
If you see a dependency resolution error, make sure your pyproject.toml specifies a Python version below 3.14. The CrewAI scaffold should set this automatically.
help me fix crewai install errors
Now for the exciting part. Before you run the default crew, think about what you expect to happen. The project contains a pre-built research crew with two agents: a researcher and an analyst.
- What do you think will happen when two AI agents collaborate on a research task? Run the default crew to find out:
crewai run
Watch your terminal closely. You will see each agent announce its task, show its reasoning (verbose mode is on by default), and pass results to the next agent.
What is happening in the terminal?
The default crew runs sequentially. The researcher agent gathers information about a topic first. Then the analyst agent receives that research as context and writes a polished markdown report.
This is multi-agent orchestration in action. Each agent has a specific role, and their outputs chain together to produce a better result than either could alone.
This may take a minute or two
The agents make multiple calls to the Gemini API. On the free tier, there may be brief pauses between calls as rate limits are respected. Let it finish completely before moving on.
Seeing an API key error?
Open the .env file inside code_quality_crew/ and check that GEMINI_API_KEY is set to your actual key. If you mistyped it during setup, replace the value and re-run crewai run.
help me fix my Gemini API key in CrewAI
Check the generated output
The default crew writes its final report to a file, so you can inspect the full output beyond what scrolled past in the terminal.
- View the generated report by running:
cat output/report.md
You should see a structured markdown report with sections like an executive summary, key insights, and recommendations. This confirms your Gemini connection and CrewAI setup work end-to-end.
What does this prove?
Seeing this report means three things are working: your Python environment is correctly configured, your Gemini API key is valid, and CrewAI can orchestrate multiple agents passing context between them. Everything you need for the custom code review crew you will build next.
No output/report.md file?
If crewai run completed but you do not see the file, check for error messages in the terminal output. A common cause is a rate-limit error from the Gemini free tier. Wait a minute and try crewai run again.
help me figure out why crewai run didn't produce output/report.md
✔️ Awesome, I've got everything!
Great. Double check you have saved your .env file and that output/report.md exists in your project.
ⓧ I'd like to double check the full code
The only file you need to verify at this point is .env. Open it and confirm it contains your API key in this format:
GEMINI_API_KEY=your-gemini-api-key-here
Replace your-gemini-api-key-here with your actual Gemini API key. The rest of the project files were generated by the scaffold and do not need editing yet.
Your environment is proven and your first multi-agent crew has run successfully. Next up, you will replace the default research agents with a specialized Code Quality Reviewer that reads actual Python files.
Build the Code Quality Reviewer
Your CrewAI setup is confirmed working. The default crew demonstrated that agents can collaborate and produce output using your Gemini API key.
The default crew researches generic topics, though. It cannot read your Python files or identify real bugs. In this step, you will replace the default crew with a specialized Code Quality Reviewer agent that reads actual source code and produces a structured review of issues it finds.
In this step, get ready to:
- Create a sample Python file with intentional bugs for the reviewer to analyze.
- Configure a Code Quality Reviewer agent with file-reading capabilities.
- Run the crew and verify it produces a structured code review.
Create sample code with intentional bugs
Your Code Quality Reviewer needs something to analyze. You will create a Python file with several deliberate issues: missing error handling, division-by-zero risks, and functions that silently return nothing on unexpected input.
- Create the sample_code/ directory inside your project by running this command:
mkdir sample_code
- Confirm the directory exists by running:
ls
You should see sample_code listed alongside agents/, crew.jsonc, and the other project files.
- In VS Code, create a new file called calculator.py inside the sample_code/ folder.
- Paste the following code into sample_code/calculator.py:
"""A simple calculator module with some issues for the crew to find."""
def add(a, b):
return a + b
def subtract(a, b):
return a - b
def multiply(a, b):
return a * b
def divide(a, b):
return a / b
def calculate_average(numbers):
total = 0
for num in numbers:
total += num
return total / len(numbers)
What bugs are hiding here?
- divide() has no check for b == 0. Passing zero crashes the program with a ZeroDivisionError.
- calculate_average() crashes on an empty list because len(numbers) would be zero.
- Now add the remaining functions below the calculate_average function in the same file:
def parse_and_calculate(expression):
parts = expression.split()
a = int(parts[0])
operator = parts[1]
b = int(parts[2])
if operator == "+":
return add(a, b)
elif operator == "-":
return subtract(a, b)
elif operator == "*":
return multiply(a, b)
elif operator == "/":
return divide(a, b)
def batch_calculate(expressions):
results = []
for expr in expressions:
result = parse_and_calculate(expr)
results.append(result)
return results
What else is wrong?
- parse_and_calculate() does no input validation. A malformed string crashes with an IndexError or ValueError.
- If the operator does not match any branch, the function silently returns None. That None propagates into batch_calculate() results with no warning.
- Save sample_code/calculator.py.
✔️ Awesome, I've got everything!
Great. Double check you have saved the file.
ⓧ I'd like to double check the full code
Scroll up and confirm your file contains both chunks in order: the docstring and basic arithmetic functions (add, subtract, multiply, divide, calculate_average) followed by parse_and_calculate and batch_calculate. Seven functions total, plus the module docstring at the top.
Configure the Code Quality Reviewer agent
The scaffolded project came with a default researcher.jsonc agent. You will replace it with a specialized Code Quality Reviewer that uses FileReadTool to access local files.
- Delete the default agent file by running:
rm agents/researcher.jsonc
- Create a new file called code_reviewer.jsonc inside the agents/ folder.
- Paste the following configuration into agents/code_reviewer.jsonc:
{
"role": "Senior Python Code Reviewer",
"goal": "Thoroughly review Python source code to identify bugs, edge cases, style issues, and improvement opportunities. Provide actionable feedback.",
"backstory": "You are a senior Python developer with 10+ years of experience conducting code reviews. You have a keen eye for common pitfalls like missing error handling, division by zero, empty collection edge cases, and unclear naming. You always provide specific, actionable suggestions with line references.",
"llm": "gemini/gemini-2.5-flash",
"tools": ["FileReadTool"],
"verbose": true,
"allow_delegation": false
}
What does this configuration do?
- role and backstory give the agent a persona. The more specific the backstory, the better the LLM performs at the task.
- tools grants the agent access to FileReadTool. This built-in tool lets the agent read files from disk instead of requiring you to paste code into the prompt.
- allow_delegation is false because this agent should do its own work, not hand it off to another agent.
- Confirm the agent file is in place by running:
ls agents/
You should see code_reviewer.jsonc as the only file listed.
Still seeing the old researcher file?
Make sure you ran rm agents/researcher.jsonc from inside the code_quality_crew/ directory. If you are in a different directory, the delete command will not find the file.
Help me fix this
Now you need to tell the crew what task the reviewer should perform.
- Open crew.jsonc in VS Code and replace its entire contents with the following:
{
"name": "Code Quality Crew",
"agents": ["code_reviewer"],
"tasks": [
{
"name": "code_review_task",
"description": "Read the file at sample_code/calculator.py using the FileReadTool. Perform a thorough code review identifying: 1) Bugs and potential runtime errors, 2) Missing error handling and edge cases, 3) Code style and naming issues, 4) Specific improvement suggestions. Format your review with clear sections and reference specific functions.",
"expected_output": "A structured code review in markdown format with sections for Bugs, Edge Cases, Style Issues, and Recommendations. Each item should reference the specific function and describe the issue clearly.",
"agent": "code_reviewer",
"output_file": "output/code_review.md"
}
],
"process": "sequential",
"verbose": true,
"memory": true
}
What changed from the default?
- agents now references code_reviewer instead of the old researcher. CrewAI resolves this name to agents/code_reviewer.jsonc.
- The task description tells the agent exactly which file to read and what to look for.
- output_file saves the review to output/code_review.md so you can reference it later.
- Save crew.jsonc.
✔️ Awesome, I've got everything!
Great. Make sure both files are saved before running the crew.
ⓧ I'd like to double check the full code
Your agents/code_reviewer.jsonc should contain:
{
"role": "Senior Python Code Reviewer",
"goal": "Thoroughly review Python source code to identify bugs, edge cases, style issues, and improvement opportunities. Provide actionable feedback.",
"backstory": "You are a senior Python developer with 10+ years of experience conducting code reviews. You have a keen eye for common pitfalls like missing error handling, division by zero, empty collection edge cases, and unclear naming. You always provide specific, actionable suggestions with line references.",
"llm": "gemini/gemini-2.5-flash",
"tools": ["FileReadTool"],
"verbose": true,
"allow_delegation": false
}
Your crew.jsonc should contain:
{
"name": "Code Quality Crew",
"agents": ["code_reviewer"],
"tasks": [
{
"name": "code_review_task",
"description": "Read the file at sample_code/calculator.py using the FileReadTool. Perform a thorough code review identifying: 1) Bugs and potential runtime errors, 2) Missing error handling and edge cases, 3) Code style and naming issues, 4) Specific improvement suggestions. Format your review with clear sections and reference specific functions.",
"expected_output": "A structured code review in markdown format with sections for Bugs, Edge Cases, Style Issues, and Recommendations. Each item should reference the specific function and describe the issue clearly.",
"agent": "code_reviewer",
"output_file": "output/code_review.md"
}
],
"process": "sequential",
"verbose": true,
"memory": true
}
Run the crew and verify the code review
Everything is wired up. The agent knows its role, has access to FileReadTool, and the task points it at your sample file.
- Before you run the crew, think about this: do you expect the agent to find all the bugs you know about, or might it miss some?
- Run the crew by executing:
crewai run
The terminal shows the agent's reasoning in real time (verbose mode is on). You will see it use FileReadTool to read sample_code/calculator.py, then produce its review. This takes 30-60 seconds depending on API response time.
What should I see?
The terminal output shows the Code Reviewer agent thinking through the file, calling FileReadTool, and producing a structured markdown review. At the end, CrewAI writes the output to output/code_review.md.
The review should mention the division-by-zero risk in divide(), the empty-list crash in calculate_average(), and the missing input validation in parse_and_calculate(). The exact wording varies between runs because LLM output is non-deterministic.
- Open the generated review file by running:
cat output/code_review.md
You should see a structured markdown document with sections identifying the bugs and edge cases in your calculator module.
Seeing a rate limit or API error?
The Gemini free tier allows 10 requests per minute. If you ran the default crew recently, you may have hit the limit. Wait 60 seconds and run crewai run again.
If you see a file-not-found error, make sure sample_code/calculator.py exists. Run ls sample_code/ to confirm.
Help me troubleshoot this error
Your Code Quality Reviewer is working. It reads real Python files and produces actionable feedback. But a code review alone tells you what is wrong without proving anything is fixed. Next up, you will add a Test Engineer agent that turns those findings into runnable tests.
Add the Test Engineer with Context-Passing
Your Code Reviewer agent produces a structured analysis of bugs and issues in your Python file. But a review alone only tells you what is wrong. It does not prove that the issues are real, and it does not give you a safety net for future changes.
In this step, you will add a second agent: the Test Engineer. It receives the reviewer's findings as context and writes targeted pytest unit tests for every issue identified. This is where multi-agent collaboration proves its value over a single-prompt approach.
In this step, get ready to:
- Create the Test Engineer agent with FileReadTool access.
- Wire the test generation task into the crew with context-passing from the reviewer.
- Run the full crew and verify both output files are generated.
Create the Test Engineer agent
The Test Engineer is a specialist that reads source code and writes pytest tests targeting specific weaknesses. Unlike a generic test generator, it will receive the Code Reviewer's output as context so it knows exactly which issues to target.
- Create a new file called test_engineer.jsonc inside the agents/ folder by pasting in the following configuration:
{
"role": "Senior Python Test Engineer",
"goal": "Write comprehensive pytest unit tests that specifically target bugs, edge cases, and weaknesses identified in code reviews. Every identified issue should have at least one test proving it exists.",
"backstory": "You are a test engineering specialist who writes targeted, meaningful tests. You do not write generic tests. Instead, you focus on the exact issues and edge cases identified by code reviewers. Your tests use pytest conventions, include descriptive names, and cover both the happy path and failure modes.",
"llm": "gemini/gemini-2.5-flash",
"tools": ["FileReadTool"],
"verbose": true,
"allow_delegation": false
}
What does this configuration do?
- role and goal tell the LLM to focus on writing tests that specifically target identified issues, not generic boilerplate tests.
- backstory reinforces that the agent should use pytest conventions and cover both happy paths and failure modes.
- tools gives the agent FileReadTool so it can read the source file directly and write tests against the actual code.
- allow_delegation is set to false so the agent focuses solely on test writing and does not hand off work.
- Save agents/test_engineer.jsonc.
- Confirm both agent files exist by running:
ls agents/
You should see both code_reviewer.jsonc and test_engineer.jsonc listed.
Only see one file?
- Make sure you saved the new file inside the agents/ folder, not in the project root.
- Check that the filename is exactly test_engineer.jsonc (no typos, no extra extension).
Why isn't my test_engineer.jsonc file showing up in the agents folder?
✔️ Awesome, I've got everything!
Great. Make sure you have saved the file before moving on.
ⓧ I'd like to double check the full code
{
"role": "Senior Python Test Engineer",
"goal": "Write comprehensive pytest unit tests that specifically target bugs, edge cases, and weaknesses identified in code reviews. Every identified issue should have at least one test proving it exists.",
"backstory": "You are a test engineering specialist who writes targeted, meaningful tests. You do not write generic tests. Instead, you focus on the exact issues and edge cases identified by code reviewers. Your tests use pytest conventions, include descriptive names, and cover both the happy path and failure modes.",
"llm": "gemini/gemini-2.5-flash",
"tools": ["FileReadTool"],
"verbose": true,
"allow_delegation": false
}
Wire the Test Engineer into the crew
The agent file alone does not make the Test Engineer part of your crew. You need to register it in crew.jsonc and give it a task that uses the reviewer's output as context.
- In crew.jsonc, find the agents array near the top of the file.
- Find this line:
"agents": ["code_reviewer"],
- Replace it with this line to register the new agent:
"agents": ["code_reviewer", "test_engineer"],
- Now find the closing } of the code_review_task object inside the tasks array.
- Add a comma after that closing }, then paste in this second task:
{
"name": "test_generation_task",
"description": "Based on the code review findings, read the source file at sample_code/calculator.py using the FileReadTool and write pytest unit tests that specifically target each identified issue. Include tests for: division by zero, empty lists, invalid input, missing operators, and any other edge cases from the review.",
"expected_output": "A complete Python test file using pytest that can be run directly. Include imports, test functions with descriptive names, and assertions that verify both correct behavior and proper error handling.",
"agent": "test_engineer",
"context": ["code_review_task"],
"output_file": "output/test_calculator.py"
}
How does context-passing work?
The "context": ["code_review_task"] field is the key line. It tells CrewAI to wait for the code_review_task to finish, then pass its full output as context into the test generation task.
This means the Test Engineer sees every bug and issue the reviewer found. It can then write tests that specifically target those weaknesses instead of guessing what to test.
- Save crew.jsonc.
Seeing a JSON syntax error later?
- Make sure there is a comma between the first task's closing } and the second task's opening {.
- Check that "agent": "test_engineer" matches the filename test_engineer.jsonc exactly (no capital letters, no spaces).
- Verify the agents array at the top now includes "test_engineer".
Help me fix a JSON syntax error in my crew.jsonc after adding the test_generation_task.
✔️ Awesome, I've got everything!
Great. Double check that you saved crew.jsonc before running the crew.
ⓧ I'd like to double check the full code
{
"name": "Code Quality Crew",
"agents": ["code_reviewer", "test_engineer"],
"tasks": [
{
"name": "code_review_task",
"description": "Read the file at sample_code/calculator.py using the FileReadTool. Perform a thorough code review identifying: 1) Bugs and potential runtime errors, 2) Missing error handling and edge cases, 3) Code style and naming issues, 4) Specific improvement suggestions. Format your review with clear sections and reference specific functions.",
"expected_output": "A structured code review in markdown format with sections for Bugs, Edge Cases, Style Issues, and Recommendations. Each item should reference the specific function and describe the issue clearly.",
"agent": "code_reviewer",
"output_file": "output/code_review.md"
},
{
"name": "test_generation_task",
"description": "Based on the code review findings, read the source file at sample_code/calculator.py using the FileReadTool and write pytest unit tests that specifically target each identified issue. Include tests for: division by zero, empty lists, invalid input, missing operators, and any other edge cases from the review.",
"expected_output": "A complete Python test file using pytest that can be run directly. Include imports, test functions with descriptive names, and assertions that verify both correct behavior and proper error handling.",
"agent": "test_engineer",
"context": ["code_review_task"],
"output_file": "output/test_calculator.py"
}
],
"process": "sequential",
"verbose": true,
"memory": true
}
Run the crew and verify both outputs
Both agents are now configured and wired together. Time to run the crew and see multi-agent collaboration in action.
- Before you run, predict: will both agents run, or just the Test Engineer? What order do you expect?
- Run the crew by executing:
crewai run
Watch the terminal output closely. You will see the Code Reviewer agent run first, reading sample_code/calculator.py and producing its review. Then the Test Engineer kicks in, receiving the review as context and writing targeted tests.
What should I see?
Because verbose is set to true, you will see each agent's reasoning process printed in the terminal. The Code Reviewer runs first and finishes with its review output. Then the Test Engineer starts, and you can see it referencing the reviewer's findings in its reasoning.
The crew may take 30-60 seconds to complete depending on API response times.
- Once the crew finishes, check the output files by running:
ls output/
You should see both code_review.md and test_calculator.py listed.
- Open output/test_calculator.py to inspect the generated tests.
You should see pytest test functions with descriptive names targeting the exact issues from the review: division by zero in divide(), empty list handling in calculate_average(), and invalid input in parse_and_calculate().
Why is this better than a single prompt?
If you asked one LLM to do both review and testing in a single prompt, it would split its attention and produce shallow results for both. With two specialized agents, each one focuses entirely on its task.
The Test Engineer does not guess what to test. It reads the reviewer's specific findings and writes tests that prove those exact issues exist. This is the power of context-passing in a sequential crew.
Crew fails or only one output appears?
- If you see a rate limit error, wait 60 seconds and run crewai run again. The Gemini free tier allows 10 requests per minute.
- If only code_review.md appears, check that "agent": "test_engineer" in your task matches the filename test_engineer.jsonc exactly.
- If neither file appears, verify your GEMINI_API_KEY in .env is still valid.
My CrewAI crew is not producing both output files after adding the test engineer. Help me debug.
You now have a two-agent crew where one agent's output directly informs the next. The Code Reviewer finds the problems, and the Test Engineer proves they exist. In the Secret Mission, you will add a third agent to scan for security vulnerabilities and feed those findings into the test generation too.
Secret mission
Add a Security Auditor
Your crew catches bugs and writes tests. But what about security vulnerabilities? Real code review pipelines include security scanning too. Can you add a third agent that identifies injection attacks and unsafe deserialization, then feeds its findings into the test engineer?
Clean Up Your Resources
Clean Up Your Resources
This project runs entirely locally and uses the Gemini API free tier, so there are no ongoing costs. Decide whether to keep your resources installed, pause them to come back later, or delete them entirely.
Resources you used:
- The code_quality_crew project folder on your Desktop.
- CrewAI CLI (installed as a global tool via uv).
- Python 3.13 (installed via uv).
- uv (Astral's package manager).
- Gemini API key (stored in Google AI Studio).
Keep everything running
No action needed. Choose this if you plan to keep experimenting with your crew, adding more agents, or pointing it at different Python files.
- Your code_quality_crew folder stays on your Desktop.
- uv, Python 3.13, and the CrewAI CLI remain installed and available from any terminal.
- Your Gemini API key stays active in Google AI Studio.
Pause - I'll come back to this later
Free up terminal clutter while keeping your files intact. Since everything runs locally, there is nothing consuming resources while idle.
- Close any terminal windows open in the code_quality_crew directory.
- Close the project in VS Code.
- When you return, open a terminal, navigate back to the code_quality_crew folder, and run crewai run to pick up where you left off.
Delete - I don't want to use this again
Remove all project resources and installed tools to start fresh.
- Delete the project folder by running this command:
macOS
cd ~/Desktop
rm -rf code_quality_crew
Windows
cd ~\Desktop
Remove-Item -Recurse -Force code_quality_crew
- Uninstall the CrewAI CLI by running:
uv tool uninstall crewai
- Remove the managed Python 3.13 installation by running:
uv python uninstall 3.13
- Remove uv itself and its stored data by running:
macOS
uv cache clean
rm -r "$(uv python dir)"
rm -r "$(uv tool dir)"
rm ~/.local/bin/uv ~/.local/bin/uvx
Windows
uv cache clean
Remove-Item -Recurse -Force "$(uv python dir)"
Remove-Item -Recurse -Force "$(uv tool dir)"
Remove-Item $HOME\.local\bin\uv.exe
Remove-Item $HOME\.local\bin\uvx.exe
Remove-Item $HOME\.local\bin\uvw.exe
- Delete your Gemini API key from Google AI Studio. Go to aistudio.google.com, click your API key, and delete it.
Nice Work!
Nice Work!
You just built an AI-powered code quality pipeline that reads real Python files, identifies bugs and weaknesses, and writes targeted tests to prove they exist. That's two senior engineers collaborating on your codebase at the press of a button.
You've learned how to:
- Install CrewAI with Gemini on a Python 3.14 system by managing Python versions with uv, bypassing compatibility constraints without touching your system interpreter.
- Build a two-agent crew where context-passing between agents produces better output than either agent alone. The Test Engineer writes smarter tests because it knows exactly what the Code Reviewer found.
- Use FileReadTool to give agents access to local files, making the crew a practical development tool you can point at any Python file.
- Secret Mission: You scaled to a three-agent pipeline with a Security Auditor, proving how easily CrewAI crews grow to handle more complex workflows.
Ready to quiz yourself?