A lightweight Planner → Executor → Reviewer AI pipeline (FastAPI + Python) — fully local, deterministic, and free (uses a MockLLM).
- Overview
- 🧩 1. Primary Use Case
- 📂 2. Project Structure
- 🏗️ 3. System Architecture
- ⚙️ 4. Components
- 📦 5. Requirements
- 🛠️ 6. Installation
- 🚀 7. Running the Project
- 8. API Workflow Example
- 📝 9. Example Full Output (Illustrative)
- 🏆 10. Why This Project Is Valuable
- ✔️ 11. Extending the Project
- 12. Contributing
- 13. License
This repository implements a simple but complete multi-agent architecture where multiple autonomous agents collaborate to solve a user-defined goal. The pipeline includes:
- Planner Agent — converts a high-level goal into actionable, ordered steps.
- Executor Agent — performs each step and produces intermediate outputs.
- Reviewer Agent — evaluates the final result and issues a pass/fail review.
- Orchestrator — central coordinator that submits, runs and monitors tasks.
- FastAPI backend — exposes task APIs for submission and retrieval.
- Demo script — run the full pipeline locally without a frontend or external LLM.
All agents are wired to a MockLLM adapter so the whole system runs offline and deterministically with zero API cost.
A user submits a high-level goal, for example:
"Analyze global water scarcity and propose 5 practical solutions."
The system will:
- Break the goal into numbered steps (Planner).
- Execute each step sequentially and record intermediate results (Executor).
- Review and QA the consolidated result (Reviewer).
- Return a structured task record including plan, execution outputs, and review.
Typical applications include research assistants, automated planning workflows, educational demonstrations of multi-agent collaboration, and experiments in task decomposition.
agents-capstone/
├─ app/
│ ├─ main.py # FastAPI endpoints
│ ├─ orchestrator.py # Task management + agent loop
│ ├─ llm.py # MockLLM (offline), adapter layer
│ ├─ storage.py # In-memory task storage
│ ├─ agents/
│ │ ├─ planner.py # Planner agent
│ │ ├─ executor.py # Executor agent
│ │ └─ reviewer.py # Reviewer agent
├─ demo.py # CLI demo runner
├─ requirements.txt # Python dependencies
├─ Dockerfile # Backend container (optional)
└─ README.md # Documentation
┌──────────────────────────┐
│ Client │
│ (curl, frontend, demo.py) │
└─────────────┬────────────┘
POST /tasks
│
▼
┌─────────────────────────┐
│ FastAPI API │
│ (app/main.py endpoints) │
└─────────────┬───────────┘
│
▼
┌────────────────────────┐
│ Orchestrator │
│ (Submit, run, monitor) │
└───────────┬────────────┘
┌────────────────────────┼──────────────────────────┐
▼ ▼ ▼
┌────────────┐ ┌─────────────┐ ┌────────────┐ │ Planner │ │ Executor │ │ Reviewer │ │ (steps) │ │ (per step) │ │ (final QA) │ └────────────┘ └─────────────┘ └────────────┘
▼
┌────────────────┐
│ Task Storage │
│ (in-memory) │
└────────────────┘
A lightweight simulated LLM that returns predictable outputs. It avoids external API calls so tests are reproducible and free.
Parses the high-level goal and emits a clear, numbered list of instructions. Output is parsed into an ordered JSON list suitable for the Orchestrator to consume.
Processes each instruction, simulates working on the step (using MockLLM) and produces deterministic reasoning text which becomes part of the task's execution log.
Inspects the entire execution bundle, drafts a final review summary, and returns a boolean pass/fail along with comments.
Manages task lifecycle: submission, execution, status updates, and result storage. Typical lifecycle statuses: queued → executing → reviewing → done.
Exposes the following endpoints:
POST /tasks— submit a new task with agoalJSON field.GET /tasks/{task_id}— retrieve task status & results.GET /health— basic health check.
Example POST body:
{ "goal": "Analyze global water scarcity" }Example POST response:
{ "task_id": "abcd-1234", "status": "queued" }- Python 3.11.x (Suggestion: 3.11.9 is a stable version for this project)
Packages requirements.txt:
fastapi==0.95.2
uvicorn==0.22.0
pydantic==1.10.11
python-multipart==0.0.6
numpy==1.26.4
scikit-learn==1.4.2
aiohttp==3.9.5
faiss-cpu==1.7.4 # optional
git https://github.com/SANJAI-s0/Adaptive-Multi-Agent-Orchestrator-for-Automated-Task-Planning-Execution.git
cd Adaptive-Multi-Agent-Orchestrator-for-Automated-Task-Planning-Execution
python -m venv .venv
source .venv/bin/activate # Windows PowerShell: .venv\Scripts\Activate.ps1
pip install -r requirements.txtpython demo.pyThis will run the Planner → Executor → Reviewer loop locally and print structured, readable output to the console.
uvicorn app.main:app --reload --host 127.0.0.1 --port 8000Open the interactive docs at: http://127.0.0.1:8000/docs
- Submit a Task
curl -X POST "http://127.0.0.1:8000/tasks" \
-H "Content-Type: application/json" \
-d '{"goal":"Analyze global water scarcity"}'Response:
{"task_id":"abcd-1234","status":"queued"}- Poll for Status
curl "http://127.0.0.1:8000/tasks/abcd-1234"Plan
- Research background and collect sources.
- Extract key facts and statistics.
- Analyze drivers and craft recommendations.
- Produce final report with citations.
Execution
- Step 1: fetched sources
- Step 2: calculated trend
- Step 3: analyzed drivers
- Step 4: produced final report
Review
- Drafted a 600-word summary and a list of 5 proposed interventions.
passed:true
- Demonstrates multi-agent collaboration and task decomposition.
- Shows chained reasoning in a reproducible, deterministic environment (no API costs).
- Clean architecture suitable for extension (real LLM adapters, persistent storage, UI).
- Good fit for educational demos and Kaggle Freestyle-style projects.
Ideas for improvements:
- Replace
MockLLMwith a real LLM adapter (OpenAI, Anthropic, etc.) for non-deterministic, high-quality outputs. - Add persistent storage (database) instead of in-memory task storage.
- Add asynchronous/concurrent execution for independent steps.
- Add authentication and authorization for the API.
- Build a simple frontend to visualize plan, execution logs, and review results.
Contributions are welcome. Suggested workflow:
- Fork the repo
- Create a feature branch
- Open a pull request with clear description and tests/examples
Choose an appropriate license for your project (e.g., MIT). Add a LICENSE file if you publish this repo.