AI & ML Research 2025
RepoGym
RL environment for software engineering
The problem
Training agents to do real software engineering work needs an environment that looks like real engineering - isolated execution, real tools, and rewards grounded in whether the code actually works - not a static code-completion dataset.
The approach
Built a Gymnasium-compatible RL environment where agents interact with a real repository through structured tool actions (read, write, run tests, git), execute in Docker-isolated sandboxes, and get shaped rewards from test passage and code quality, with full trajectory telemetry surfaced in a React dashboard.
RepoGym is a standardized reinforcement learning environment for software engineering (SWE) tasks. It frames coding as an interactive, tool-using process instead of one-shot code generation, and gives agents a real (sandboxed) repository to work in.
environment design
Agents interact with the environment through structured tool actions, not raw text diffs: reading files, writing changes, running tests, and using git. Every episode executes inside a Docker-isolated sandbox, so agent-generated code never touches the host.
import repogym
env = repogym.make("BugFix-v1")
obs = env.reset()
while not done:
action = agent.act(obs) # read_file / write_file / run_tests / git_diff
obs, reward, done, info = env.step(action)
# reward: shaped from test passage + code quality signals
# info: test results, diagnostics, trajectory metadata
reward shaping
Rewards combine test passage with code-quality signals, rather than a bare pass/fail. That shaping is what makes learning tractable in a domain where most trajectories end in failure - the agent needs partial credit for getting closer, not just a binary outcome at the end.
telemetry and dashboard
Every trajectory - actions taken, tool outputs, reward breakdown - is logged and surfaced through a React dashboard, which turns debugging an agent’s behavior from log-scraping into something you can actually look at.
status
RepoGym is a research environment: the core loop (Docker execution, structured actions, shaped rewards, telemetry) is in place, and it’s the substrate I’m using to study RL for SWE agents.
What I took away
- Reward shaping matters more than reward magnitude in sparse, test-pass/fail domains.
- Structured tool actions (rather than raw text edits) make credit assignment tractable.
- Sandboxed, Dockerized execution is a hard requirement, not a nice-to-have, once agents can run arbitrary code.
- Trajectory telemetry pays for itself immediately - most debugging is watching what the agent actually did.
0 comments
Loading…