This project implements a multi-agent AI system designed to autonomously develop, review, test, and document software projects from a high-level user prompt. It simulates a team of AI agents, each with a specialized role, working together to deliver a complete, version-controlled software application.
-
Multi-Agent Architecture: Simulates a real development team with specialized agents:
SADTSARTPlannerAgent: The primary planner that uses SADT/SART methodology to generate hierarchical workplans and atomic actions.ProductOwnerAgent: Acts as the vision holder and requirements consultant, answering agent questions to clarify ambiguity.DeveloperAgent: Executes tasks using a ReAct (Reason+Act) model and a suite of tools.CodeReviewerAgent: Analyzes the entire codebase for integration issues, bugs, and inconsistencies.UnitTestAgent: Generatespytestunit tests for the generated code.DocumentationAgent: Writes the final projectREADME.mdfile.
-
Flexible Agent Collaboration: Agents can now communicate dynamically using the
call_agenttool. For example, aDeveloperAgentcan ask theCodeReviewerAgentfor immediate feedback on a specific file, breaking the rigid sequential handoff structure. -
Tool-Based Actions (ReAct): The
DeveloperAgentuses a set of tools (list_files,read_file,write_file,call_agent, etc.) to interact with the codebase and other agents. -
Automated Version Control: Every completed task is automatically committed to a Git repository, providing a complete, auditable history of the AI's work.
-
RAG-Powered Context: Uses Retrieval-Augmented Generation (RAG) via LlamaIndex to provide agents with relevant code context, overcoming LLM context window limitations.
-
Pluggable LLM Providers: Easily switch between local models (via Ollama) and cloud-based APIs (like Google Gemini).
-
Cost & Usage Tracking: Monitors token usage and estimates costs for each LLM call.
-
Structured Trace Logging: Generates detailed Markdown and JSON execution traces for easy debugging and monitoring.
The system is orchestrated by a central Orchestrator class that manages the project lifecycle through several distinct phases:
- Planning: The
SADTSARTPlannerAgentanalyzes the requirement and generates a detailed hierarchical plan (SADT/SART). TheProductOwnerAgentis available for consultation throughout the project. - Development & Collaboration: The
Orchestratoriterates through each task in the plan. TheDeveloperAgentexecutes the task using its tools. Crucially, the DeveloperAgent is responsible for quality assurance. It can use thecall_agenttool to request ad-hoc reviews or advice from theCodeReviewerAgentorProductOwnerAgentat any time during the task. - Unit Testing (Optional): If enabled, the
UnitTestAgentgeneratespytestfiles for the Python code. - Final Validation: The
TesterAgentruns the test suite (if any) and attempts to start the main application to ensure it's executable. - Documentation: If all previous phases succeed, the
DocumentationAgentgenerates aREADME.mdfile for the newly created project.
Follow these steps to set up and run the project.
- Python 3.11+
- Git
- Docker (for the
TesterAgent) - (Optional) Ollama for running local models.
-
Clone the repository:
git clone https://github.com/sancelot/AIdevSquad cd AIdevSquad -
Create a virtual environment and install dependencies:
python -m venv .venv source .venv/bin/activate # On Windows, use: .venv\Scripts\activate pip install -r requirements.txt
-
Set up LLM providers:
- Create a
.envfile in the root directory by copying the example:cp .env.example .env
- For Google Gemini:
- Go to Google AI Studio to get an API key.
- Add it to your
.envfile:GOOGLE_API_KEY="your-api-key"
- For Ollama (Local Models):
- Install Ollama.
- Pull the models you want to use. We recommend:
ollama pull llama3:8b ollama pull bge-base-en-v1.5 # For embeddings
- Create a
The main script is orchestrator.py. You can control its behavior using command-line flags.
Basic Run (using the default provider, e.g., Ollama):
python orchestrator.py myproject --prompt myrequirements.txtRun with Ollama:
python orchestrator.py myproject --ollama --prompt myrequirements.txtStart a new project from scratch (deletes the existing workspace):
python orchestrator.py myproject --new --prompt myrequirements.txt
**Generate unit tests as part of the process:**
```bash
python orchestrator.py myproject--with-tests --prompt myrequirements.txtFlags can be combined:
python orchestrator.py myproject --ollama --new --with-tests --prompt myrequirements.txtAfter each run, a detailed trace log is saved in the logs/ directory, and the generated project (with its own Git repository) is available in the ..._workspace/ directory.
A simple Flask-based UI is available to visualize the execution traces.
-
Navigate to the UI directory:
cd monitoring_ui -
Install its dependencies (if any):
pip install -r requirements.txt
-
Run the UI application:
flask run --port=5001
-
Open your browser to
http://127.0.0.1:5001to see the dashboard.
New Feature: Nested Collaboration View
The trace view now supports visualizing nested agent calls. When a DeveloperAgent consults a CodeReviewerAgent or ProductOwnerAgent via chat, the sub-agent's thoughts and tool usage are displayed with indentation and distinct styling, providing a clear "call tree" of the collaboration.
Contributions are welcome! Please feel free to open an issue or submit a pull request. Areas for improvement include:
- Providing consistence documentation between agents in order to avoid producing a project that finally builds but is not usable.
- Adding more tools for the
DeveloperAgent(e.g., AST-based refactoring for specific languages). - Improving the intelligence of the
CodeReviewerAgent. - Expanding the
TesterAgentto run more complex integration tests. - Enhancing the monitoring UI.
This project is licensed under the MIT License. See the LICENSE file for details.