LangGraph State Machine Engine

System Architecture

A deterministic, state-machine driven agentic workflow. Each node is a specialized AI agent that reads from a shared BugifyState, executes, and writes results — enabling conditional retry branching and full traceability.

Live Node Execution Flow

LangGraph Compiled State Graph

6 nodes1 conditional router3 max retries
Conditional Router: if tests_fail && retries < 3 → loops back to Fix Node
Pydantic State Schema

TypedDict BugifyState

Strictly typed state schema defined in orchestrator/state.py. Every agent reads from and writes to the same immutable state, guaranteeing 100% context preservation across all 6 nodes.

class BugifyState(TypedDict, total=False):
    # ── Inputs ──────────────────────────
    problem_description: str
    traceback:           str
    repo_path:           str

    # ── Agent Outputs ───────────────────
    diagnosis:     Optional[BugReport]
    code_analysis: Optional[CodeAnalysisResult]
    research:      Optional[ResearchResult]
    patch:         Optional[PatchResult]
    verification:  Optional[TestSuiteResult]

    # ── Control Flow ────────────────────
    current_stage:   str
    iteration_count: int     # max = 3
    error:           Optional[str]
    is_success:      bool
Dynamic Router

Conditional Edge Router

The router in orchestrator/router.py inspects verification results and patch review scores — routing autonomously without human intervention.

def route_after_verification(
    state: BugifyState
) -> str:
    verif = state.get("verification")
    n = state.get("iteration_count", 0)

    # Success: all tests passed
    if verif and verif.tests_passed:
        return "complete"

    # Retry loop: re-enter fix node
    if n < MAX_RETRIES:  # MAX_RETRIES = 3
        return "fix"

    # Exhausted: graceful degradation
    return "complete"  # returns best-effort
REST API Endpoints
POST /api/v1/debugGET /api/v1/healthGET /api/v1/status
Orchestration
LangGraph
State machine + conditional edges
LLM Engine
Groq LLaMA 3.3
Ultra-low latency inference
Vector Store
Qdrant
384-dim dense embeddings
API Layer
FastAPI
Async Python ASGI server
Sandbox
Docker
python:3.11-slim isolated
Schema
Pydantic v2
TypedDict strict validation
Run the Workflow in Debug Console →