8000 Add RATs: the rats template and Evolver, with a LIBERO example by iamziyuzhao · Pull Request #133 · Infini-AI-Lab/hermit · GitHub
[go: up one dir, main page]

Skip to content

Add RATs: the rats template and Evolver, with a LIBERO example - #133

Open
iamziyuzhao wants to merge 12 commits into
mainfrom
ziyu/rats
Open

iamziyuzhao wants to merge 12 commits into
mainfrom
ziyu/rats

Conversation

@iamziyuzhao
@iamziyuzhao iamziyuzhao commented Nov 29, 2026 •
Copy link
Copy Markdown
Collaborator

Change

RATs ("Playful Agentic Robot Learning", code, project) learns a skill library by play. With no benchmark task given, it proposes a manipulation task in a LIBERO scene, writes and checks the task's BDDL, and solves it with a Code-as-Policy program, in up to six attempts. A memory team then turns successes into skills (Python functions over the robot API, each with a reliability tier) and failures into a failure memory with lessons, and every five iterations it curates both. At test time the library is frozen and RATs' execution team solves LIBERO-PRO with it (RATs Exec, the paper's Table 1).

Hermit could not run it. This PR adds RATs as a method: RATs' own code runs every row, unchanged, at the pinned commit 1fd2ef5, in its own Python 3.10 environment, inside a sandbox the actor starts. One training step is one play iteration. The adapter is RATs' library plus its play state. The final library is evaluated frozen with RATs Exec. The differences from the paper, also in the first paragraph of docs/methods/rats.md:

  • The memory team's update runs in the rollout's RATs process (RATs interleaves it with the attempts), and the Evolver checks and applies what comes back.
  • Every RATs role calls the run's one model (the paper plays with Gemini 3.1 Pro).
  • The plug-in evaluation mode (the library inside CaP-Agent0) is not ported.

What it adds

Part Files
Template rats hermit/adapter/templates/rats/: skills.json (RATs' primitive library L0, the seed), state/ (learnable: iteration digests, failure memory, retry bank, novelty counts, curator histories, loop.json, the last scene), .hermit/check.py, UPSTREAM.md + RATs' license
Acting agent hermit/agent/evolver/methods/rats/actor.py (RatsActor), runner.py (runs under RATs' Python, imports nothing of Hermit)
Evolver rats hermit/agent/evolver/methods/rats/evolver.py, evolver.yaml
Example examples/libero/rats/: train.yaml, val.yaml, test.yaml, test_full.yaml, smoke.yaml, smoke_val.yaml, rows.py, judge.py, launch.sh, serve.sh, sam3_guard.py, graspgen_guard.py + graspgen-python, env_configs/rats_libero_pro_graspnet.yaml, task-info/, README
Docs docs/methods/rats.md; rows in docs/methods/index.md, docs/index.md, examples/libero/README.md; CHANGELOG
Tests tests/methods/rats/test_rats.py (43); the rats group in tests/selection.py, tests/core/test_selection.py, tests/README.md

No core change. Nothing outside the method's three places changes except the indexes, the CHANGELOG, examples/libero/.gitignore and the test-group entries. RATs is a checkout beside Hermit, as ASPIRE's is, not a pyproject.toml dependency group: it needs Python 3.10, its own submodules (LIBERO-PRO, robosuite, Contact-GraspNet, cuRobo, SAM3) and GPU vision services. launch.sh pins its commit and warns when the checkout is on a different one.

How Hermit calls RATs. runner.py calls RATs' own entry point (scripts/run_rats.py main()) and changes RATs at four seams only:

  1. The model. Every model call goes to a ChatEndpoint in the actor's process (one Direct call each, Layer 1). The endpoint holds the provider's key and meters tokens and cost. RATs' _get_api_config names it; Bedrock, Vertex and the Gemini proxy are off; RATs' per-role model variables all name the run's model. RATs' parallel sub-agent workers, which RATs starts as processes of their own (scripts/run_subagent_worker.py), start through runner.py worker and route the same way.

    • Each request carries reasoning_effort (agent.params.effort, default medium, the first-evaluation row's). RATs' own default is low (llm_reasoning_effort in rats/config/default.yaml), and RATs sends it only in its OpenAI form.
    • For a model without video input (agent.params.video: false, the default), every vision call is built from images, as RATs builds it when it has no video: the visual verifier's sampled frames (up to 8), the per-step verifier's images, and the diagnoser's filmstrip (RATS_DIAGNOSER_VISUAL_INPUT=frames, RATs' own setting). RATs' _strip_videos_from_messages drops any video that is left. The feedback generator attaches media only on its MolmoSpaces path, so on LIBERO it sends none either way.
  2. The init states. An exec row's trial j runs in init state first_state + j. RATs seeds iteration n with n, and its LIBERO env takes init state (seed - 1) % 50, so the loop starts after iteration first_state.

  3. What a continuous run keeps in memory. A play iteration is one process, so the runner restores this state before the iteration and saves it after:

    • in state/loop.json: the curation and skill-proposal counters, the curator's rolling history, the bootstrap task's name and the distillation counter;
    • in state/scene/: the scene the last iteration left, i.e. the BDDL RATs generated and its custom verifier. RATs' next iteration falls back to that scene when its own cannot be created. The runner rebuilds it with RATs' EnvironmentCreator.

    Everything else RATs carries lives in its output directory, which RATs' own --resume reads.

  4. The verdict at test. In exec, RATs' Verifier counts only its native vote: task_completed, or reward >= 0.99, behind RATs' own check that the program ran. The structured-custom and visual verifiers' results stay in the evidence but are not counted, so a trial that only the VLM calls solved goes on to its next attempt. RATs' docs/evaluation.md sets RATS_VERIFIER_STRICT_BENCHMARK=1 for this, but no code at 1fd2ef5 reads that variable: there, any of the three votes counts.

Before RATs runs, its own parser (run_rats.py build_parser) reads the arguments the runner gives it, and the runner then applies what run_rats.py fills in from the env config's top-level rats: block (_apply_rats_runtime_defaults). A row is refused if its rats_args or that block change what the row is:

  • its scene, task, output, library, iterations or frozen flags, or a scaled execution timeout;
  • RATs' mock environment (--mock, which reports task_completed at random), a library merged with others or filtered by tier, or playtime or failure memory carried in from other runs;
  • in play, its novel-task mode (--catalog) and the test tasks' descriptions.

Any spelling the parser accepts counts, including abbreviations and --flag=value. RATs' own method switches pass (--no-skill-reuse, --no-failure-memory, --random-order), as do its budget switches (--max-retries, --attempts-per-iteration, --turns-per-attempt, --multiturn-reset, --ensemble, and the env config's attempts_per_iteration, turns_per_attempt and multi_turn_decision): in play, a run that sets one is that RATs ablation, and an exec row holds its frozen flags. A run that changes a budget evaluates another protocol than RATs' default, which the rows' guards also assume.

Trust. RATs' generated programs run in RATs' process, inside the actor's sandbox. The vision services run outside it, as the user who starts serve.sh:

  • A row's sandbox reaches the ports its RATs config names in api_servers (play 8114, 8115 and 8116; test 8114, 8116 and the grasp service), and the ones RATs' policy quality checker probes, 8114, 8115 and 8116 (below). No row reaches Molmo's 8122.
  • serve.sh starts every service with a clean environment (env -i plus a short list): no key or token is in a service's environment. A service still reads what its user can read, which the guards below keep requests from reaching. The clean environment and the guards hold for the services serve.sh started: it leaves a port that already answers alone (and says so), and launch.sh checks only that each port answers.
  • A program can only send the services requests in their protocols, which the guards limit to what RATs' clients send:
    • SAM3 takes base64 images. Its decoder opens any format Pillow knows, and Pillow runs Ghostscript on an EPS image. serve.sh starts SAM3 through sam3_guard.py, which decodes PNG only (RATs' clients send PNG), of at most 4096 × 4096 pixels.
    • Contact-GraspNet reads its arrays with np.load, whose default refuses pickled objects; PyRoki takes numbers.
    • GraspGen takes msgpack. Its NumPy decoder unpickles an array of kind object, and builds one of an object type over the request's bytes, whose elements GraspGen then reads as pointers. Its server stops on a request of more than one ZMQ frame. serve.sh starts GraspGen through graspgen-python, whose graspgen_guard.py refuses every array whose type holds Python objects (RATs' client sends arrays of floats) and answers a request in more than one frame as an error.
  • The actor checks that a row's services (its config's and the ones the quality checker probes) take a connection before it starts RATs and after the row. A row whose services do not before it is not run. After it, an exec row whose trials all succeeded on LIBERO's own check keeps its result (services_down in its output); any other row is a failed run (session_failed), as a trial may have failed for want of the service. Hermit scores a failed run 0 within mean_score and counts it in errors; its trials are in the actor log's result.json, and such a row is to be run again. The check finds a service that has stopped, not one that listens but hangs or fails its requests.
  • A row whose runner was stopped before RATs' run ended (its timeout, a signal, the OOM killer) keeps the exec trials that finished, the rest counted as failed, with the reason in its output and the judge's feedback; a play row's hand-back, which may then be cut short, is not taken (a failed run).
  • The guards limit what a request may hold, not how much work it asks for: a program that sent a shared service large sampling parameters, which RATs' API never sets, could hold it busy for the other rows.

The step

flowchart TD
    A["adapter: skills.json (L) + state/ (M, retry bank,<br/>proposer counts, curator history, loop.json, scene, iteration digests)"]
    P["play row: the actor lays the adapter out as RATs' output directory<br/>and runs run_rats.py --explore --resume for one iteration"]
    I["RATs, in the sandbox: PROPOSE_TASK, create + verify the env,<br/>RUN_TASK (up to 6 attempts), UPDATE_MEMORY<br/>(skills, tiers, failures, lessons; every 5: curators, skill proposer)"]
    H["handed back: skills.json + state/ (digests of the iterations)"]
    C{"template check<br/>(the library's records and code, the state's files)"}
    U["the Evolver replaces skills.json and state/"]
    K["the adapter as it was; the step says why"]
    F["final adapter: the library after the last iteration"]
    E["test: RATs Exec per task, the library frozen<br/>(--fixed-task --no-skill-reuse --no-failure-memory)"]
    A --> P --> I --> H --> C
    C -- passes --> U --> A
    C -- fails, or nothing came back --> K --> A
    A -. after the last step .-> F --> E
Loading

The Evolver reads the step's one play record and the adapter it handed back, and calls only check_spec. It writes skills.json and state/, or leaves the adapter unchanged and says why. Four cases leave it unchanged: a failed play row, a library handed back without its state/ (missing, a link, or empty while the adapter's is not), a hand-back that fails the check, and a state with links or devices. A step with more than one play row fails (data.step_size: 1, agent.concurrency: 1). RATs has no validation step and selects no snapshot, so the final adapter is the library after the last iteration. train.yaml tags a snapshot every ten steps for the validation split to compare.

