Skip to content

Repository files navigation

AgentWork

Multi-agent coding pipeline that takes a Git repo URL and a task description, then autonomously plans, codes, tests, reviews, and creates a PR — running in Docker.

Architecture

User → [Next.js UI] → Streaming API Route (/api/run)
                              │
                              ├─→ git clone (local filesystem)
                              │
                              ├─→ Planner Agent   (read file tree, create plan)
                              ├─→ Coder Agent     (write files locally via LLM)
                              ├─→ Tester Agent    (detect framework, run tests)
                              └─→ Reviewer Agent  (LLM review vs task description)
                                     │
                              ┌──────┘
                              │ if test fails / review rejects → loop back to Planner
                              │ if approved → git push → create PR via GitHub API

Feedback loop: if tests fail or the reviewer rejects, the planner re-analyzes with failure context and tries again (up to MAX_RETRIES).

Quick Start

cp .env.example .env
# Edit .env — set OPENAI_API_KEY and GITHUB_TOKEN

docker compose up --build
# Open http://localhost:3000

Environment Variables

Variable Required Default Description
OPENAI_API_KEY Yes — OpenAI API key
GITHUB_TOKEN Yes — GitHub PAT with repo scope
LLM_MODEL No gpt-4o OpenAI model for all agents
MAX_RETRIES No 3 Max plan→code→test→review iterations

How It Works

  1. Planner clones the repo locally, reads the file tree, and asks GPT-4o to produce a structured plan with per-file subtasks.
  2. Coder reads each file from disk, sends it + the subtask to GPT-4o, writes the new content back to disk.
  3. Tester auto-detects the test framework (pytest, npm test, go test, etc.) and actually runs the tests inside the container. If tests fail, feedback loops to the Planner.
  4. Reviewer examines all changes against the original task. If rejected, feedback loops to the Planner.
  5. On approval, the orchestrator pushes the branch and opens a PR via the GitHub API.

Development (without Docker)

npm install
cp .env.example .env.local
# Set your keys in .env.local
npm run dev
# Open http://localhost:3000

Tech Stack

  • Next.js 15 (App Router)
  • TypeScript
  • Tailwind CSS
  • OpenAI SDK (GPT-4o)
  • Octokit (GitHub API for PR creation)
  • Docker (git, python, node available in container)
  • SSE streaming for real-time logs

About

Multi-agent coding pipeline that takes a Git repo URL and a task description, then autonomously plans, codes, tests, reviews, and creates a PR — deployable to Vercel.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages