Skip to content

Gopal-2005/Autonomous-dev-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Autonomous Dev Agent

An AI-powered autonomous development system that uses multiple intelligent agents to build complete software projects from natural language descriptions. Built with LangGraph, Google Gemini, and Python.

πŸš€ Features

  • πŸ“‹ PM Agent - Generates Product Requirements Documents from user prompts
  • πŸ—οΈ Architect Agent - Designs system architecture and technology stack
  • πŸ’» Coder Agent - Generates production-ready code
  • πŸ‘€ Reviewer Agent - Performs comprehensive code reviews
  • πŸ§ͺ Tester Agent - Generates tests and verifies functionality
  • βœ… Critic Agent - Final meta-review and quality assurance
  • 🌐 REST API - FastAPI backend for integration
  • 🎨 Web UI - Streamlit dashboard for visualization
  • πŸ”„ Conditional Routing - Intelligent agent orchestration with LangGraph
  • πŸ’Ύ State Persistence - Checkpoint-based state management
  • πŸ”„ Retry Logic - Automatic error recovery

πŸ“‹ Architecture

User Request
    ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  PM Agent (Requirements)            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Architect Agent (Design)           β”‚
β”‚  ⏸️ [Human Review Checkpoint]        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Coder Agent (Code Generation)      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Reviewer Agent (Code Review)       β”‚
β”‚  ↻ [Conditional: Pass?]             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               ↓ (if pass)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Tester Agent (Test Generation)     β”‚
β”‚  ↻ [Conditional: Tests Pass?]       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               ↓ (if pass)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Critic Agent (Meta-Review)         β”‚
β”‚  ↻ [Conditional: Rollback needed?]  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               ↓ (if approved)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  βœ… Final Review & Delivery         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Tech Stack

  • LLM: Google Gemini 2.5 Flash
  • Orchestration: LangGraph
  • API Framework: FastAPI
  • Frontend: Streamlit
  • Database: SQLite (state persistence)
  • Code Execution: E2B Sandbox
  • State Management: Pydantic
  • Testing: pytest

πŸ“ Project Structure

langgrpah/
β”œβ”€β”€ agents/              # Agent implementations
β”‚   β”œβ”€β”€ pm_agent.py
β”‚   β”œβ”€β”€ architect_agent.py
β”‚   β”œβ”€β”€ coder_agent.py
β”‚   β”œβ”€β”€ reviewer_agent.py
β”‚   β”œβ”€β”€ tester_agent.py
β”‚   └── critic_agent.py
β”œβ”€β”€ graph/              # LangGraph workflow
β”‚   β”œβ”€β”€ state.py        # Pydantic state model
β”‚   β”œβ”€β”€ builder.py      # Graph construction
β”‚   └── conditional_routing.py
β”œβ”€β”€ tools/              # Utility tools
β”‚   β”œβ”€β”€ code_executor.py
β”‚   β”œβ”€β”€ file_generator.py
β”‚   └── validators.py
β”œβ”€β”€ api/                # FastAPI endpoints
β”‚   └── routes.py
β”œβ”€β”€ ui/                 # Streamlit frontend
β”‚   └── app.py
β”œβ”€β”€ tests/              # Test suite
β”‚   └── test_agents.py
β”œβ”€β”€ config.py           # Configuration
β”œβ”€β”€ main.py             # CLI entry point
β”œβ”€β”€ requirements.txt    # Dependencies
└── .env.example        # Environment template

πŸš€ Quick Start

1. Clone & Setup

# Clone the repository
git clone <repo_url>
cd langgrpah

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

2. Configure Environment

# Copy the example env file
cp .env.example .env

# Edit .env with your API keys
# ANTHROPIC_API_KEY=your_key_here
# E2B_API_KEY=your_key_here

3. Run the System

Choose how to run the system:

Option A: Streamlit UI (Recommended for first use)

python main.py ui
# Open browser to http://localhost:8501

Option B: FastAPI Server

python main.py api
# Open browser to http://localhost:8000/docs

Option C: Command Line

python main.py pipeline "Build a simple REST API for task management"

πŸ“– Usage Examples

Via CLI

python main.py pipeline "Build a user authentication system with FastAPI"

Via Python

from graph.state import AgentState
from graph.builder import get_graph

# Create state
state = AgentState(
    user_prompt="Build a todo API with authentication"
)

# Get graph and run
graph = get_graph()
result = graph.invoke(state.dict())

print(result['generated_files_list'])

Via API

# Start pipeline
curl -X POST http://localhost:8000/pipeline/start \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Build a REST API"}'

# Check status
curl http://localhost:8000/pipeline/{session_id}/status