Data splits (examples/libero/rats/rows.py, task directories in Harbor's format; no row is in two splits)

Split Rows Mode What it is Trials Config
train play-001 ... play-050 play RATs' 50 play iterations (§4.1), one per step. No benchmark task: RATs proposes its own in LIBERO's scenes, from libero_spatial task 0 as RATs' play config does 50 iterations train.yaml
val val-<suite>-tNN, 39 exec the original LIBERO Spatial, Object, Goal, Long: their 40 tasks less play's bootstrap task (libero_spatial task 0); init states 43-49 273 val.yaml
test test-<suite>-tNN, 60 exec LIBERO-PRO's six suites of Table 1 (libero_{object,goal,spatial}_{swap,task}); 10 tasks each; init states 0-9 600 test.yaml
test_full full-<suite>-tNN, 80 exec all eight LIBERO-PRO swap/task suites (with LIBERO-Long's); all 50 init states 4,000 test_full.yaml
smoke_* one each play / exec one play iteration, the first validation row's first trial, one test trial 1 each smoke.yaml, smoke_val.yaml

RATS_ROWS_ARGS changes the sizes (--play, --tasks, --val-states, --test-states, --full-states). launch.sh writes each set of rows once under runs/rows/<key>/, where the key covers the arguments and rows.py itself; runs started side by side share it. A play row whose iteration hands back nothing (RATs crashed, or its state failed the check) leaves the state unchanged, and the next row runs that iteration again, so such a run ends with fewer than 50 iterations; the Evolver's step records say which.

What play and test share:

  • Play never reads a test suite's BDDL files or init states, nor LIBERO-PRO's perturbation specs (libero_ood/, whose ood_task.yaml repeats the test _task instructions). The sandbox hides all of them in play.
  • A play row is refused if its arguments turn on --proposer-include-eval-task-context, in any spelling. That flag is RATs' optional task-aware play, which writes the 60 test tasks' descriptions into the proposer's prompt. LIBERO-PRO's Python task map names every suite's tasks, so play's process could import those names; RATs' proposer reads them only with that flag.
  • The test suites are perturbations of the original ones: a _swap task keeps its original's instruction and scene and swaps the objects' positions; a _task task keeps its original's scene and gets another instruction and goal.
  • Play's bootstrap task, libero_spatial task 0, is the original of libero_spatial_swap's and libero_spatial_task's task 0, so those two test tasks are built on the scene play starts in (as with RATs' own play config and Table 1).

What play and validation share: validation is the original LIBERO, the setting the paper's play is grounded in.

  • Play runs in RATs' default mode, novel tasks. In it, play works in scenes it generates from its catalog of LIBERO's objects and fixtures, and never rebinds to a LIBERO task. A play row is refused if its arguments turn on --catalog: in that mode play rebinds to the bootstrap suite's own tasks (LifelongLoop._rebind_libero_env), libero_spatial's, which are validation rows.
  • It starts in its bootstrap task, libero_spatial task 0, in the init state of the iteration's seed. It falls back to that task when an iteration's scene cannot be created before any scene was; after that it falls back to the last iteration's scene (seam 3). So validation leaves that task out.
  • Play's scenes use LIBERO's objects and fixtures, as the validation tasks do, so validation serves the choice of a snapshot or a setting, not a held-out estimate. Its init states (43-49) are distinct from the test's (0-9).

What validation and test share: 29 of the 39 validation tasks (Spatial's nine, Object's and Goal's ten) appear in the test's _swap suites with the same instruction and goal, their objects' positions exchanged. The _task suites give 14 of their 20 Object and Spatial tasks a validation task's instruction in another task's scene: all ten Object ones, with its goal too (libero_object_task task 0, "pick the cream cheese and place it in the basket", is libero_object task 1's), and four Spatial ones (Goal's none). So a validation score is not a held-out estimate of the test either.

Protocol: train / test. The Evolver learns from the play iterations, and the final library is evaluated frozen on test. An exec row is one RATs LIBERO-PRO batch-driver job (scripts/run_rats_libero_pro_batch.py): one task, all its trials in one RATs process, with --fixed-task --no-skill-reuse --no-failure-memory, and with RATs' Verifier counting only LIBERO's native check (seam 4). A trial counts when RATs' verdict and its last verification's native check both say success. The row's record keeps both, with each trial's task_completed and reward.

  • The library at test, as RATs handles it: each run copies the library it is given into its own output directory and works on that copy (LifelongLoop.__init__), and each batch-driver job has its own output directory. Within a job, RATs records the skills' use on its copy as the trials run (usage counts and tiers; a skill can be deprecated), so a later trial of a task reads the library as the earlier ones left it. A row here is one such job: RATs copies the trained library, which the sandbox shows read-only, into the row's output directory. The trained library itself is never written.
  • At the pinned commit, --no-skill-reuse stops storing extracted skills and the skill proposer, and keeps the planner's retrieval from the frozen library. The flag's help text says otherwise; the batch driver's comment agrees with the code.
  • --adapter none is RATs' no-library condition (skill_library/libero_nonpriv_skills.json, the paper's "No Play").
  • A row's score is the share of its trials that succeeded; a trial that never ran counts as failed.

The authors' implementation against this one

Dimension RATs (Playful-RATs/RATs 1fd2ef5) This port Forced by / decision; acceptable?
When learning happens inside each play iteration, interleaved with the attempts (a lesson after one attempt reaches the next); curation and skill proposal every 5 iterations the same, in the rollout's RATs process; one iteration per step; the iteration numbers continue across steps framework (one rollout per step); acceptable
What the learner sees RATs' own: the proposed task, its env, the attempts' observations, verifier and diagnoser outputs the same; no Hermit judge feedback reaches RATs —
In-memory loop state kept in the one process: the counters, the curator's history, the bootstrap task's name, the current scene and its custom verifier saved and restored around each iteration (state/loop.json, state/scene/); the scene rebuilt from its BDDL with RATs' EnvironmentCreator framework (one process per iteration); acceptable
Each component's carrier skills.json (executable skill records with counters and tiers), the failure memory, the retry bank, etc., in the output directory the same files: skills.json and state/ in the adapter; RATs writes them, the Evolver applies them —
The update add_skill's validation and semantic dedup, RATs' program checker the same, plus the template check on the hand-back; a failing hand-back leaves the adapter unchanged decision (what reaches the adapter is screened); acceptable
Selection none: the library after the last iteration the same —
Models gemini-3.1-pro-preview in play; per-role variables one model in every role (GLM 5.3 Flash in the examples) first-evaluation row; decision
Model access provider keys in RATs' environment; OpenRouter / Vertex / Bedrock routes the actor's metered endpoint; no key in RATs' process framework (metering, isolation); acceptable
Reasoning effort low (llm_reasoning_effort, rats/config/default.yaml), sent only in RATs' OpenAI form; some calls set their own medium on every request (effort); a request of RATs' own that sets one keeps it first-evaluation row (GLM 5.3 Flash, medium); a deviation
Videos in vision calls the visual and per-step verifiers and the diagnoser attach the attempt videos (Gemini takes them); the feedback generator too, on MolmoSpaces only each call built from images, as RATs builds it without a video (video: true keeps the videos) task/model: GLM 5.3 Flash refuses video (HTTP 400); a deviation
Parallel sub-agents one worker process per approach the diagnoser proposes; the first success kills the rest the same processes, started through the runner so that their calls reach the endpoint —
Success at test docs/evaluation.md: RATS_VERIFIER_STRICT_BENCHMARK=1, only the native task_completed. At 1fd2ef5 no code reads it, and the native, structured-custom and VLM votes all count only the native vote (seam 4): a trial that only the VLM calls solved goes on to its next attempt RATs' documented protocol; LIBERO's own success
Budgets 50 play iterations; six attempts per iteration or trial; a policy execution timeout of 180 s (rats/config/default.yaml), under which the self-check, the execution and the sub-agent workers run; no wall-clock cap on a job the same attempts and execution timeout (×11 with render: cpu, below); a guard of 6 h per play row and 2 h per exec trial (timeout_s, trial_timeout_s). A scaled timeout grows each guard by what it can add to the 24 program runs of six attempts (a self-check, two self-repairs' self-checks and the execution each): 18 h and 14 h with render: cpu decision (a hung row ends); acceptable
Rendering MuJoCo through NVIDIA's EGL the same by default; render: cpu renders with Mesa's llvmpipe through EGL, and RATs' execution timeout is scaled by 11 (execution_timeout_scale), the ratio of a step's time measured with two llvmpipe threads host: other processes' CUDA work breaks EGL reads on Hopper GPUs (Validation); the same physics, images differ by renderer noise. The scale bounds a program's whole wall clock, whose model calls, services and IK do not slow down, so a CPU row is somewhat more lenient than 180 s on a GPU (alike for every condition)
Evaluation RATs Exec (batch driver) and plug-in into CaP-Agent0 RATs Exec, one row per batch-driver job decision: the plug-in mode runs a second code base (capx-baseline/); not ported
Test trials 10 per task in the paper (600); 5 in docs/evaluation.md 10 (test.yaml); 5 with --test-states 0-4; all 50 in test_full.yaml the paper's Table 1
Vision services docs/evaluation.md says they auto-launch from the env config; run_rats.py at 1fd2ef5 starts none (scripts/start_servers.sh does) started once by serve.sh from RATs' own server modules, in a clean environment, shared by the rows; SAM3's images limited to PNG, GraspGen's object arrays and multi-frame requests refused; a row whose services do not answer before or after it is a failed run concurrent rows share them; they run outside the sandbox (Trust, above); acceptable
Servers the quality checker probes RATs' policy quality checker probes SAM3's, Contact-GraspNet's, PyRoki's and Molmo's ports when the loop starts and rejects a policy naming a primitive of a server that does not answer (unless the API registers it), which uses up an attempt; RATs' evaluation runs SAM3, Contact-GraspNet and PyRoki every row reaches the probed ports but Molmo's and needs them to answer (the actor checks them with the row's own, launch.sh before the run), so the checker finds what RATs' evaluation host gives it: the trained library's sample_grasp_pose passes the checker at test and fails in RATs' self-check, as there as RATs' evaluation
Molmo (8122) Molmo2-8B served by vLLM: scripts/start_servers.sh starts it, and docs/setup.md lists 8122 among the release configs' ports, but its LIBERO-PRO install leaves out the molmo extra (vLLM), no LIBERO config starts it, and the LIBERO-PRO config calls it optional not started, and no row reaches its port. The LIBERO API's object localization asks Molmo three times (3 s) before SAM3's text prompt, and prints each failed request into the program's output, which RATs' diagnoser reads (first evaluation, below) as RATs' LIBERO-PRO install; a deviation from start_servers.sh
The library at test each job copies it into its own output directory and records the skills' use there as its trials run the same per row; the trained library shown read-only —
Grasp service at test GraspGen (NVlabs/GraspGen, which RATs does not install) GraspGen beside RATs (README); Contact-GraspNet as a recorded deviation (RATS_GRASP=graspnet) task (RATs ships no GraspGen setup)
Isolation none: RATs runs in its checkout with the network the actor's sandbox (below); the services outside it with a clean environment framework
Not ported MolmoSpaces, the real robot, the plug-in mode — scope

Application-side changes (examples/libero/rats/, task-side code):

  • rows.py writes the rows.
  • judge.py turns an exec row's trials into its score, and a play row's own task outcome into its score.
  • launch.sh checks the pinned commit, the services and the key, writes the rows, and runs hermit train or hermit eval.
  • serve.sh starts and stops RATs' four vision services from RATs' own server modules, each with a clean environment. It starts GraspGen through graspgen-python and graspgen_guard.py (Trust, above).
  • env_configs/rats_libero_pro_graspnet.yaml is RATs' LIBERO-PRO config on Contact-GraspNet, for a machine without GraspGen.
  • task-info/ tells the learner what play and evaluation are.

Left out: the plug-in evaluation (CaP-Agent0), MolmoSpaces, the real robot, the Molmo service, and per-role models.

First evaluation (reproduction guide §4): done, its record in examples/libero/rats/README.md. none and play ran at ddad5a1, and the final library's test at a43afa7 (50f84c2 and 45dcc6e since the rebase onto main, Validation): GLM 5.3 Flash in every RATs role at effort medium, reduced in size (RATS_ROWS_ARGS="--play 10 --tasks 0-4 --test-states 0-0"): 10 play iterations, then 30 test trials (the six Table 1 suites, tasks 0-4, init state 0) for the final library against --adapter none, with paired differences and standard errors. Rendering is on the CPU (RATS_RENDER=cpu; see Validation). The full protocol is 50 play iterations and 600 test trials. With this model on the CPU, a play iteration took 3 minutes (every attempt rejected) to 3.4 hours. Two earlier starts were stopped and discarded:

  • at c7313df: the post-PR audit found that its scores would count VLM-only successes (P1-1 below), and that its play differed from RATs' (P2-1 to P2-3);
  • at ab4c26d, after half an hour: on the CPU, RATs' 180 s execution timeout cut programs that a GPU runs to the end (Validation, "Rendering"). ddad5a1 scales that timeout.

The head since then, da34f64 (the second audit's fixes), changes nothing these rows do except the guards' values. none's and play's rows kept ddad5a1's, which with render: cpu are 12 h per play row and 4 h per test trial (at the head 18 h and 14 h). No row came near one: the longest play row took 3.4 h, the longest test row 3.1 h.

0d35e01 records the first evaluation (the example's README and the method page) and changes no code. a43afa7 corrects the docs on Molmo (the Molmo row above) and changes no code. 21474a4 (the fifth audit's fixes) makes a test row need Contact-GraspNet's 8115 as well (it is up: serve.sh started the four services) and records a row whose runner was stopped. 28def22 (the fourth audit's) changes only how a row is recorded when a service stops during it. c85f3ca (the third audit's) changes what a test row reaches: Contact-GraspNet's 8115 too, which RATs' quality checker probes. Before it, the checker blocked sample_grasp_pose in a test row, which only the trained library names. In all 30 none rows, no policy was rejected for it. The final library's test rows ran at a43afa7. The servic 8000 es ran as started at ab4c26d, before the SAM3 guard and the GraspGen guard's extension; neither changes what RATs' own requests get (Validation).

Result (2026-11-30; the record, with the settings and spending: examples/libero/rats/README.md):

Condition Success Errors Spending Time
none: the reduced API's primitives, no learned skill (the paper's No Play) 0.167 (5 of 30), SE 0.068 0 $3.59 10.3 h
final: the library after 10 play iterations 0.133 (4 of 30), SE 0.062 0 $3.33 7.5 h

Paired per trial, final − none: −3.3 points, SE 7.6; final better on 2 trials, none on 3, 25 tied (exact sign test p = 1.0). Training: 1 of 10 play iterations succeeded (iteration 9); $1.23, 15.1 h. At 30 trials a difference under about 15 points is not told from noise, and these are not the paper's numbers (another model, 10 of 50 play iterations, 30 of 600 trials).

  • The final library does not act at test. Nine of its ten skills call, directly or through localize_with_health_gate, a primitive of play's full API that the test's reduced API lacks (get_object_pose, sample_grasp_pose, get_object_3d_points_and_masks_from_language): RATs' own pairing of its play and LIBERO-PRO configs (the method page, Evaluation). RATs' planner chose learned skills in 25 of the 30 final rows; in 16, a program raised a NameError on get_object_pose, and grasp_lift_and_verify and localize_with_health_gate catch the error and return a failure. The one success that calls a learned skill grasped through its own fallback (plan_grasp).
  • More programs were rejected. RATs' quality checker rejected 34 programs in the final rows and every attempt of 3 rows: 29 for a release gated on a post-grasp check, 25 of which call the library's verify_object_on_surface. In the none rows it rejected 14, and no row lost every attempt.
  • Molmo's absence shaped the library. RATs' diagnoser read Molmo's failed requests as a perception outage in 22 of 28 play diagnoses (11 of 129 in the final rows, 18 of 150 in none's), and two of the skills guard against that outage: localize_with_health_gate, and perception_guarded, which probes Molmo's port and returns None when it is closed, so that without Molmo every call it wraps fails. Both conditions ran without Molmo.
  • No row was cut or failed for a service. No program reached RATs' execution timeout (1,980 s on the CPU; the longest 1,407 s), no row reached the actor's guard, and the services' checks passed around every row. SAM3, Contact-GraspNet and PyRoki answered every request; GraspGen failed 12 on point clouds of too few points (errors in its own outlier removal and inference) and kept serving.

Validation

All on Linux (RHEL 9, bubblewrap 0.6), Python 3.12, at 21474a4 unless stated. The branch is rebased onto main's 84afde7 (#118: AHE-Beta's example, the methods and docs indexes, the changelog; the one conflict, in CHANGELOG.md, keeps both entries), which renamed its commits with their contents unchanged: 7e2d9f0 → 3894c8a, 476a45a → 797ac85, c7313df → 3a996c5, ab4c26d → f25700f, 3f11476 → 965cc81, ddad5a1 → 50f84c2, da34f64 → 51c76ba, c85f3ca → d886644, 28def22 → 49d3691, 21474a4 → 7de0987, a43afa7 → 45dcc6e. This description names them as they ran.

  • python -m pytest tests/methods/rats/test_rats.py: 47 passed with the upstream checkouts (RATS_ROOT), 45 passed and 2 skipped without them, as in CI (again at 0d35e01, after the rebase); with tests/core/test_layers.py and tests/core/test_selection.py, 59 passed. On this shared host that takes 1.5 to 4 minutes, with its load.
  • The fifth audit's two new tests fail at 28def22: a row whose probed port is closed runs there, and a stopped runner's row has no error. The three Trainer/sandbox tests run under bubblewrap and skip with a reason without it; the CPU-rendering one also needs Mesa's software EGL device.
  • python -m pytest --changed at 0d35e01, after the rebase: 2056 passed, 178 skipped, 7 failed (at ab4c26d: 1850, 177 and the same 7). The 7 fail identically on main 84afde7 (and 899597b) in the same environment, so they are not this PR's:
    • rrsi missing: test_harbor_environment.py::test_rrsi_sees_...;
    • mwm missing: clbench_database/.../test_parity_golden.py, 3 tests;
    • Pi: test_harness2_on_pi.py, 2 tests;
    • the linked-venv case: test_sandbox.py::test_a_linked_venv_runs_....
  • bash docs/build.sh (warnings as errors): passed, again at 0d35e01.
  • GitHub CI (test) on 3f11476, da34f64, c85f3ca, 28def22, 21474a4, a43afa7 and 0d35e01 (after the rebase): passed.
  • hermit check --no-probe on all six configs: passed. The one warning is the expected environment.runner is host (the actor confines RATs itself).
  • pre-commit's checks (YAML, TOML, merge markers, large files) on the branch's 38 changed files: no problems.
  • The seams against the real RATs (1fd2ef5, offline, its VLM stubbed to answer "success"; CPU rendering):
    • Seam 4: without the seam, RATs' Verifier marks a trial with task_completed: false successful on the VLM's vote alone (votes: native false, visual true), which reproduces the audit's P1-1. With the seam, it marks the trial failed, with the state hint "task NOT completed". With task_completed: true it marks it successful.
    • No video: the visual verifier sends three sampled frames as images (used_video: false). The feedback generator's and per-step verifier's video encoders return none, and the diagnoser takes frames.
    • The argument check, with RATs' own parser: the runner's play and exec arguments pass. --proposer-include-eval, --output-d=/x, --libero-sui=..., --iterations=99 (exec), and --catalog / --cat (play) are refused; --max-retries=3 passes. With a timeout scale of 11, the runner passes --timeout 1980 in play and exec, the parser reads 1980, and a rats_args --timeout=600 is refused. With RATs' _apply_rats_runtime_defaults applied after the parser (da34f64): --mock and --skill-library-min=verified (exec), --skill-library-merge=/x, --playtime-memory-seed=/x and --failure-memory-path=/x (play), and an env config whose rats: block sets skill_library_min_tier, are refused. RATs' pinned configs and the example's Contact-GraspNet config pass.
    • The scene: a LIBERO environment built by RATs' EnvironmentCreator from the smoke's generated BDDL. Its BDDL is found through RATs' wrappers, saved, and rebuilt in a second creator, with its custom verifier.
    • The worker: runner.py worker <RATs>/scripts/run_subagent_worker.py --help runs RATs' worker script; a path that is not RATs' worker script is refused.
  • The guards against the services' own code (offline, at c85f3ca):
    • GraspGen's own serve_forever (no model loaded) on a free loopback port, in GraspGen's venv. Without the guard, a two-frame request stops it (ZMQError: Operation cannot be accomplished in current state). With the guard, that request is answered Unknown action: refused: a request in more than one ZMQ frame and the server answers a health request after it. Object-typed, object-field and kind-O arrays and an unreadable type are answered as refused; a float point cloud decodes as float32 and reaches the handler.
    • RATs' own SAM3 decode_image, in RATs' venv, with subprocesses recorded instead of run. It sends an EPS image to Pillow's Ghostscript (gs), and decodes a JPEG and a 5000 × 5000 PNG. The guarded decoder decodes the 512 × 512 PNG, refuses the JPEG, the EPS image and the 5000 × 5000 PNG (HTTP 400), and starts no subprocess.
    • A guarded SAM3 started with serve.sh's own command, on an idle GPU and a free port: a PNG answered 200 with results, JPEG and EPS 400, no Ghostscript run.
    • The first two are now tests (test_graspgen_guard_on_graspgen_s_own_server_and_libraries, test_sam3_guard_on_rats_own_decoder_and_pillow), which run where the upstream checkouts and their venvs are and skip elsewhere. Each fails against a guard with its check taken out (checked on three such copies: no format limit, no frame check, no object-type check).
  • The services as serve.sh started them at ab4c26d (the running ones): the four services' environments hold only the listed variables (no key or token). The live GraspGen server runs through graspgen_guard.py. Against it, a health request answers ok, and an object-array request answers an object array is refused. A float point cloud passes the guard and reaches GraspGen's inference, which answers selected index k out of range to the probe's eight points.
  • The first evaluation's sandbox records at ab4c26d (actor-logs/<row>/sandbox/rats-1.json): every row enforced: true, network: isolated, probe.passed: true. The play row forwards 8114, 8115, 8116 and the endpoint; a test row 5556, 8114, 8116 and the endpoint.
  • Smoke on the real RATs (1fd2ef5, LIBERO, GLM 5.3 Flash; RATS_SMOKE=1 ./launch.sh train), at 476a45a before the audit's fixes:
    • RATs proposed "put the milk carton on the plate", wrote and instantiated its env, and ran its attempts through the endpoint. The Evolver applied the handed-back library and state. The row cost $0.124.
    • The play row's sandbox record (actor-logs/play-001-*/sandbox/rats-1.json): probe.passed: true, enforced: true, network: isolated.
    • The smoke found two things that changed the code. GLM 5.3 Flash refuses RATs' video inputs (HTTP 400 Invalid image or video input): the video seam above. With no effort set, its thinking can use up RATs' 1,600-token cap on the per-step verifier (per_step_verifier.max_tokens) and leave an empty reply: effort medium.
  • Rendering.
    • Why the CPU: the first start of the first evaluation, on NVIDIA's EGL, stopped on RATs' depth assertion (get_real_depth_map). On this host's H200s, other processes' CUDA work silently invalidates a live EGL context's reads (rows on the GPU with RATs' services failed, and so did rows on another GPU once others' jobs ran there). render: cpu (c7313df) renders with Mesa's llvmpipe through EGL, with no GPU. In the real sandbox the runner finds Mesa's software device at index 0 and depth reads in [0, 1].
    • How much slower: RATs' play env, built by RATs' EnvironmentCreator from the smoke's BDDL (agentview 512×512 and eye-in-hand 800×800, with depth), takes 0.179 s per step with Mesa against 0.016 s with NVIDIA's EGL on an idle H200. With two llvmpipe threads that is about 11×; with 4 threads 0.126 s, and with 8 threads 0.101 s.
    • What that did: in the start at ab4c26d (CPU, RATs' 180 s), 6 of the first 17 executions ran into the timeout. RATs' self-checks run under the same timeout; each that did was followed by a self-repair, whose feedback asks for bounded loops and no blocking waits (RATs' own text for a timed-out self-check).
    • The fix: ddad5a1 scales the timeout by 11 with render: cpu, which RATs also hands its sub-agent workers, and grows the rows' guards (da34f64: by what the scale can add to a row's program runs).
    • Since then, in the first evaluation's rows (scaled timeout 1,980 s): play's 36 self-checks took 36-1,407 s (median 605 s) and its 29 executions 28-1,106 s (median 534 s); the test rows' 366 self-checks took 9-1,183 s (median 176 s) and their 288 executions 2-1,173 s (median 240 s). None reached the timeout, and no row logged a TimeoutError.

Not verified yet: a play row on the head's code (the first evaluation's play ran at ddad5a1, its final test rows at a43afa7, the head's code), and the full protocol.

Post-PR audit of 476a45a (an independent max-effort review): two P1, four P2 and seven P3. All are fixed in ab4c26d. Each fix has a test, and the P1 fixes were also checked against the real RATs or the live service (above).

Finding Fix
P1-1: test scores counted VLM-only successes; RATS_VERIFIER_STRICT_BENCHMARK is read by no code at 1fd2ef5 seam 4 (native vote only, in exec); a trial counts when RATs' verdict and its last verification's native check agree
P1-2: sandboxed code could run code on the host through GraspGen's port (msgpack_numpy unpickles object arrays); the services inherited the shell's environment per-row ports from the RATs config's api_servers; serve.sh starts the services with a clean environment, and GraspGen with the object-array request refused; README starts the services before the key is exported
P2-1: with video off, the visual verifier sent text only (it sends a video and no images when it has two frames or more) each vision call built from images as RATs builds it without a video
P2-2: RATs' parallel sub-agent workers (their own processes) bypassed the model routing the workers start through runner.py worker
P2-3: the play scene was not carried between iterations; a failed environment creation practised libero_spatial task 0, a validation task the scene (BDDL + custom verifier) carried in state/scene/, the bootstrap name in loop.json; validation leaves out play's bootstrap task
P2-4 (plausible): .env and .openrouterkey, which RATs loads, were not hidden hidden
P3: the effort default called RATs' own; the 900 s per-call timeout never applied (RATs' 200 s does); abbreviated flags passed the play screen; libero_ood/ood_task.yaml (test instructions) visible in play; a run can end short of 50 play iterations; the rows cache ignored rows.py; the stand-ins hid P1-1 and P2-1 to P2-3; the docs' "auto-launched" services and the frozen-library copy texts fixed; the provider call bounded at 200 s; RATs' parser checks the arguments; libero_ood/ hidden in play; the docs say a run can end short; the cache key covers rows.py; the stand-in models RATs' Verifier, workers, scene and parser

