Skip to content

Add an RL evaluation example - #908

Merged
SaladDay merged 2 commits into
mainfrom
feat/rl-eval-example
Oct 29, 2026
Merged

SaladDay merged 2 commits into
mainfrom
feat/rl-eval-example

Conversation

@SaladDay

@SaladDay SaladDay commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Adds example/rl-eval/, a single Python script that uses the public /v1 Agents API as a rollout engine for RL and evaluation.

Each rollout is one hosted Session with network disabled: the task files go in as inline initial files, the instruction as input, and the answer comes back as the Artifact /workspace/outputs/answer.json. The script grades it outside the sandbox (expected.json never enters it), records the Items and Turn usage, deletes the Session, and appends one JSONL row per rollout. It runs a Harness × model × K-sample matrix in parallel, handles timeouts by cancelling the Turn, and prints mean reward and pass@k. --model-base-url with {rollout_id} points rollouts at a training-side inference server, which is where token ids and logprobs are recorded.

Five bundled tasks (CSV aggregation, log counting, a small bug fix, nested JSON, SQLite) need only the managed sandbox image. Tasks graded inside their own container (SWE-bench, Terminal-Bench) need self_hosted and are out of scope.

Also:

  • docs/examples.md (+ zh) gets an "RL and evaluation rollouts" section; CONTRIBUTING.md names the example's owner and boundary.
  • make check-example runs the example's unit tests; scripts/ci_plan.py routes .py/.sh under example/ to the example job.

Verification

  • python3 example/rl-eval/rl_eval_test.py: 9 tests pass (grading, pass@k, summary, task loading).
  • scripts/ci_plan_test.py and core-distribution-manifest.test.py BundledDocsTests pass.
  • Every expected answer was recomputed independently from the task files.
  • Live runs on a test deployment (microsandbox nodes, MiniMax-M2.7):
    • --harness codex --harness claude_sdk --samples 2: 20/20 rollouts completed with reward 1.0 (table in the README).
    • --harness claude_sdk --model MiniMax-M2.7 --model-base-url … --model-protocol anthropic: 5/5 with reward 1.0 through the per-rollout provider path.
    • --timeout 8: the rollout is recorded as timeout with its usage and Items; the Turn is cancelled and the Session deleted.
    • mcode on that deployment is rejected at create (NFS workspace storage needs retained native history); each rollout is recorded as error and the batch continues.
    • No Session was left in the Project after the runs.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@blacksmith-sh

This comment has been minimized.

@SaladDay
SaladDay merged commit d5a9c31 into main Oct 29, 2026
25 checks passed
@SaladDay
SaladDay deleted the feat/rl-eval-example branch October 29, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant