Build and Fix Loop
Purpose
An autonomous loop for the agent to identify, analyze, and fix build errors using make build.
Loop Logic
- •Identify: Run
make buildto identify build failures. - •Analyze: Examine the build output to determine:
- •The failing component (e.g.,
hatchbuild error). - •The specific error message (e.g., missing dependencies, syntax errors, packaging issues).
- •Refer to ../common-references/python-commands.md for build commands.
- •The failing component (e.g.,
- •Fix: Apply the minimum necessary change to resolve the error (e.g., updating
pyproject.toml, fixing syntax, or adding missing files). - •Verify: Re-run
make build.- •If passed: Finish.
- •If failed: Analyze the new failure and repeat the loop.
Termination Criteria
- •The project builds successfully (as reported by
make build). - •Reached max iteration limit (default: 5).
- •The error persists after multiple distinct fix attempts, indicating a need for human intervention.
Examples
Scenario: Fixing a packaging error
- •
make buildfails because of a missing dependency inpyproject.toml. - •Agent analyzes the error, adds the dependency using
uv add. - •
make buildnow passes.
Resources
- •Python Development Commands: Common commands for building and managing dependencies.
- •Hatch Documentation: Official documentation for the Hatch build backend.