After the audit, two more fixes:

  • 3f11476 refuses --catalog in play. Found in self-review while checking the splits paragraph against RATs' code.
  • ddad5a1 scales RATs' execution timeout with CPU rendering, and raises the exec trial's guard from 1 h to 2 h: six attempts of about ten minutes reached 1 h. Found in the first evaluation's first half hour.

Post-PR audit of 3f11476 and ddad5a1 (the second, by the same procedure): no P1, one P2 and seven P3, each checked against RATs at 1fd2ef5. All are fixed in da34f64. The audit found every fix of the first audit holding, except the library-at-test text (its P2).

Finding Fix
P2: the docs said a test row's write to the library fails on a read-only copy. RATs copies the library into each run's output directory and records the skills' use there (LifelongLoop.__init__); each batch-driver job has its own the docs and the table describe RATs' own copy; the stand-in copies the library as RATs does, and the e2e test checks the trial's usage went to the row's copy
P3: the argument check ignored the env config's rats: block, which run_rats.py applies after its parser, and held neither --mock nor the library merge, the tier filter or memory from other runs the runner applies RATs' _apply_rats_runtime_defaults before it compares, and holds those settings in both modes
P3: a library handed back without state/, or with a linked one, wiped the adapter's play state refused, with the adapter unchanged; so is an empty state/ while the adapter's is not
P3: with render: cpu the guards doubled, short of what an 11× execution timeout can add each guard grows by 24 program runs × the timeout's increase; a scale must be finite
P3: the ×11 was said to give a program the GPU's simulation steps, but it bounds the program's whole wall clock; the measurement's thread count was not given texts fixed (method page, README, this description)
P3: val.yaml and rows.py said validation lies outside the test suites; 29 of its 39 tasks are in the test's _swap suites texts fixed; the splits section gives the count
P3: the stand-in's vision services used RATs' real ports free ports
P3: serve.sh passed over a port that already answered without saying whose service it was; the feedback generator was said to send frames on LIBERO (it sends media on MolmoSpaces only) serve.sh says it did not start it, and the README's Trust section says the clean environment and the guard hold for the services serve.sh started; the video texts fixed