# Get generated code
curl http://localhost:8000/pipeline/{session_id}/output

🀝 Agent Workflow Details

PM Agent

Input: User natural language request Output: Product Requirements Document

The PM Agent:

  • Analyzes the user's request
  • Extracts requirements and features
  • Identifies constraints and scope
  • Creates a comprehensive PRD

Architect Agent

Input: PRD from PM Agent Output: Technical Design Document

The Architect Agent:

  • Proposes technology stack
  • Designs API endpoints
  • Plans database schema
  • Creates system architecture
  • Awaits human approval before proceeding

Coder Agent

Input: Technical design and requirements Output: Production-ready code files

The Coder Agent:

  • Implements all features
  • Writes clean, documented code
  • Follows software engineering best practices
  • Generates multiple files (main.py, config.py, database.py, api.py, utils.py)

Reviewer Agent

Input: Generated code Output: Code review feedback

The Reviewer Agent:

  • Checks code quality
  • Validates best practices
  • Identifies issues and improvements
  • Either approves or sends back to Coder

Tester Agent

Input: Generated code Output: Test files and execution results

The Tester Agent:

  • Generates comprehensive test suites
  • Creates unit, integration, and API tests
  • Executes tests in sandbox
  • Reports test coverage and results

Critic Agent

Input: All previous outputs Output: Final approval or rollback decision

The Critic Agent:

  • Performs meta-review of entire pipeline
  • Assesses requirement coverage
  • Evaluates architecture quality
  • Makes final go/no-go decision
  • Can trigger rollback to earlier stages

πŸ§ͺ Testing

Run the test suite:

# Install test dependencies
pip install pytest

# Run all tests
pytest tests/

# Run specific test
pytest tests/test_agents.py::TestPMAgent

# Run with coverage
pytest --cov=agents --cov=graph --cov=tools tests/

πŸ”„ State Management

The system uses a centralized AgentState Pydantic model that:

  • Flows through all agents
  • Maintains consistency
  • Enables checkpointing
  • Can be persisted to database
  • Validates data types

All agents read from and write to this shared state.

πŸ“Š Monitoring & Logging

The system logs all executions:

state.execution_history  # List of all agent executions
state.total_tokens_used  # Total tokens consumed
state.last_error         # Last error message (if any)

πŸ” Security

  • Input validation on all APIs
  • Environment variable management for secrets
  • Sandboxed code execution (E2B)
  • Rate limiting (can be added)
  • CORS configuration (can be added)

🐳 Docker Support

# Build
docker build -t langgrpah .

# Run API
docker run -e ANTHROPIC_API_KEY=xxx -p 8000:8000 langgrpah python main.py api

# Run UI
docker run -e ANTHROPIC_API_KEY=xxx -p 8501:8501 langgrpah python main.py ui

πŸ“ˆ Performance Optimization

  • Parallel Agent Execution: Some agents could run in parallel
  • Caching: Cache agent outputs for similar requests
  • Token Optimization: Monitor token usage per agent
  • Async Operations: Already using async in FastAPI

🎯 Future Enhancements

  • Multi-modal input (voice, images)
  • Real-time websocket updates for UI
  • Database persistence with SQLAlchemy
  • More sophisticated rollback logic
  • Cost tracking and optimization
  • Plugin system for custom agents
  • Version control integration
  • Deployment automation (Docker, K8s)

🀝 Contributing

Contributions welcome! Areas for improvement:

  • Additional agents (DevOps, Security, Performance)
  • Enhanced test coverage
  • Better error handling
  • Performance improvements
  • Documentation

πŸ“ License

MIT License - See LICENSE file for details

πŸ’‘ How It Works

  1. User submits request - "Build a task management API"

  2. PM Agent analyzes - Creates detailed Requirements Document with features, scope, constraints

  3. Architect designs - Creates Technical Design with tech stack, API endpoints, database schema

    • ⏸️ Human Review - User reviews and approves/rejects architecture
  4. Coder generates - Writes clean, production-ready code based on design

  5. Reviewer checks - Reviews code for quality, best practices, and issues

  6. Tester validates - Generates tests and verifies functionality

  7. Critic reviews - Final meta-review with approval or rollback decision

  8. Delivery - Complete codebase ready for use

πŸ™‹ Support

For issues, questions, or suggestions:

  • Open an issue on GitHub
  • Check existing documentation
  • Review example prompts

πŸŽ“ Learning Resources


Made with ❀️ using AI and Python

About

AI-powered autonomous dev agent that generates complete software projects from natural language requests. Uses LangGraph orchestration, Google Gemini AI, and multi-agent collaboration (PM, Architect, Coder, Reviewer, Tester, Critic) for end-to-end development automation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors