A demo project showcasing CrewAI's capabilities in solving mathematical challenges using AI agents with code interpretation. This project implements a feedback loop system where one agent solves problems using Python code execution while another validates the results.
- Demonstrates CrewAI's agent collaboration system
- Showcases code interpreter tool integration
- Implements feedback loop validation architecture
- Provides real-time solution verification
- Handles multiple solution attempts automatically
- Clone the repository
- Install uv using Homebrew (recommended):
brew install uv- Create a
.envfile with your OpenAI API key:
AZURE_API_KEY=...
AZURE_API_BASE=...
AZURE_API_VERSION=...
OPENAI_API_KEY=...
OTEL_SDK_DISABLED=true
CREWAI_TELEMETRY_OPT_OUT=true
- Run the application (uv will automatically handle virtual environment and dependencies):
uv run app.pyThis showcase demonstrates CrewAI's capabilities through two specialized AI agents:
- Math Problem Solver: Uses code interpretation to solve math problems programmatically
- Math Result Validator: Reviews solutions and provides structured feedback
The feedback loop workflow:
- Problem is submitted to the solver agent
- Solver executes Python code to compute the solution
- Validator agent reviews and provides VALID/INVALID feedback
- System automatically retries with different approaches if invalid
- Process continues until a valid solution is found or max attempts reached
This architecture demonstrates CrewAI's ability to:
- Execute real Python code for problem-solving
- Implement multi-agent validation systems
- Handle complex feedback loops
- Manage state across multiple solution attempts
The solver returns a dictionary containing:
result: The computed solutionfeedback: Validation feedbackattempts: Number of attempts madestatus: Final status ("success" or "failed")
- Python ≥ 3.12
- CrewAI ≥ 0.98.0
- CrewAI Tools ≥ 0.32.1
MIT