The audit also asked why the endpoint retries (max_retries, default 4). It covers a provider's 429, which RATs' client does not retry for a model without a fallback chain (only Gemini 3.1 Pro has one). The method page now says so.

Post-PR audit of da34f64 (the third): no P1, one P2 and two P3, each checked against RATs, GraspGen and their libraries. All are fixed in c85f3ca. The audit found every fix of the second audit holding.

Finding Fix
P2: the services took more than RATs' clients send. SAM3's decoder opens any format Pillow knows, and Pillow runs Ghostscript on an EPS image; msgpack_numpy builds an object-typed array over the request's bytes under any kind but O, which the guard let through; GraspGen's server stops on a two-frame request, for every row sam3_guard.py (PNG only, at most 4096 × 4096); graspgen_guard.py refuses every array whose type holds objects and answers a multi-frame request as an error; the actor checks a row's services before and after it (a failed run if they do not answer)
P3: a test row of the GraspGen config did not reach 8115, which RATs' quality checker probes, so the trained library's sample_grasp_pose was rejected at Tier 1 (an attempt used up) where RATs' evaluation lets the self-check find it every row reaches the probed ports but Molmo's
P3: texts: the CPU guards (this description, the method page), smoke_val.yaml's task (1, not 0), PROGRAM_RUNS is an estimate, "no token" holds for the services' environment only fixed

The audit also asked whether play should refuse RATs' own method switches (--no-skill-reuse and the like). They pass, as RATs' ablations, and the docs now say so.

Post-PR audit of c85f3ca (the fourth): no P1 and no P2, and four P3, each checked against the code and LIBERO-PRO's task files. All are fixed in 28def22. Of the third audit's fixes, the guards and the quality checker's ports hold; the per-row service check was incomplete (P3 below).

Finding Fix
P3: the per-row service check is a connection only, and its result was reported more strongly: a hung or failing service passes it; after the row, a row whose trials all succeeded became a failed run (scored 0), though an outage cannot cause a success; the Evolver called a failed play row an iteration that "did not run" an exec row whose trials all succeeded keeps its result (services_down in its output); the docs say what the check finds and what a failed run becomes (0 within mean_score, in errors, to be run again); the Evolver's message names a failed run
P3: the method page said a test row reaches no 8115 fixed
P3: rows.py said the splits share nothing, and the method page that a _task task changes the instruction and goal, while 14 of the 20 Object and Spatial _task tasks carry a validation task's instruction the splits share no row; the docs state what their tasks share (and that play's bootstrap task is the original of two test tasks)
P3: the guards' tests used stand-ins of numpy, msgpack_numpy, msgpack, pyzmq, Pillow and FastAPI only, which miss the real libraries' lookups two tests on the real libraries where the upstream venvs are (Validation)

The audit also asked about RATs' budget switches (--attempts-per-iteration and the like): they pass, change the protocol and the guards' assumption, and the docs now say so. A row that times out or crashes after a trial is scored over its requested trials, with status ok and the reason in its output and the judge's feedback (judge.py).

Post-PR audit of 28def22 (the fifth): no P1 and no P2, and five P3, each checked against the code and RATs at 1fd2ef5. All are fixed in 21474a4. Every fix of the fourth audit holds.

Finding Fix
P3: a row whose runner was stopped after a trial (a signal, the OOM killer, a crash of MuJoCo or EGL) had no reason in its output; a play row stopped in its hand-back could hand back part of its state, which the Evolver would apply the runner's result is marked running until RATs' run has ended: an exec row keeps its finished trials and says the runner was stopped; a play row is a failed run, its hand-back not taken
P3: every row reached the ports the quality checker probes, but the actor checked only the config's and launch.sh asked an evaluation for no 8115, so with Contact-GraspNet down the trained library's sample_grasp_pose would be rejected silently the actor checks the probed ports with the row's own; launch.sh needs 8114, 8115 and 8116 for every run; serve.sh's header says why
P3: the docs left PyRoki's 8116 out of the probed ports fixed
P3: the runner's docstring still listed --max-retries as a method switch fixed
P3: the PR's test times disagreed fixed (Validation)

The audit also noted, in code this PR does not change, that the endpoint relay passes a request's extra_headers on to the provider's call, which carries the key; it found no way for the key to reach the sandbox.

The audits' open question on who decides success stays as documented. RATs' own process reports it, and a program could overwrite the runner's result file. ASPIRE's judge re-runs the program on the host; RATs Exec's trials keep state across attempts within one process, which a re-run would not reproduce.

