An AI-powered multi-agent system that automatically builds complete websites from conversational requirements using LangGraph and Google's Gemini AI.
This project implements a sophisticated multi-agent workflow that guides users through website creation via a conversational interface. The system gathers requirements, generates development tasks, and executes them autonomously using AI agents powered by LangGraph orchestration.
The project uses LangGraph to orchestrate four specialized AI agents that work sequentially:
-
Requirements Agent (
requirements_agent.py)- Conducts interactive conversations to gather website specifications
- Asks focused questions about business type, purpose, pages, content, design, and contact info
- Validates completeness before proceeding
- Uses
exit_toolto signal requirements are complete
-
Task Manager Agent (
task_manager_agent.py)- Converts requirements into detailed, actionable development tasks
- Generates JSON-formatted task lists with file paths, descriptions, and success criteria
- Specifies exact implementation details (layouts, colors, spacing, functionality)
- Creates tasks at
website_project/{session_id}/path structure
-
Developer Agent (
developer_agent.py)- Executes tasks using MCP (Model Context Protocol) filesystem tools
- Creates multi-page websites with consistent navigation
- Implements responsive design with accessibility standards
- Uses online image placeholders (placehold.co, picsum.photos)
- Handles 1500 character limit per tool call by splitting content strategically
-
Orchestrator Agent (
orchestrator_agent.py)- Coordinates the overall workflow between agents
- Manages state transitions between phases
- Tracks session data and progress
- Finalizes and delivers completed projects
The system implements multiple LangGraph state machines:
-
Orchestrator Graph (
orchestrator_graph.py): Main workflow coordinator- Flow: START → task_management_phase → development_phase → finalize_project → END
-
Requirements Graph (
requirements_graph.py): Single-step conversational processing- Flow: START → process_message → END
-
Task Manager Graph (
task_manager_graph.py): Task generation pipeline- Flow: START → generate_tasks → parse_tasks → END
-
Developer Graph (
developer_graph.py): Iterative development execution- Flow: START → agent → tools/advance_to_next_task → project_complete → END
- Includes conditional routing based on tool calls and task completion
Typed state definitions in state_models.py:
RequirementsState: Manages conversation messages and gathered dataTaskManagerState: Handles requirements and parsed task listsDeveloperState: Tracks current task, project status, and development contextOrchestratorState: Maintains overall workflow state and session data
Google Gemini 2.5 Pro (gemini-2.5-pro)
- All agents use this model for natural language processing and decision-making
- Configured in:
requirements_agent.py,task_manager_agent.py,developer_agent.py,json_parser_agent.py, andcrud.py - Requires Google API Key for access
- LangGraph (>=0.6.6): Agent orchestration and workflow management
- LangChain Google GenAI (>=2.1.12): Google Gemini AI model integration
- LangChain MCP Adapters (>=0.1.9): Model Context Protocol for filesystem operations
- FastAPI (>=0.104.0): REST API framework
- SQLAlchemy (>=2.0.43): Database ORM for session management
- Uvicorn (>=0.24.0): ASGI server
- Pyppeteer (>=2.0.0): Headless browser automation
- python-dotenv (>=1.1.1): Environment configuration
- json-repair (>=0.52.0): JSON parsing and validation
- nest-asyncio (>=1.6.0): Async event loop utilities
website-builder-poc/
├── src/website_builder/
│ ├── agents/ # AI agent implementations
│ │ ├── requirements_agent.py
│ │ ├── task_manager_agent.py
│ │ ├── developer_agent.py
│ │ └── orchestrator_agent.py
│ ├── graphs/ # LangGraph workflow definitions
│ │ ├── requirements_graph.py
│ │ ├── task_manager_graph.py
│ │ ├── developer_graph.py
│ │ └── orchestrator_graph.py
│ ├── models/ # State and data models
│ │ └── state_models.py
│ ├── prompts/ # Agent system prompts
│ │ ├── requirements_prompts.py
│ │ ├── task_manager_prompts.py
│ │ └── developer_prompts.py
│ ├── api/ # REST API layer
│ │ ├── controller/
│ │ │ └── api.py # FastAPI endpoints
│ │ └── service/
│ │ ├── message_service.py
│ │ ├── status_service.py
│ │ ├── json_service.py
│ │ └── zip_service.py
│ ├── db/ # Database layer
│ │ ├── database.py # SQLAlchemy setup
│ │ ├── database_models.py
│ │ └── crud.py # Database operations
│ ├── mcp/ # Model Context Protocol tools
│ │ └── file_system.py # Filesystem MCP client
│ ├── tools/ # Custom LangChain tools
│ │ └── validation_tools.py
│ ├── scripts/ # Utility scripts
│ │ ├── test_graphs.py # Graph testing utilities
│ │ └── utilities.py # Setup/cleanup helpers
│ └── config.py # Configuration
├── Dockerfile # Container configuration
├── start.sh # Startup script
└── pyproject.toml # Project metadata and dependencies
The API runs on port 8080 and provides the following endpoints:
-
GET /health: Health check endpoint -
POST /chat/start: Initialize a new requirements gathering session- Request:
{"user_input": "I want to build a website for..."} - Response:
{"session_id": "uuid", "agent_message": "..."}
- Request:
-
POST /chat/message: Send message in ongoing conversation- Request:
{"session_id": "uuid", "user_input": "..."} - Response:
{"agent_message": "..."}
- Request:
-
GET /poll/{session_id}: Poll session status and progress -
GET /zip/{session_id}: Download completed website as ZIP file -
POST /parse: Parse JSON data (utility endpoint)
For experienced developers who want to get started immediately:
# 1. Install UV
curl -LsSf https://astral.sh/uv/install.sh | sh
# 2. Clone and navigate
git clone <repository-url> && cd website-builder-agents
# 3. Install dependencies
uv sync
# 4. Set up environment
echo "GOOGLE_API_KEY=your_key_here" > .env
# 5. Run the application
./start.sh- Python 3.11+: Required for the application
- UV Package Manager: Modern Python package manager (replaces pip/poetry)
- Node.js and npm: Required for MCP filesystem server
- Google API Key: For Gemini 2.5 Pro access
# On macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# On Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# Verify installation
uv --version# On Ubuntu/Debian
sudo apt update
sudo apt install nodejs npm
# On macOS (using Homebrew)
brew install node
# Verify installation
node --version
npm --versiongit clone <repository-url>
cd website-builder-poc# UV will automatically install Python 3.11+ if needed
uv syncThis command:
- Creates a virtual environment
- Installs all dependencies from
pyproject.toml - Sets up the project for development
Create a .env file in the project root:
# Using your text editor
nano .env
# Or using echo
echo "GOOGLE_API_KEY=your_actual_api_key_here" > .envHow to get a Google API Key:
- Go to Google AI Studio
- Sign in with your Google account
- Click "Create API Key"
- Copy the key and paste it in your
.envfile
Option A: Using the startup script (recommended)
chmod +x start.sh # Make script executable (first time only)
./start.shThis script automatically:
- Cleans the project workspace
- Sets up the project structure
- Starts the FastAPI server on port 8080
Option B: Manual step-by-step
# Step 1: Clean previous workspace
uv run clean-project
# Step 2: Initialize project workspace
uv run setup-project
# Step 3: Start the API server
uv run apiOpen your browser and visit:
- Health check: http://localhost:8080/health
You should see a health check response or the interactive API documentation.
Build and run with Docker:
docker build -t website-builder .
docker run -p 8080:8080 -e GOOGLE_API_KEY=your_key website-builderThe Docker container:
- Uses Python 3.11-slim base image
- Installs Node.js/npm for MCP server
- Runs as non-root user (appuser)
- Exposes port 8080
Here's a complete example of using the API to build a website:
curl -X POST http://localhost:8080/chat/start \
-H "Content-Type: application/json" \
-d '{
"user_input": "I want to build a website for my bakery business"
}'Response:
{
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"agent_message": "Great! What are the main sections you need for your bakery website? (For example: Home, About, Menu, Contact, etc.)"
}curl -X POST http://localhost:8080/chat/message \
-H "Content-Type: application/json" \
-d '{
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"user_input": "I need Home, About Us, Our Products, and Contact pages"
}'The agent will continue asking questions about:
- Content for each section
- Design preferences and colors
- Contact information
- Any special features needed
Once enough information is gathered:
{
"agent_message": "Here's what I gathered:\n- Business: Bakery\n- Sections: Home, About Us, Our Products, Contact\n- Design: Warm colors, professional\n- Contact info: Email and phone\n\nIs this complete enough to start building your website?"
}When you confirm, the system automatically:
- Generates detailed development tasks
- Executes each task using the developer agent
- Creates a complete multi-page website
- Updates session status to "completed"
curl http://localhost:8080/poll/550e8400-e29b-41d4-a716-446655440000Response:
{
"status": "completed",
"message": "Website creation complete",
"project_status": "completed"
}curl -O http://localhost:8080/zip/550e8400-e29b-41d4-a716-446655440000This downloads a ZIP file containing:
website_project/550e8400-e29b-41d4-a716-446655440000/
├── index.html
├── about.html
├── products.html
├── contact.html
├── css/
│ └── styles.css
└── js/
└── main.js
You can test each agent in isolation using the provided scripts:
# Test requirements gathering
uv run test-requirements
# Test task generation
uv run test-tasks
# Test developer execution
uv run test-developer
# Test complete orchestrator flow
uv run test-orchestratorDefined in pyproject.toml:
uv run api: Start the FastAPI server
uv run test-requirements: Test requirements gathering agentuv run test-tasks: Test task manager agentuv run test-developer: Test developer agentuv run test-orchestrator: Test full orchestrator workflow
uv run visualize-graphs: Generate visual diagrams of LangGraph workflowsuv run setup-project: Initialize project workspaceuv run clean-project: Clean project workspace
- Natural language interaction to gather website specifications
- Focused, one-question-at-a-time approach
- Validation before proceeding to development
- Converts requirements into detailed development tasks
- Includes exact file paths, content specifications, and design details
- Session-specific project organization
- Uses MCP filesystem tools for file operations
- Implements multi-page websites with consistent navigation
- Handles character limits intelligently by splitting large files
- Applies modern web design standards automatically
- Spacing: 8px units (8, 16, 24, 32, 48, 64px)
- Typography: 16px base, responsive headings, 1.5 line-height
- Colors: User-specified with 4.5:1 contrast ratio
- Responsive: Mobile-first, breakpoints at 768px/1024px
- Layout: CSS Grid for pages, Flexbox for components
- Accessibility: Semantic HTML5, ARIA labels, focus states
- Interactions: 200ms transitions
The developer agent maintains navigation consistency across all pages:
- First page creates navigation template with all page links
- Subsequent pages copy existing navigation structure
- Navigation updates propagate to all existing pages
- All pages link to shared CSS/JS files
- SQLAlchemy database for session persistence
- Tracks conversation state, requirements, and tasks
- Supports session reactivation for iterative development
- Stores project outputs and status
id: UUID primary keystatus: Current session status (pending/completed)requirement_gatherer_output: Stored conversation messagestask_manager_output: Generated tasks JSONstate: Serialized graph state
- Start Session: User initiates chat with initial website description
- Requirements Phase: Requirements agent asks clarifying questions
- Task Generation: Task manager creates detailed development tasks
- Development Phase: Developer agent executes tasks sequentially
- Finalization: Orchestrator completes session and provides download link
Comprehensive logging configured at DEBUG level:
- Request/response tracking
- Agent conversation logging
- Graph execution monitoring
- Error tracking and debugging
Filtered loggers:
- LangChain function utils (ERROR level)
- gRPC cygrpc (INFO level)
PROJECT_WORKSPACE: Base directory for generated websites (default:./website_project)GOOGLE_API_KEY: Required for Gemini AI access- Database: SQLite (
test.db) for development
Uses LangChain MCP Adapters to provide filesystem capabilities:
- Server:
@modelcontextprotocol/server-filesystem - Tools: write_file, edit_file, read_file, list_files
- Workspace: Scoped to
PROJECT_WORKSPACEdirectory
- HTTP 400 for invalid requests (missing fields)
- HTTP 500 for processing errors with detailed messages
- Graceful fallbacks for state deserialization
- Transaction management for database operations
Potential areas for expansion:
- Support for additional LLM providers
- Advanced template library
- Database backend selection (PostgreSQL, MySQL)
- Real-time WebSocket updates
- Preview server integration
- Custom component library
- Version control integration
- Multi-user collaboration