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.
tests_fail && retries < 3 → loops back to Fix NodeStrictly 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: boolThe 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