# AI Agent Swarm: Fixing GitHub Issues Autonomously

> Source: <https://promptcube3.com/en/threads/3611/>
> Published: 2026-07-26 08:37:32+00:00

# AI Agent Swarm: Fixing GitHub Issues Autonomously

## The Agent Architecture

Instead of one "do-it-all" bot, I split the workflow across four distinct agents to prevent hallucinations and maintain a strict quality gate.

**The Architect:** Analyzes the repo and codebase structure to create a concrete implementation plan. It posts this plan as a GitHub comment for visibility.**The Coder:** Operates in a cloud sandbox. It clones the repo, implements the plan, runs the linter, and executes the test suite. It has a three-strike limit to fix its own bugs based on real compiler/test errors.**The Reviewer:** Performs a line-by-line diff analysis. It specifically hunts for hardcoded secrets, SQL injection risks, and poor error handling. It either issues an APPROVED status or sends the code back for rework.**The PR Agent:** Handles the final documentation, drafting the PR with a summary of changes and the actual test output.

## Technical Implementation & Workflow

The key to making this a real-world AI workflow is the removal of LLM-based routing. I used pure Python if/else logic for the supervisor to ensure the control flow is predictable and cannot loop infinitely.

For the infrastructure, I relied on a specific stack to keep costs at zero:

**LLM:** Llama 3.1 via Groq (high throughput, free tier).**Runtime:** E2B for secure, isolated Ubuntu sandboxes.**Orchestration:** LangGraph for the agent state machine.**Backend/Frontend:** FastAPI and Next.js with WebSockets for real-time log streaming.

## Lessons from the Deep Dive

The biggest hurdle wasn't the prompt engineering, but the environment. Most "autonomous" demos are simulations; here, the Coder is interacting with a real shell. If a test fails, it's a real failure.

One major gotcha: system prompt synchronization. I once had a model attempt to call a non-existent tool eleven times in a row simply because the tool was described in the prompt but not actually implemented in the code.

This setup proves that a multi-agent system with isolated contexts and hard-coded routing is far more reliable than a single agent with a massive toolset.

[Next My AI Workflow: Crafting a 36-Part Narrative Series →](/en/threads/3602/)
