An extensible baseline for building, testing, and training sandboxed AI coding agents.
The world of AI coding agents is filled with complex frameworks that hide core mechanics and naive environments that lack proper security. We wanted a transparent, unopinionated, and secure-by-default starting point. This is it.
Simple Coder provides a minimal, high-fidelity sandbox so you can focus on building your agent, not the boilerplate around it.
- Sandboxed by Default: All command execution happens inside a Docker container, volume-mounted to a local directory. The agent can explore and make changes without compromising the host system.
- Transparent Agent Loop: The
(Agent -> Tool -> Environment)loop is the fundamental unit of work. It is exposed directly ingen_env/env.py, making it easy to inspect, debug, and extend. - Real-World Artifacts: When the agent completes its task, it generates a standard
git diff. This isn't a proprietary format; it's a universal patch that reflects the agent's work against the initial state of the project.
The entire process is orchestrated by the GenEnv class, which manages a single "episode" of the agent's work.
-
Initialization: When
GenEnv.run_episode(directory, prompt)is called, it:- Copies the target project into a temporary workspace.
- Initializes a
gitrepository and creates an initial commit to serve as a clean baseline. - Starts a lightweight Docker container with the project directory volume-mounted to
/workspace.
-
The Agent-Tool Loop:
- The
GenEnvAgentis given the user's prompt and a definition of its available tools (shell,finish). - The agent decides which tool to use.
GenEnvintercepts the call and executes it in the appropriate context (e.g.,docker execfor shell commands). - The tool's output (
stdoutandstderr) is sent back to the agent, and the loop continues.
- The
-
Completion:
- The episode ends when the agent calls the
finishtool or reaches themax_stepslimit. GenEnvgenerates a finalgit diffagainst the initial commit, producing a clean patch file.
- The episode ends when the agent calls the
- Python 3.9+
- Docker Desktop (must be running)
- An OpenAI API key
-
Clone the repository:
git clone git@github.com:julianallchin/simple-coder.git cd simple-coder -
Create an environment file: Create a file named
.envin the project root and add your API key:OPENAI_API_KEY="sk-..." -
Install dependencies:
pip install -r requirements.txt
-
Run the demo:
python main.py
This will start an agent tasked with fixing a bug in the
examples/fix_testsdirectory. The agent will build a Docker image, run tests, apply changes, and verify the fix.
