Skip to main content

Repo2RLEnv

Turn repositories, pull requests and task seeds into executable RL environments.

PyPI Python versions CI License: Apache-2.0 and MIT Harbor task format

Quickstart · Pipelines · Output · Datasets · Documentation

Repo2RLEnv — generate, verify and share RL environments

Repo2RLEnv generates coding, terminal and reasoning tasks in the Harbor format: a task instruction, starting environment, reference solution and executable verifier. Run them with Harbor agents, inspect their quality, and publish them to the Hugging Face Hub.

Repository / PR / task seed
            │
            ▼
 Native pipeline · Tasksmith · Research recipe
            │
            ▼
 Harbor task: instruction + environment + solution + verifier
            │
            ▼
 Static checks → baseline / oracle → review and learner rollout
            │                          ↺ bounded repair
            ▼
 Labeled tasks + evidence → Hugging Face Hub → training / evaluation

Generation methods have different checks. The shared quality workflow can review and repair emitted tasks; exporting a task alone does not establish its quality.

Quickstart

Requires Python 3.12+ and Git. This example generates PR-diff tasks without building a container:

pip install repo2rlenv

# GitHub access; alternatively set GITHUB_TOKEN
gh auth login

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

repo2rlenv validate ./workspace/click-tasks --deep
repo2rlenv pipelines list

For test-based repository tasks, use pr_runtime or Tasksmith. LLM stages need a provider key such as ANTHROPIC_API_KEY or OPENAI_API_KEY. Native runtime pipelines build and cache Docker environments; owned recipes and Tasksmith build and execute remotely through Daytona or Modal.

Install the extras your route needs:

pip install 'repo2rlenv[tasksmith,daytona,harbor]'
# Other extras: modal, mutation
repo2rlenv tasksmith install-runtime  # Pi / OpenCode; requires Node.js 22.19+

See the quickstart for execution and publishing, and authentication for model, sandbox and Hub credentials.

Pipelines

Native pipelines

Pipeline Task
pr_diff Reproduce a real PR change; scored by diff similarity and an optional LLM judge
pr_runtime Fix a PR regression; failing tests must pass while existing tests stay green
commit_runtime Build the same test-based task from commit history
code_instruct Solve an LLM-authored problem grounded in repository APIs
equivalence_tests Implement a function matching a private reference
cve_patches Repair a vulnerability identified through public CVE and fix-commit records

The first three are marked stable; the others are experimental. Supported source hosts and languages vary by pipeline. See the pipeline guide.

Tasksmith

Tasksmith adaptively converts a merged PR into a Harbor task. LangGraph orchestrates Pi or OpenCode to investigate the change, establish a working environment, and design the instruction and private verifier. The merged implementation supplies the oracle. Baseline checks, review, learner rollouts and bounded repair produce labeled revisions with execution evidence and cost records.

Tasksmith is experimental and currently targets testable Python changes. CPU execution supports Daytona and Modal; the implemented GPU route uses Modal L4 GPUs. Start with the one-PR walkthrough, which includes example inputs, provider setup and an explicit spending limit.

Research recipes

These 14 experimental recipes adapt published methods into code owned by this repository. No upstream research package is installed at runtime. A pipeline names the generation family; a recipe selects its method.

Recipe Pipeline family Task
swe_smith repo_mutate Repair an introduced source defect
swe_gen pr_to_env Implement a supplied merged PR's behavior
swe_next pr_runtime Repair a task mined from PR history
r2e_gym commit_runtime Repair a task mined from commit history
swe_flow repo_reconstruct Reconstruct functions in dependency order
r2e equivalence_tests Match a private reference through generated tests
cli_gym env_repair Restore a damaged development environment
seta_seed2synth terminal_synth Solve a terminal task derived from question/answer seeds
seta_evol task_evolve Solve an evolved Harbor task
dataarc terminal_synth Solve a related or harder variant of a Harbor seed
tmax terminal_synth Solve a task sampled from a skill taxonomy
endless_terminals terminal_synth Solve a task sampled from categories and scenarios
terminalworld terminal_reconstruct Reproduce an outcome from a terminal recording
scaler reasoning_synth Solve a reasoning instance generated from a problem family
repo2rlenv pipelines describe repo_mutate --recipe swe_smith --json

