Jai0401/docAgent

AI-powered documentation generator using LangChain agentic loop and OpenRouter free models

โ˜… 0Forks 0PythonGitHub โ†—Compare

README

docAgent - AI Documentation Generator

Generate comprehensive documentation, Dockerfiles, and Docker Compose configs from any GitHub repository using AI agents.

License Python React

Features

  • ๐Ÿค– AI Agentic Loop - Uses LangChain tools to explore repositories and generate context-aware documentation
  • ๐Ÿ” Smart Exploration - Automatically finds key files (README, configs, requirements, source code)
  • ๐Ÿ“ก Real-time Progress - SSE streaming shows live progress as documentation is generated
  • ๐Ÿณ Multi-type Generation - Supports documentation, Dockerfiles, and Docker Compose files
  • ๐Ÿ’พ Generation History - All generations are stored and accessible
  • ๐ŸŒ Free Models - Runs on OpenRouter's free tier models

Tech Stack

Layer Technology
Frontend React 18, Vite, Tailwind CSS
Backend FastAPI, LangChain, SSE
LLM OpenRouter (tencent/hy3-preview:free)
Database SQLite
Deployment Docker, Docker Compose

Quick Start

Option 1: Docker (Recommended)

# Clone the repo
git clone https://github.com/Jai0401/docAgent.git
cd docAgent

# Set your API key
export OPENROUTER_API_KEY=your_key_here

# Start everything
docker-compose up

Frontend: http://localhost:5173
Backend API: http://localhost:8000

Option 2: Manual Setup

Backend:

cd backend
pip install -r requirements.txt
export OPENROUTER_API_KEY=your_key_here
uvicorn main:app --reload --port 8000

Frontend:

cd frontend
npm install
npm run dev

API Endpoints

Method Endpoint Description
GET /ping Health check
POST /generate Start generation
GET /stream/{id} SSE progress stream
GET /result/{id} Get generated content
POST /regenerate/{id} Regenerate
GET /history List all generations

Example

# Generate documentation
curl -X POST http://localhost:8000/generate \
  -H "Content-Type: application/json" \
  -d '{"url": "https://github.com/facebook/react", "generation_type": "docs"}'

# Stream progress
curl http://localhost:8000/stream/1

# Get result
curl http://localhost:8000/result/1

Environment Variables

Variable Required Description
OPENROUTER_API_KEY Yes Your OpenRouter API key. Get one free at openrouter.ai/keys

Project Structure

docAgent/
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ main.py           # FastAPI app + endpoints
โ”‚   โ”œโ”€โ”€ db.py             # SQLite operations
โ”‚   โ”œโ”€โ”€ agent/
โ”‚   โ”‚   โ”œโ”€โ”€ loop.py       # Main agent loop
โ”‚   โ”‚   โ”œโ”€โ”€ tools.py      # LangChain tools
โ”‚   โ”‚   โ””โ”€โ”€ prompts.py    # System prompts
โ”‚   โ””โ”€โ”€ services/
โ”‚       โ”œโ”€โ”€ openrouter_service.py  # LLM client
โ”‚       โ””โ”€โ”€ git_service.py         # Git operations
โ”œโ”€โ”€ frontend/              # React app
โ”‚   โ”œโ”€โ”€ src/App.jsx       # Main component
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ Dockerfile
โ”œโ”€โ”€ docker-compose.yml
โ””โ”€โ”€ README.md

How It Works

  1. Clone - Repository is cloned to /tmp/docsmith_repos/{id}/
  2. Explore - Agent uses glob, read_file, grep tools to analyze project structure
  3. Generate - LLM generates docs based on actual file contents
  4. Save - Output saved as OUTPUT.md in the cloned repo directory

License

MIT ยฉ Jaimin Godhani

Contributors

Jai0401

Issues