huggingface/Repo2RLEnv

Turn any repository into verifiable RL environments for coding agents - Harbor tasks you can train on, evaluate and share on the Hugging Face Hub

What is Repo2RLEnv?

Repo2RLEnv is a tool that automatically turns real software repositories into practice tasks for AI coding agents. Each task gives an agent a real coding problem, and a program (not a human) decides whether the agent solved it correctly.

Why it exists

Coding agents improve by attempting real tasks and getting automatic feedback. But building these tasks by hand takes hours each, and reinforcement learning needs thousands of them. Repo2RLEnv builds them from material that already exists — merged pull requests, commit history, security advisories, a library's own functions, terminal recordings, and problem families.

Key idea: the "Harbor task"

Every generator produces a standard Harbor task — a folder containing:

  • instruction.md — what the agent is asked to do
  • task.toml — resources, provenance, and evaluation label
  • environment/ — the starting container the agent works in
  • tests/ — the private verifier that writes the reward (hidden from the agent)
  • solution/ — the reference solution, called the "oracle"

The agent sees only the instruction and the starting environment. The verifier and reference solution stay private until grading.

How quality is ensured

Each generated task goes through controls: the oracle (reference solution) must score 1, and a no-op (doing nothing) must score 0. If a task fails these checks, a review-and-repair loop fixes it. Tasks carry evaluation labels recording how thoroughly they've been checked.

What kinds of tasks it can build

There are 23 generators, grouped by what they start from and how the agent's work is scored:

Kind of task What the agent does How it's scored
Repository repair Fix real code in a real repo (from PRs, commits, CVEs) The repo's own tests: failing ones must pass, passing ones must stay green
Implementation / reconstruction Write or restore functionality Hidden or differential tests
Patch similarity Reproduce a real change Diff similarity plus a required correctness judge; no test suite needed
Terminal tasks Reach a certain state in a shell State checks in the container
Reasoning / optimization No repository at all — pure problems Exact answers (−1/+1) or a continuous score in [0, 1]

Tasksmith: an agent that builds environments

Most generators filter for pull requests that pass their criteria. Tasksmith instead adapts to each pull request individually. Pointed at a merged PR, it:

  1. investigates the change and the surrounding repository,
  2. bootstraps the repo's environment on a remote worker,
  3. designs the instruction and a private verifier,
  4. builds the Harbor task with the merged code as the reference solution,
  5. reviews and repairs its own work until the controls pass.

It orchestrates Pi or OpenCode agents with LangGraph, runs on Daytona or Modal, and records evidence and cost for every stage.

Quickstart (5 minutes)

pip install 'repo2rlenv[harbor]'
gh auth login

# Turn three recent merged PRs from pallets/click into Harbor tasks
repo2rlenv generate --repo pallets/click --pipeline pr_diff \
  --pipeline-opt limit=3 --out ./tasks

# Check the task structure and oracle assets
repo2rlenv validate ./tasks --oracle

Running tasks requires Docker. PR-diff grading also needs a correctness judge (set ANTHROPIC_API_KEY). Without a valid judge response, PR-diff results are ungraded with a zero reward placeholder.

Published datasets

The project publishes 21 datasets with 1,930 tasks on the Hugging Face Hub, each with generation evidence and per-task evaluation labels. You can pull one and run it:

repo2rlenv pull FineEnvs/repo2rlenv-pr-runtime ./pr-runtime
harbor run -p ./pr-runtime -a oracle --env docker

Publishing your own is one command: repo2rlenv push ./tasks <your-org>/<dataset>.

Installation

pip install repo2rlenv                               # native pipelines and the CLI
pip install 'repo2rlenv[harbor]'                     # + Harbor, to run and review tasks
pip install 'repo2rlenv[tasksmith,daytona,harbor]'   # + Tasksmith on Daytona (or modal)

Native runtime pipelines use local Docker. Tasksmith, the research recipes, and the review loop need a Modal or Daytona account and run on Linux, macOS, or WSL.

License

Repo2RLEnv's own code is Apache-2.0. The research recipes are credited, independent adaptations of published methods; bundled adaptations keep their MIT and Apache-2.0 licenses, so the distribution is Apache-2.0 AND MIT. Source repositories and generated tasks keep their own terms — check each dataset's license before redistributing.

Notable recent additions

  • FrontierSmith (v0.9.3): turns closed-ended programming problems into optimization tasks with continuous, deterministic rewards — no known optimum, so a better solution earns more.
  • CodeMidas (v0.9.2): rebuilds removed features from their behavioral contract, with execution-grounded tests and independent rollout review.
  • Tasksmith (v0.9.0): the adaptive environment-building agent, plus 15 research recipes (SWE-smith, R2E-Gym, SWE-gen, SETA, SCALER, and more) on one shared execution and review layer.

Related

  • Project
  • Project
  • Dispatch
  • Project
  • Project