Skip to content

About

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

Topics

Resources

Contributing

Stars

817 stars

Watchers

9 watching

Forks

Repository files navigation

Repo2RLEnv

Build verifiable RL environments for coding agents.

PyPI Python versions CI Docs Datasets on the Hub Harbor task format License: Apache-2.0 and MIT

Documentation · Quickstart · Pipelines · Datasets · Changelog

Repo2RLEnv: source material to Harbor tasks

Repo2RLEnv turns repositories, pull requests, agent trajectories and task seeds into Harbor tasks. Each task includes an instruction, a starting environment, a verifier and a reference solution. Repo2RLEnv generates and reviews the tasks; Harbor runs agents against them.

flowchart LR
    S["Repo, PR, trajectory or seed"] --> G["Generate a Harbor task"]
    G --> V["Check controls and review"]
    V -->|"Repairable defect"| R["Repair a new revision"]
    R --> V
    V --> E["Keep task and evidence label"]
    E --> U["Evaluate, train or publish"]
Loading

Quickstart

Python 3.12+ and the GitHub CLI are required. This example generates patch-similarity tasks without Docker or model calls:

pip install repo2rlenv
gh auth login

repo2rlenv generate --repo pallets/click --pipeline pr_diff \
  --pipeline-opt limit=3 --out ./tasks
repo2rlenv validate ./tasks --oracle

limit caps candidates, so this may export fewer than three tasks. validate is a file check; it does not run the environment.

To execute these tasks, install the tested Harbor integration and start Docker. Set ANTHROPIC_API_KEY in your shell: PR-diff grading requires a model judge, including when checking the reference solution.

pip install 'repo2rlenv[harbor]'
harbor run -p ./tasks -a oracle --env docker \
  --ve ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY"
harbor run -p ./tasks -a nop --env docker \
  --ve ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY"

An unavailable judge leaves the trial ungraded, not a zero reward. For test-based rewards, choose pr_runtime or Tasksmith instead. Continue the quickstart →

What you can build

Start with Use What the agent does
Merged PRs; no test execution during generation pr_diff Reproduce a change, scored by patch similarity and a correctness judge
PRs or commits with runnable tests pr_runtime, commit_runtime, cve_patches Fix failing tests while preserving passing tests
A merged Python PR needing custom task design Tasksmith Implement the requested behavior, checked by private tests
Repository functions or APIs code_instruct, equivalence_tests Implement functionality against generated or differential tests
Recorded coding-agent sessions trajectory_to_env Repair, build, extend or answer a data question derived from the session
Repositories, seeds, terminal recordings or existing tasks Research recipes Repository repair, reconstruction, terminal work, reasoning or optimization

The recipes include SWE-smith, SWE-gen, SWE-Next, R2E, R2E-Gym, SWE-Flow, CodeMidas, SETA Seed2Synth, SETA Evol, TMax, Endless Terminals, TerminalWorld, CLI-Gym, DataArc, SCALER and FrontierSmith. Their implementation lives in this repository, with upstream credits and retained licenses.

repo2rlenv pipelines list
repo2rlenv pipelines describe repo_mutate --recipe swe_smith

Native generation uses local Docker when it executes code. Tasksmith and research recipes execute target code on Modal or Daytona workers; supported GPU trials use Modal. Choose a pipeline compares inputs, rewards and requirements.

Tasksmith: an agent that builds environments

Tasksmith uses LangGraph with Pi or OpenCode to investigate a merged PR, build its dependencies, design a human-readable task and verifier, and check the reference against the starting code. Review, verifier probes and a blind rollout then guide bounded repairs. Failed or incomplete attempts retain their diagnoses.

Start with the one-PR walkthrough, then use batch campaigns to share bootstrap work and control spending.

Check task quality

A generated task is not automatically suitable for training. Check that the reference works, the baseline fails as expected, and the verifier measures the instruction. The shared quality loop can review files and rollouts, probe the verifier and repair supported offline tasks. The optional evidence reviewer records findings with source excerpts and proposed repairs.

Tasks carry uniform labels: unverified, verified, needs_repair or blocked. Labels describe retained evidence for that task revision; solver success is a separate measurement. Quality and verification →

Datasets

Browse the FineEnvs collection or Harbor Visualizer. The release inventory records dataset revisions, counts and validation scope. The yield and cost report separates generation, quality review and solver costs.

HF_ML_Tasksmith contains 50 tasks from Accelerate, Diffusers, PEFT, Transformers and TRL, labeled verified under the campaign's recorded checks. Other collections include unverified tasks. Older published artifacts do not automatically receive new generator or verifier fixes.

hf download FineEnvs/HF_ML_Tasksmith tasks.tar.gz --repo-type dataset --local-dir ./hf-ml-tasksmith
tar -xzf ./hf-ml-tasksmith/tasks.tar.gz -C ./hf-ml-tasksmith
repo2rlenv tasks list ./hf-ml-tasksmith/tasks

Documentation

Docs describe current main; PyPI installs the latest published release. Use the checkout installation for unreleased changes. A text index is available at llms.txt.

Contributing

Read CONTRIBUTING.md. For a new generator, open an issue and start with an RFC and the pipeline contribution guide.

License and credits

Repo2RLEnv's own code is Apache-2.0. Bundled adaptations retain MIT and Apache-2.0 terms, so the distribution is Apache-2.0 AND MIT. Third-party notices document each source and attribution. Generated tasks and source repositories retain their own license terms.

About

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

Topics

Resources

Contributing

Stars

817 stars

Watchers

9 watching

Forks

Releases

Packages

Used by

Contributors

Languages