A small autonomous coding agent built from first principles in Python using the OpenAI Responses API.
Agent 002 accepts a coding goal and autonomously decides which tools to use to complete it.
Its current tools are:
list_files— inspect the project workspaceread_file— read source codewrite_file— modify source coderun_python— execute Python files and observe the result
The core architecture is:
Goal → Decide → Act → Observe → Decide Again → Complete
For example:
User goal:
Find the bug, fix it, and verify that the fix works.
Agent 002 can autonomously perform:
- List project files
- Choose a relevant file
- Read its source code
- Identify a bug
- Modify the code
- Execute the program
- Observe stdout, stderr, and the return code
- Decide whether the task is complete
The sequence is not hard-coded. The model chooses tools based on the goal and observations it receives.
Agent 002 includes several basic controls:
- File access restricted to the configured workspace
- Python-only execution
- 10-second execution timeout
- Maximum 10-step agent loop
- API key stored outside source code using
.env
Given a program containing:
return total / 0