Each recipe walkthrough includes configuration, a pipeline diagram, model prompts, verification steps, limitations and upstream credits. Use its example config with repo2rlenv generate --config <config.yaml>.

Harbor output

<task-id>/
├── instruction.md          # Learner's task
├── task.toml               # Runtime, resources, provenance and evaluation labels
├── environment/            # Dockerfile, source snapshot and fixtures
├── solution/solve.sh        # Private reference entrypoint
└── tests/test.sh            # Trusted verifier entrypoint

Private solutions and tests belong to their respective execution phases; the whole task bundle is not the learner workspace. Task assets and reference formats vary by recipe. Most owned verifiers return deterministic 0/1 rewards; SCALER uses −1/+1, and native pipelines also support graded test and diff-similarity rewards.

With the harbor extra and a configured runtime, execute a reference solution:

harbor run -p ./workspace/click-tasks -a oracle --env docker

validate --deep checks files and metadata without execution. Use review and repair for instruction quality, verifier defects, leakage and rollout evidence.

Datasets and quality

Explore the HuggingEnvs collection with the Harbor Visualizer. The release inventory records per-pipeline task counts, revisions and validation scope; the economics guide reports measured yield and cost per task.

The Tasksmith reference cohort contains 50 verified tasks from an assisted campaign. Research-recipe exports retain separate quality labels, including unverified and needs-repair. Consult the recorded evidence before using a cohort for training or evaluation.

hf auth login  # Or set HF_TOKEN with write access to your namespace
repo2rlenv push ./workspace/click-tasks <your-org>/<dataset-name>
repo2rlenv pull <your-org>/<dataset-name> ./workspace/downloaded-tasks

Documentation and contributing

Documentation · Exact prompts · Design RFCs · Contributing · Adding a pipeline · Release notes

License and credits

Repo2RLEnv's own code is Apache-2.0. Bundled adaptations retain their MIT and Apache-2.0 licenses; the distribution is Apache-2.0 AND MIT. Third-party notices link each recipe's source revision, retained material and attribution. Source repositories and generated task assets retain their respective terms; check each dataset's license and provenance before redistribution.

Release files for repo2rlenv 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for repo2rlenv 0.9.0
File Size Uploaded
repo2rlenv-0.9.0.tar.gz 652.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for repo2rlenv 0.9.0
File Interpreter ABI Platform
repo2rlenv-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.5 MB

Release files / repo2rlenv-0.9.0.tar.gz

Download URL repo2rlenv-0.9.0.tar.gz
Size 652.7 kB
Tags Source
SHA-256 checksum
How to use checksums
cc76f2cde9a00ae1ea0fd6eb0f87b77e8453ea0b49a693369059728e5b4c03ea
BLAKE2b-256 checksum
How to use checksums
2612ed13a17db621038a8124da9b063bcac3105e00eed88940f353079d1e9773
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / repo2rlenv-0.9.0-py3-none-any.whl

Download URL repo2rlenv-0.9.0-py3-none-any.whl
Size 861.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9531b3bd2ad6e9bbae0824aef39bd8a680bc30225caa3294102044f9bdfb7062
BLAKE2b-256 checksum
How to use checksums
2752c21e81ce6b72eccb4e533a09b6e255eb6c80020547965ca603ebc16996b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.9.2

2 release files

0.9.1

2 release files

This release

0.9.0 This release

2 release files

0.8.8

2 release files

0.8.7

2 release files

0.8.6

2 release files

0.8.5

2 release files

0.8.4

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page