Review

  • Tests and documentation cover the affected behavior, where applicable. Tests: below. Docs: docs/methods/rats.md (setup, the four seams, the argument check, the sandbox and the services, the step, the splits, evaluation, parameters, the authors-vs-port table, what it is not) and examples/libero/rats/README.md (setup of RATs, SAM3, the robot-description cache, GraspGen; trust; how to run).
  • Commands, defaults, and public interfaces are consistent. The configs differ only in their splits, run name, concurrency, snapshot frequency and budget (test_the_example_configs_name_their_splits_and_the_training_run_they_evaluate checks the splits and that Benchmark.overlaps() is empty). README, method page and launch.sh name the same variables and commands.
  • Agents follow the agent layers.
    • Model calls go through Layer 1: a ChatC 8000 lient for the run's model, Direct for each request.
    • RATs' requests reach it through hermit.agent.base.endpoint.ChatEndpoint, which relays the provider's response and passes client disconnects on as aborts.
    • RatsActor is an Agent (Layer 3) in the method's folder, as ASPIRE's actor is.
    • No Base Agent CLI runs: RATs' own Python loop is the acting program, run as a process in the actor's sandbox.
    • supports = (): RATs' loop reads the library file itself. The Evolver needs nothing (needs: []) and calls no model.
  • Shared logs and examples contain no credentials or private data. The key stays in the host process. RATs' environment refuses secret-looking names (agent.params.env), and the provider key files RATs loads (.env, .openrouterkey) are hidden. The e2e test asserts that neither the key nor its variable, nor a key file's content, is in the sandboxed process's environment. The services start with a clean environment. The diff was scanned for keys and local paths.
  • Documentation-only: not applicable.

General

  • Core changes. None (see Change).
  • Implementation correctness and failures. Traced and tested:
    • A play iteration that crashes still hands back what RATs saved, and says why.
    • A row that times out keeps its finished trials and reports the row timed out after N s.
    • A row where nothing of RATs ran to an outcome is a failed run (session_failed), not a wrong answer, with its cost and log kept.
    • An exec trial that never ran counts as failed, and the judge's feedback says how many.
    • A failed play row, a library handed back without its state, a hand-back that fails the check, or a linked state leaves the adapter unchanged, with the reason in the step's summary.
    • A row whose vision services take no connection before it never starts RATs; one whose services take none after it is a failed run, unless it is an exec row whose trials all succeeded.
    • GPU slots are released on every path, and the process group is killed on timeout or interruption.
    • A trial that only the VLM judges solved is not a success at test (seam 4). A row whose rats_args would change it is refused before RATs runs. A scene that cannot be rebuilt leaves the iteration in the bootstrap scene, and the result records why.
  • Real execution paths and tests. The e2e test loads smoke.yaml with Config.load and runs the Trainer and evaluate("final"), with RATs' process in the real bubblewrap sandbox. The stand-ins are at the edge only: a stand-in of RATs' modules and a local OpenAI-compatible provider. During development the e2e test caught a real bug: the exec library was not readable in the sandbox. The smoke runs the real RATs. After the audit, the seams were also run against the real RATs' code (Validation), and the guards' tests run on the real services' libraries where the upstream venvs are.
  • Documentation. See the first item.
  • This description. Read end to end against the code at the head.
  • Independent review (post-PR audit). The audit of 476a45a found 2 P1, 4 P2 and 7 P3, all fixed in ab4c26d. The audit of 3f11476 and ddad5a1 found no P1, 1 P2 and 7 P3, all fixed in da34f64. The audit of da34f64 found no P1, 1 P2 and 2 P3, all fixed in c85f3ca. The audit of c85f3ca found no P1 and no P2 (4 P3, all fixed in 28def22). The audit of 28def22 found no P1 and no P2 (5 P3, all fixed in 21474a4; Validation). The last two audits found no P1 or P2, which ends the review loop; the fixes of the fifth audit's P3s were reviewed by the author, with tests that fail without them. a43afa7 and 0d35e01 (docs only) and the rebase were reviewed by the author.

