Skip to content

Olanrewajuemmanuel/self-correcting-coder

Repository files navigation

Self-Correcting-Coding Agent

A LangGraph-powered agent that accepts a natural language coding task, generates Python code, runs it against a test suite, executes it in an isolated sandbox, captures any errors, and autonomously loops back to fix itself — until the code runs successfully or a retry limit is reached.

Graph

Setup

This project uses UV for package management and dependency resolution.

Installation

uv sync
# Or
uv sync --no-dev

Running the Agent

Make sure you have langgraph-cli installed:

uv pip install langgraph-cli[inmem]

Then run:

langraph dev

You will be navigated to the LangGraph playground where you can test the agent.

Environment Variables

Create a .env file in the root directory with the following variables (An example is provided in .env.example):

AI_API_KEY=your_api_key_here
LLM_PROVIDER=openai
MODEL=gpt-4o

or
```bash
AI_API_KEY=your_api_key_here
LLM_PROVIDER=anthropic
MODEL=opus-4

LLM providers supported: openai, huggingface, and anthropic. To enable tracing with Langsmith, set LANGSMITH_PROJECT and LANGSMITH_API_KEY in your .env file.

Testing

make test
make integration_tests

About

Langgraph-powered agent that runs a coding task in gVisor

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors