← Back to projects

Personal project

BugFixer

An agent-assisted debugging project using LangGraph, filesystem tools through MCP, and a pytest tool to investigate a codebase and suggest fixes.

In progress

In progress. The current implementation connects code inspection and test execution; a demonstrated repair workflow is still being developed.

System architecture

BugFixer: agent investigation and tool feedback loopComponent and data flow map · based on repository code

On smaller screens, scroll the diagram horizontally or read the text version below.

BugFixer: agent investigation and tool feedback loopThe CLI loads configured filesystem MCP tools and a separate pytest tool, then starts a LangGraph workflow with message state. The model either finishes with a diagnosis and suggested fix or routes tool calls through ToolNode. Filesystem access and captured pytest output return as tool results for the next model step. A verified patch-and-rerun workflow remains future work.Current implementation · investigation and suggestionsstartload settingsinitial messagesmessage historymodel outputtool callsno tool calls → finishfilesystem toolrun_tests toolfile accessexecute tests in configured codebaseDebugging requestCLI prompt in main.pyFind bug · explain · suggest fixApplication entry pointLoad MCP + pytest toolsCompile and invoke the graphCodebase configurationSettings.codebase_dirFilesystem server directoryMessage stateadd_messages reducerRequest + model / tool historyModel nodeOpenAI model with bound toolsChooses tools or final responseConditional routingLangGraph tools_conditionTool calls → tools; else finishDiagnosis + suggestionFinal assistant messagePrinted to the CLITool executionLangGraph ToolNodeDispatch + return tool resultsTarget codebaseSource files and test suiteConfigured local directoryFilesystem MCP serverstdio · npx filesystem serverTools loaded through MCP clientpytest subprocessuv run pytest · 60s timeoutCaptured output + exit status

Solid arrows: application and data flow. Dashed arrows: feedback or deployment configuration.

Read components and connections as text

The CLI loads configured filesystem MCP tools and a separate pytest tool, then starts a LangGraph workflow with message state. The model either finishes with a diagnosis and suggested fix or routes tool calls through ToolNode. Filesystem access and captured pytest output return as tool results for the next model step. A verified patch-and-rerun workflow remains future work.

  • Debugging request: CLI prompt in main.py. Find bug · explain · suggest fix.
  • Application entry point: Load MCP + pytest tools. Compile and invoke the graph.
  • Codebase configuration: Settings.codebase_dir. Filesystem server directory.
  • Message state: add_messages reducer. Request + model / tool history.
  • Model node: OpenAI model with bound tools. Chooses tools or final response.
  • Conditional routing: LangGraph tools_condition. Tool calls → tools; else finish.
  • Diagnosis + suggestion: Final assistant message. Printed to the CLI.
  • Tool execution: LangGraph ToolNode. Dispatch + return tool results.
  • Target codebase: Source files and test suite. Configured local directory.
  • Filesystem MCP server: stdio · npx filesystem server. Tools loaded through MCP client.
  • pytest subprocess: uv run pytest · 60s timeout. Captured output + exit status.
  • Debugging request → Application entry point: start.
  • Codebase configuration → Application entry point: load settings.
  • Application entry point → Model node: initial messages.
  • Message state ↔ Model node: message history.
  • Model node → Conditional routing: model output.
  • Conditional routing → Tool execution: tool calls.
  • Conditional routing → Diagnosis + suggestion: no tool calls → finish.
  • Tool execution → Model node: tool results → next model step.
  • Tool execution ↔ Filesystem MCP server: filesystem tool.
  • Tool execution ↔ pytest subprocess: run_tests tool.
  • Filesystem MCP server ↔ Target codebase: file access.
  • pytest subprocess → Target codebase: execute tests in configured codebase.

Purpose

Explore an agent workflow that uses code and test output to explain bugs and propose fixes. The aim is to make a diagnosis traceable to the files inspected and the failures observed.

Current implementation

The entry point loads filesystem tools from an MCP client and adds a tool for running pytest in the configured codebase. A LangGraph workflow alternates between an OpenAI model and tool execution, then prints the conversation. The current request asks the agent to find a bug, explain it, and suggest a fix.

Test feedback

The pytest tool captures subprocess output and applies a 60-second timeout. This gives the agent test feedback to inspect during its investigation. Tool integration is the current foundation; it is not evidence of reliable autonomous repair.

Next milestone

Document a reproducible example with a known failing test, the agent's diagnosis, a proposed patch, and the result of rerunning the test. This remains planned work, with no repair success rate or completed end-to-end result claimed here.

View source