Method reproduction

  • Adapter template. A new rats template.

    • aspire (markdown topic files read as context by a Codex session), prompt-only (one file) and the others carry prose. RATs' library is a JSON list of executable skill records with reliability counters and tiers, read by RATs' own planner, so none fits.
    • Learnable: skills.json and state/; the Evolver replaces both whole after the check.
    • Fixed: ADAPTER.md, README.md, exports.yaml, .hermit/.
    • What reaches the acting agent: in play, skills.json and state/, laid out as RATs' output directory; in exec, skills.json read-only, which RATs copies into the row's output directory. state/ is internal and never deployed.
  • Evolver. New rats; the flow chart is above.

  • Upstream fidelity and adaptations. The table above. RATs' code is unchanged and its prompts are its own; the four seams are the only patches.

  • Learning information and evaluation boundaries. No hand-written text reaches RATs' roles. task-info/ is read by the Trainer's learner context, not by RATs. The splits section says what each split shares. Two caveats:

    • The success flag comes from RATs' own process, which also runs the generated programs. RATs' program checker refuses env. and low_level_env., and the sandbox confines the process. A program could still reach the simulator's state through Python introspection inside that process, or overwrite the runner's result file. A reported success rests on LIBERO's own check (seam 4), read in that process. Documented in the method page's Evaluation section.
    • The task's instruction text is informational only. The actor passes RATs only the suite, the task id and the init states.
  • Sandbox control. The configs set sandbox: {enabled: true, enforce: required}. The actor's sandbox is hermit.sandbox.Sandbox(enforce="required", network="no-network"):

    • reads: RATs' checkout and venv, read-only;
    • writes: only the row's output directory and a temporary home;
    • network: the endpoint, the ports of the services the row's RATs config names, and those RATs' quality checker probes but Molmo's, forwarded on loopback; nothing else;
    • one GPU (none with render: cpu);
    • hidden: the checkout's git history, outputs/, logs, the provider key files, the authors' learned libraries, and in play every LIBERO-PRO suite's BDDL files and init states and LIBERO-PRO's perturbation specs.

    Record: the smoke's sandbox/rats-1.json (above). There is no web_search (no CLI agent). The judge runs on the host and reads only RATs' success records. Keys never enter the learning material or the adapter.

  • Experiments. The first evaluation (Change: First evaluation and Result), recorded with its settings, spending and standard errors in examples/libero/rats/README.md.

  • Agent three-layer abstraction. Layer 1 is ChatClient + Direct, used through ChatEndpoint (Layer 2's shared endpoint); Layer 3 is RatsActor and RatsEvolver.

    • Usage accounting: ChatClient's Usage and price, summed into RunOutput.cost_usd and tokens, then the Trainer's budget.
    • Timeouts: the actor's row guard; RATs' own policy execution timeout (scaled with render: cpu); each call is bounded by RATs' own 200 s request timeout, and the provider's call behind it by call_timeout_s (default 200 s). A call cut off by either timeout records no usage, though the provider may bill it.
    • Cancellation: the endpoint aborts a request when the client disconnects; the actor kills RATs' process group.
    • Configuration: the run's model reference, resolved by the backend registry.
    • Login plans: not applicable (an API-key provider).

Tests (tests/methods/rats/test_rats.py)

  • Group and selection. In tests/methods/rats/; the rats group covers hermit/agent/evolver/methods/rats/*, hermit/adapter/templates/rats/* and examples/*/rats/*, and the robotics engine paths select it too (tests/core/test_selection.py). Listed in tests/README.md.
  • Names. Each test name is a sentence (e.g. test_a_row_that_times_out_or_crashes_keeps_what_finished_and_says_why).
  • Docstrings. The file names the code under test, the stand-in of RATs' modules and the local provider. The stand-in mirrors 1fd2ef5's code paths: base_agent, LifelongLoop.run and resume_from, run_rats.py's build_parser, the Verifier's votes and video choice, the worker processes, a generated scene behind RATs' wrappers, and iteration file names.
  • What it asserts. Records, files, statuses, raised errors and request bodies. The sandbox-readability regression failed before its fix; test_layers.py held the rows.py move. New since the audit:
    • native-only success at test;
    • image-only vision calls without video;
    • routed sub-agent workers;
    • the scene carried across three processes;
    • the argument check in any spelling;
    • the template's scene;
    • GraspGen's guard and the services' clean environment;
    • each row's service ports.
  • Real entry points and stand-ins. Config.load, the Trainer, evaluate, the real ChatEndpoint with the real ChatClient, and the runner as a subprocess. Stand-ins only for RATs' modules and the provider, and for the services' libraries in the guards' unit tests; the guards also run on the real libraries where the upstream venvs are.
  • Isolation. tmp_path only, no network, no sign-in. The GPU binding is monkeypatched (hermit.sandbox.gpu_args). The tests skip without bubblewrap.
  • Time and order. No fixed timestamps. The timeout test holds a deadline (timeout_s 20 s against a stand-in that sleeps, long enough for its first trial on a loaded host).
  • Cost. 1.5 to 4 minutes on this shared host, with its load; no model, network or GPU.
  • Hygiene. No unused imports. The servers and processes the tests start are stopped.

Sandbox

  • Reuse the framework's sandbox. RATs' process runs through hermit.sandbox.Sandbox (bubblewrap), with the record above, and so do RATs' sub-agent workers, its child processes. The actor itself runs on the host (environment.runner: host), as ASPIRE's GPU actor does: it binds the GPU RATs renders on (none with render: cpu) and reaches the loopback services. It runs no adapter code itself; only RATs' process, sandboxed, runs the library's programs. The vision services run on the host outside a sandbox: they are RATs' own server modules and GraspGen, trusted code, started with a clean environment. Sandboxed code reaches them only through their request protocols, and GraspGen's one request that would run code is refused (Trust, above).
  • Sandbox changes are core changes. None.

Benchmark

  • Task directories. Written with hermit.task.directory.write_task, read back by the cap-harness view (examples/cap_harness/utils/agent/fields.py:task_row). test_the_rows_are_written_as_task_directories_the_view_reads_back checks it.
  • Public and private halves. A row holds its mode, slot or suite, task id and init states, and its split. There is no answer: success is LIBERO's own goal check inside RATs' process. The judge's feedback states successes over trials (k/n trials in init states a-b).
  • What a task asks. network_mode = "no-network"; the actor's sandbox gives an isolated network with the row's services forwarded. No memory limit is declared. Effective timeouts: the actor's guards (6 h per play row, trial_timeout_s (2 h) × trials per exec row; with render: cpu 18 h and 14 h × trials), RATs' policy execution timeout (180 s, ×11 with render: cpu), and RATs' own 200 s per model call. trainer.call_timeout_min bounds the Evolver's calls and task tools, not the rollouts, and with runner: host the framework sets no rollout deadline.
  • Parity, for a moved benchmark. Not applicable (a new benchmark folder).
  • A real run. The smoke's play row ran at 476a45a (Validation), and the first evaluation ran 10 play iterations and 60 test trials of the real RATs on LIBERO and LIBERO-PRO (Change: Result).

iamziyuzhao and others added 12 commits November 30, 2026 00:44
RATs (Playful Agentic Robot Learning, arXiv:2606.19419) learns a skill library by play and is evaluated with the
library frozen. Hermit had no way to run it. Now RATs' own code runs every row, unchanged, at the pinned commit:

- The rats template holds RATs' skill library (skills.json) and its play-time state (state/: failure memory, retry
  bank, proposer counts, curator history, loop counters, iteration digests). Its check screens a library's records
  and code and a state's files.
- RatsActor runs RATs' scripts/run_rats.py on one row in RATs' Python 3.10 venv, through runner.py, inside a
  bubblewrap sandbox of its own: the checkout read-only, no network but the model endpoint and RATs' vision services,
  one GPU, the authors' learned libraries hidden, and in play the LIBERO-PRO test suites hidden. Every model call
  goes to a ChatEndpoint in the actor's process (Direct, Layer 1), which holds the key and meters tokens and cost;
  each request carries the configured reasoning effort (medium by default), and for a model without video input
  RATs' own _strip_videos_from_messages drops the videos.
- A play row is one play iteration, resumed from the adapter with RATs' own --resume. An exec row is one LIBERO-PRO
  batch-driver job: one task, N trials in init states first_state + j, the library frozen, strict benchmark.
- RatsEvolver applies what a play iteration hands back (skills.json and state/) after the template check, or leaves
  the adapter unchanged and says why.
- examples/libero/rats/ has train (50 play iterations), val (the original LIBERO, init states 43-49), test (the
  paper's Table 1: six LIBERO-PRO suites, init states 0-9, 600 trials) and test_full (eight suites, 50 states) as
  configs of their own, plus rows.py, launch.sh (rows written once per argument set) and serve.sh (RATs' services).

Tests: tests/methods/rats/ (29) on a stand-in of RATs' modules, including the Trainer and evaluate end to end in the
sandbox. Docs: docs/methods/rats.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first evaluation's rows stopped on RATs' get_real_depth_map assertion: on this host's H200s, other processes'
CUDA work (here GraspGen's, and other users' jobs) silently invalidates a live NVIDIA EGL context's reads, so the
depth maps RATs reads back are garbage. RATs' own setup renders with NVIDIA's EGL; the actor still does by
default, and now also takes `render: cpu` (launch.sh: RATS_RENDER=cpu):

- Mesa is the only EGL vendor (__EGL_VENDOR_LIBRARY_FILENAMES, the glvnd vendor file), RATs' process sees no CUDA
  device and binds no GPU, and llvmpipe's threads are bounded (render_threads, default 2).
- Inside the sandbox the runner points MuJoCo's and robosuite's EGL backends at Mesa's software device as the
  sandbox lists it (MUJOCO_EGL_DEVICE_ID): the index differs from the host's.
- Checked in the actor's real sandbox: a LIBERO scene renders with depth in [0, 1].

The method page also says what final against none compares: a play library carries play's primitive records (the
full API's 12, three of which the reduced API lacks) and the no-library condition the reduced API's 26, as in
RATs' own evaluation recipe.

Tests: the render settings, and a cpu row in the sandbox that binds no GPU and sets the device (skipped without
Mesa's EGL).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…carry the play scene

The post-PR audit of 476a45a found two P1 and four P2 defects; this fixes them and its P3s.

- Seam 4: in exec, RATs' Verifier counts its native vote alone (task_completed, or reward >= 0.99, behind RATs'
  gate that the program ran) and keeps the structured custom and visual verifiers' results as an uncounted `vote`.
  RATs' docs set RATS_VERIFIER_STRICT_BENCHMARK=1 for this, but no code at 1fd2ef5 reads it, so a VLM-only success
  counted. A trial now counts when RATs' verdict and its last verification's native check both say success.
- The services: a row's sandbox reaches only the ports its RATs config names (api_servers: play 8114/8115/8116,
  test 8114/8116 and the grasp service; never Molmo's 8122). serve.sh starts every service with a clean environment
  (env -i and a short list, no key or token), and GraspGen through graspgen-python, whose graspgen_guard.py refuses
  the one request msgpack_numpy would unpickle (an object array).
- Without video, every vision call is built from images as RATs builds it without a video (the visual verifier's
  sampled frames, the feedback generator's first and last frames, the per-step verifier's images, the diagnoser's
  filmstrip), instead of a text-only call after the strip.
- RATs' parallel sub-agent workers, which it starts as processes of their own, start through `runner.py worker` and
  reach the endpoint.
- The play scene the last iteration left (its generated BDDL and custom verifier) is saved in state/scene/ and
  rebuilt with RATs' EnvironmentCreator in the next process, with the bootstrap task's name in loop.json; the
  template takes state/scene/. Validation leaves out play's bootstrap task, libero_spatial task 0 (39 rows).
- Provider key files (.env, .openrouterkey) are hidden; play also hides LIBERO-PRO's perturbation specs
  (libero_ood/, which repeat the test `_task` instructions).
- RATs' own parser reads a row's arguments: rats_args that change the row in any spelling (abbreviations,
  --flag=value) refuse it before RATs runs.
- The provider call is bounded like RATs' request (200 s); the effort comment names the first-evaluation row (RATs'
  default.yaml says low); the rows cache key includes rows.py; the docs say a run with failed play rows ends short of
  50 iterations, that RATs' docs' auto-launch of the services is not what run_rats.py does, and how the per-row
  read-only library differs from the batch driver's shared file.
- Tests: the stand-in now has RATs' Verifier vote and video choice, its worker processes, a generated scene behind
  RATs' wrappers and build_parser; new tests for each fix, the template's scene, GraspGen's guard and the services'
  clean environment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In catalog mode RATs' play rebinds to the bootstrap suite's own tasks (LifelongLoop._rebind_libero_env over
_init_libero_validated_tasks: libero_spatial's ten), which are validation rows. A play row is RATs' default,
novel-task play, so the runner's argument check now also holds --catalog off, in any spelling RATs' parser takes, and
the actor's screen names it. The method page and the README say so; the splits paragraph says play's scenes use
LIBERO's objects and fixtures, as the validation tasks do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With render: cpu, Mesa's llvmpipe renders a LIBERO step of RATs' play env (agentview 512x512 and eye-in-hand
800x800, with depth) in 0.18 s on the H200 host, against 0.016 s with NVIDIA's EGL (two llvmpipe threads; eight
give 0.10 s). RATs' policy execution timeout (180 s, rats/config/default.yaml), under which its policy self-check,
its execution and its sub-agent workers run, then cut programs a GPU runs to the end: in the first evaluation's
first half hour, 6 of 17 executions reached it, and each self-check that did sent RATs into a self-repair that asks
for shorter programs.

- The actor gives the runner --timeout-scale (agent.params.execution_timeout_scale; 1 with render: gpu, 11 with
  render: cpu), and the runner passes run_rats.py --timeout as RATs' configured execution timeout, read as
  run_rats.py reads it, times the scale. RATs hands the same timeout to its sub-agent workers. A row whose rats_args
  set another --timeout is then refused.
- The row's guards: an exec trial's is 2 h (six attempts of about ten minutes reached the 1 h guard), and with
  render: cpu both guards double. The row's record keeps its render, scale and limit.
- The method page, README and launch.sh say so; a Budgets row in the authors-vs-port table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The second post-PR audit (of 3f11476 and ddad5a1) found no P1, one P2 and seven P3s; each was checked against
RATs at 1fd2ef5.

- The library at test (P2): RATs copies the library it is given into its output directory and works on that copy
  (LifelongLoop.__init__), and each of its batch driver's jobs has its own output directory. The method page said a
  row's RATs write fails on a read-only copy; it records the skills' use on its own copy, as each upstream job does,
  and the trained library is never written. The method page and its table row say so, and the stand-in copies the
  library as RATs does; the end-to-end test checks the trial's usage went to the row's copy.
- The argument check (P3): run_rats.py fills settings in from the env config's top-level rats: block after its
  parser (_apply_rats_runtime_defaults). The runner applies the same before it compares, and holds, in both modes,
  no --mock (task_completed at random), no library merge or tier filter, and no playtime or failure memory from
  other runs.
- The Evolver (P3): a library handed back without its state/ (missing or a link), or with an empty one while the
  adapter's is not, leaves the adapter unchanged; before, the adapter's play state was wiped, and the next
  iteration would have started over.
- The guards with a scaled timeout (P3): instead of doubling, a trial's and a play row's default guard grows by what
  the scaled execution timeout can add to their 24 program runs (six attempts, each a self-check, two self-repairs'
  self-checks and the execution): 14 h a trial and 18 h a play row with render: cpu. A scale must be finite.
- Texts (P3): the scale bounds a program's whole wall clock, so a CPU row is somewhat more lenient than RATs' 180 s
  on a GPU; the factor was measured with two llvmpipe threads (eight give 0.10 s). Most validation tasks have a
  `_swap` test twin with the same instruction and goal (val.yaml, rows.py). The feedback generator attaches media
  on MolmoSpaces only. serve.sh leaves a port that already answers alone and says so; the README's Trust section
  says its guard and clean environment hold only for services serve.sh started. The endpoint's max_retries covers
  a provider's 429, which RATs' client does not retry for GLM.
- The stand-in's vision services listen on free ports, not RATs' real ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The third post-PR audit (of da34f64) found no P1, one P2 and two P3s; each was checked against RATs at 1fd2ef5,
GraspGen and the libraries they run on.

- The services' boundary (P2). RATs' programs reach the vision services, which run outside the sandbox as the user
  who started serve.sh, and two of them took more than RATs' clients send:
  - SAM3's decoder opens any image format Pillow knows, and Pillow runs Ghostscript on an EPS image. serve.sh now
    starts SAM3 through sam3_guard.py, whose decoder opens PNG only (RATs' clients send PNG), of at most 4096 x 4096
    pixels, and answers anything else with SAM3's own HTTP 400.
  - msgpack_numpy builds an array of an object type over the request's bytes under any kind but O, which the guard
    let through, and GraspGen reads its elements as pointers; GraspGen's server stops on a request of more than one
    ZMQ frame (the reply fails outside its handler). graspgen_guard.py now refuses every array whose type holds
    Python objects, or is none numpy reads, before it is built, and reads a request of more than one frame whole
    and answers it as an error.
  - The actor checks that a row's services answer before it starts RATs and after the row: a row whose services do
    not is a failed run (session_failed), not the method's result, so a service that stops during an evaluation no
    longer turns trials into the method's failures.
- The quality checker's servers (P3). RATs' policy quality checker probes SAM3's and Contact-GraspNet's ports when its
  loop starts and rejects a policy naming a primitive of a server that does not answer, which uses up an attempt.
  RATs' evaluation runs Contact-GraspNet, but a test row of the GraspGen config did not reach 8115, so the trained
  library's sample_grasp_pose was rejected where RATs lets its self-check find it. Every row now reaches the ports
  the checker probes (rats/config/default.yaml `servers`) but Molmo's, which RATs' LIBERO setup does not run.
- Texts (P3): the guards' growth with render: cpu (18 h a play row, 14 h a trial); smoke_val.yaml's task (1, not
  0); PROGRAM_RUNS is an estimate; no key or token is in a service's environment, while a service reads what its
  user can read; RATs' own method switches pass the argument check (in play, RATs' ablations).

Checked against the real code, offline: GraspGen's own serve_forever (no model) on a free port stops on a two-frame
request without the guard and answers it as an error with it, and refuses object-typed and object-field arrays while
floats decode; RATs' own SAM3 decoder sends an EPS image to Ghostscript, and the guarded one refuses it, JPEG and a
5000 x 5000 PNG. A guarded SAM3 started as serve.sh starts it, on an idle GPU and a free port, answered a PNG (200)
and refused JPEG and EPS (400), and ran no Ghostscript.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fourth post-PR audit (of c85f3ca) found no P1 and no P2, and four P3s; each was checked against the code and
LIBERO-PRO's task files.

- The service check (P3). The actor checks that each of a row's services takes a connection, before the row and
  after it. After the row, a row with a service down was a failed run even when every trial had succeeded, which an
  outage cannot have caused: an exec row whose trials all succeeded on LIBERO's own check now keeps its result, with
  the outage in its output (services_down). The docs say what a failed run becomes (scored 0 within mean_score,
  counted in errors, its trials in the actor log's result.json: to be run again) and what the check cannot find (a
  service that listens but hangs, or fails its requests). The Evolver names a failed play row as one, not as an
  iteration that did not run.
- The guards' tests (P3). Two tests run the guards on GraspGen's own server loop with its msgpack, msgpack_numpy,
  numpy and pyzmq, and on RATs' own SAM3 decoder with its Pillow and FastAPI, where the upstream checkouts and their
  venvs are (RATS_ROOT, GRASPGEN_ROOT); elsewhere they skip. Each fails against a guard with its check taken out.
- Texts (P3): a test row reaches 8115 too; what the splits share: no row, while LIBERO-PRO's _task suites give 14 of
  their 20 Object and Spatial tasks a validation task's instruction in another task's scene, and play's bootstrap
  task is the original of two test tasks; RATs' budget switches (--attempts-per-iteration and the like) pass the
  argument check and change the protocol the guards assume; the guards limit what a request holds, not the work it
  asks for.

The timeout test no longer depends on the host's load: its hanging row's timeout is 20 s, its crashing row's long
(it exits at once).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fifth post-PR audit (of 28def22) found no P1 and no P2, and five P3s; each was checked against the code and RATs
at 1fd2ef5.

- A stopped runner (P3). The runner marks its result running after each iteration and clears the mark when RATs' run
  has ended and play's hand-back is written. A runner stopped in between (a signal, the OOM killer, a crash of the
  interpreter) left a row with no reason: an exec row now keeps the trials that finished and says the runner was
  stopped before RATs' run ended (with its exit code, in its output and the judge's feedback), and a play row is a
  failed run whose hand-back, which may be cut short, is not taken.
- The quality checker's servers (P3). c85f3ca had every row reach the ports RATs' policy quality checker probes but
  checked only the row's config's, and launch.sh asked an evaluation for no 8115: with Contact-GraspNet down, the
  checker would reject the trained library's sample_grasp_pose with nothing said. The actor now checks the probed
  ports with the row's own (SAM3's, Contact-GraspNet's and PyRoki's: rats/config/default.yaml names PyRoki's 8116
  too), launch.sh needs 8114, 8115 and 8116 for every run, and serve.sh's header says why.
- Texts (P3): PyRoki's 8116 among the probed ports; the runner's docstring on RATs' budget switches; the method
  page's table row on the service check.

The new tests fail at 28def22: a row with a probed port closed runs there, and a stopped runner's row has no error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README and the method page said that RATs' docs/setup.md calls Molmo
unneeded for LIBERO-PRO; that sentence is about MolmoSpaces. RATs'
scripts/start_servers.sh starts Molmo2-8B on 8122, and docs/setup.md
lists 8122 among the release configs' ports, while its LIBERO-PRO install
leaves out the molmo extra (vLLM) and no LIBERO config starts it. The rows
still run without Molmo. The docs now call that a deviation from
start_servers.sh, and say what it does: each object localization asks
Molmo three times before SAM3's text prompt, and prints the failed requests
where RATs' diagnoser reads them. In the first evaluation, GLM 5.3 Flash's
diagnoses often blamed a perception outage on 8122.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first evaluation, reduced in size: 10 play iterations, then 30 test
trials (Table 1's six suites, tasks 0-4, init state 0). The final library
scores 0.133 against the no-library condition's 0.167, paired -3.3 points
(SE 7.6). The example's README records the settings, the result and what
the rows show: nine of the ten learned skills call a primitive of play's
full API that the test's reduced API lacks (RATs' own pairing of its
configs), and Molmo's absence shaped the library. The method page gets a
Result section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@iamziyuzhao
iamziyuzhao marked this pull request as ready for review November 30, 2026 06:30

This branch has not been deployed

No deployments
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

0