Runs the test suite and asks a local LLM (Ollama) to explain failing tests and propose fixes. The code never works offline.
debug_agent.pyruns the tests with pytest.- If pytest itself failed to run, the model is not called.
- The source code (with line numbers) and the test output are passed to the local model through the
ollama runcommand. - If the primary model does not answer, the agent switches to the fallback model.
| Role | Ollama model | Base model | Config |
|---|---|---|---|
| Primary | debug-agent-qwen |
qwen3.5:9b |
Modelfile.qwen |
| Fallback | debug-agent-llama |
llama3.1:8b |
Modelfile.llama |
ollama pull qwen3.5:9b
ollama pull llama3.1:8b
python3 -m venv .venv && .venv/bin/pip install pytest
make models # build both models from the Modelfiles
make test # 3 tests fail on purpose
make debug # ask the local LLM to explain the failuressensor_stats.py: demo application with three intentional bugssensor_stats_test.py: pytest tests that expose the bugsdebug_agent.py: the agentModelfile.qwen,Modelfile.llama: model configsMakefile: shortcuts for common commands