Project for my Bachelor's Thesis: Multi-Agent Debate with LLMs
The MAD-AI project explores the use of Large Language Models (LLMs) to create a Multi-Agent System (MAS) where multiple agents discuss and analyze provided source code. This system simulates a structured debate to improve decision-making and insights into software analysis.
- Multiple AI agents with distinct roles (e.g., Debaters and Judges)
- Configurable rounds and evaluation criteria
- JSON-formatted output with confidence levels
Below is an example of how to use the API endpoint to initiate a Multi-Agent Debate:
curl.exe -X POST http://localhost:3000/api/mad \
-F "code=@C:\Users\xy\code.zip" \
-F "configuration={ \"apiKeys\": { \"google\": \"REPLACE\", \"openAi\": \"REPLACE\" }, \"agents\": [ { \"name\": \"AgentA\", \"model\": \"gemini-1.5-flash\", \"role\": \"assistant\", \"systemInstruction\": \"Du bist ein Experte in der Softwareentwicklung und wirst nacheinander Quellcode eines Projektes zugespielt bekommen, welchen du auf Kriterien untersuchst. Formatiere den Output als JSON wie folgt: { output: string, foundCriteriasCount: number, confidence: 'LOW' ^| 'MEDIUM' ^| 'HIGH' }.\", \"type\": \"Debater\" }, { \"name\": \"AgentB\", \"model\": \"gemini-1.5-flash\", \"role\": \"assistant\", \"systemInstruction\": \"Du bist ein Experte in der Softwareentwicklung und wirst nacheinander Quellcode eines Projektes zugespielt bekommen, welchen du auf Kriterien untersuchst. Formatiere den Output als JSON wie folgt: { output: string, foundCriteriasCount: number, confidence: 'LOW' ^| 'MEDIUM' ^| 'HIGH' }.\", \"type\": \"Debater\" }, { \"name\": \"AgentC\", \"model\": \"gemini-1.5-flash\", \"role\": \"assistant\", \"systemInstruction\": \"Du bist ein Experte in der Softwareentwicklung und wirst nacheinander Quellcode eines Projektes zugespielt bekommen, welchen du auf Kriterien untersuchst. Formatiere den Output als JSON wie folgt: { output: string, foundCriteriasCount: number, confidence: 'LOW' ^| 'MEDIUM' ^| 'HIGH' }.\", \"type\": \"Judge\" } ], \"rounds\": 3, \"dynamicRounds\": true, \"task\": \"Untersuche den Code auf Fairness\" }" \
--no-buffer- Endpoint:
http://localhost:3000/api/mad - File Upload:
-F "code=@C:\Users\xy\code.zip"- Replace
C:\Users\xy\code.zipwith the path to your source code.
- Replace
- Configuration:
apiKeys: ReplacegoogleandopenAiplaceholders with your API keys.agents: Define agents with their roles, models, and instructions.rounds: Specify the number of debate rounds.dynamicRounds: If true, the debate will end earlier if the confidence is high.task: Defines the task for the software engineers.
Agents analyze the source code and produce JSON-formatted outputs:
{
"output": "Analysis summary",
"foundCriteriasCount": 5,
"confidence": "HIGH"
}output: Summary of the agent's analysisfoundCriteriasCount: Number of criteria found in the codeconfidence: Confidence level of the analysis (LOW,MEDIUM,HIGH)
- Clone the repository:
git clone https://github.com/your-repo/mad-ai.git
- Navigate to the project directory:
cd mad-ai - Install dependencies:
npm install
- Start the server:
npm run dev
This project is licensed under the MIT License. See the LICENSE file for details.