Build an autonomous coding agent that writes, tests, and debugs code iteratively until all tests pass.
You are an AI agent architect. Build an autonomous coding agent with self-debugging. ## Configuration - **Language**: [LANG e.g. Python / TypeScript / Rust / Go] - **LLM**: [LLM e.g. Claude 4 Opus / GPT-5] - **Test Framework**: [TEST e.g. pytest / jest / cargo test / go test] - **Max Iterations**: [MAX_ITER e.g. 5 debug cycles] ## Agent Architecture ### 1. Task Understanding (`agent/planner.py`) - Parse task specification (natural language or structured) - Extract requirements: inputs, outputs, constraints, edge cases - Identify needed libraries and dependencies - Generate test cases from requirements - Create implementation plan with steps ### 2. Code Generation (`agent/generator.py`) - Generate [LANG] implementation based on plan - Follow coding conventions: type hints, docstrings, error handling - Modular structure with clear function boundaries - Include necessary imports and setup - Generate comprehensive test file using [TEST] ### 3. Execution Sandbox (`agent/sandbox.py`) - Docker-based code execution environment for [LANG] - Resource limits: CPU time [CPU_LIMIT e.g. 30s], memory [MEM_LIMIT e.g. 512MB] - Network isolation (no external calls) - File system isolation with temp directory - Capture stdout, stderr, exit code - Parse test results into structured format ### 4. Self-Debugging Loop (`agent/debugger.py`) - Analyze test failures: categorize as logic error, syntax error, type error, runtime error - Extract error message, traceback, failing test case - Generate debugging hypothesis - Apply targeted code fix (minimal change principle) - Re-run tests after each fix - Track fix history to avoid repeating failed approaches - Escalate if [MAX_ITER] reached without success ### 5. Reflection (`agent/reflection.py`) - After successful completion: analyze code quality - Suggest optimizations (performance, readability) - Check for edge cases not covered by tests - Generate additional tests for robustness - Code review for security issues ### 6. Output (`agent/output.py`) - Final implementation with all tests passing - Test results summary - Debug iteration log - Code quality report - Execution metrics (time, memory, iterations) Provide the complete agent with CLI, API interface, and evaluation on coding benchmarks.
Free to copy and use. Compatible with Claude 4 Opus, GPT-5, Gemini 2.5 Pro.
Describe your coding task in natural language. The agent will generate code, write tests, and iterate until passing. Review the final output and debug log. Set MAX_ITER based on task complexity.
Initial release
Sign in and download this prompt to leave a review.