Repository navigation
Add CaP-Agent0: its acting agent, skill-library template and Evolver, with a LIBERO-Pro example - #136
Draft
iamziyuzhao wants to merge 5 commits into
Draft
iamziyuzhao wants to merge 5 commits into
iamziyuzhao wants to merge 5 commits into
Conversation
…ample CaP-Agent0 (CaP-X, arXiv:2603.22435; capgym/cap-x at acac62f) on the cap-harness engine: - the cap-agent0@1.0 template: the skill library (skill_library.py), its reader (the context tool: cap-x's combined_doc text and the code) and a check against the engine's program rules; - CapAgent0Actor: one trial of cap-x's trial loop, every model call one Direct call; the multi-turn loop replayed from the reset with each block in its own try, the Visual Differencing Module on the engine's keyframes, the parallel ensemble and its synthesis; - the cap_agent0 Evolver: cap-x's library compile (functions.txt per experiment, pooled, filtered, curated with SKILL_LIBRARY_PROMPT); setting paper synthesizes once at the epoch's end over the collection rollouts (the single-turn tier), setting continual (ours) after every step, keeping the best validation library. cap-x's pure functions and prompt texts are copied verbatim (upstream/, MIT), with tests that compare them with a cap-x checkout (CAPX_ROOT) and the check's rules with ASPIRE's (ASPIRE_ROOT). examples/libero/cap_agent0/: one task row per trial on LIBERO-Pro (rows.py; collect and train on the four LIBERO suites, seeds 51-55; val on the six test suites, seed 66; test on Table 2's six LIBERO-Pro suites, seeds 1-50), paper.yaml, continual.yaml, their smoke configs and a judge that prunes each scored run's images. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- actor.py: concurrent trials wait for the engine module's one load (a module taken from sys.modules while it still ran had no Engine, so the first trials of every process were lost as errors), and a load that fails is not kept; the API reference is cut at its host-only heading, or the trial fails before its first run, never passed whole. - examples/libero/cap_agent0/judge.py: a rerun that ran no episode, or a refusal of the program the trial ran, raises (a judge error) instead of the engine judge's 0 with status ok, which dropped a success from the paper setting's pool and counted a validation run as a real 0. - evolver.py: a curation whose reply was cut off (finish_reason length, or a last block left open) or of which no function is kept is tried once more, then the step fails and the library stays; max_tokens is 20,480 (cap-x sends none); bare fences are read; type hints that would not evaluate when the library is defined are removed, and the template's check refuses them; finalize says what the library holds. - continual.yaml: call_timeout_min 1440 (step 1 validates two libraries). - docs: the collection's tier is nearer S4 than S3 (the engine's API reference has no usage examples); the effort difference; a program runs in cap-harness's own process at judging; error rows count 0 in mean_score; the VDM's frame after a motion that raised. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- examples/libero/cap_agent0/judge.py: each rerun's images are removed by the run directories its stage2.json records. The pattern before (runs/*/media) was one level short of ASPIRE's layout (<output-root>/<seed:04d>/<run-id>/), so no keyframes were removed; the test's stand-in run-batch now writes that layout. - The type-hint rule is withdrawn: ASPIRE's runtime.py compiles a program with its own `from __future__ import annotations`, so the engine never evaluates a hint. The template's check ignores names in hints, the Evolver keeps each function as written (no hint removal, no reprint), and the engine rules no longer ask for it; the actor's compile check and the test stand-ins compile with that flag. - actor.py: keep_images (default true); false removes a trial's VDM frames when it ends. - Texts: the synthesis input is S3 by the paper and S3 + S4 in cap-x's compile; the released code stops at the curated text (not "by hand"); smoke_paper.yaml's step comment; rows.py's sample-seed message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- examples/libero/cap_agent0/judge.py: the prune follows no link and removes only a real media/ inside the rerun's own folder. With no stage2.json (the engine's removal of a program's links had failed and the judge raised) it globbed runs/*/* through any link a program left there, and a stale stage2.json was trusted as is. It now also removes the images of a run ASPIRE lost (a folder with no record). - The template's check compiles each function and the library as the engine does (with `from __future__ import annotations`), parsing as Python 3.10, ASPIRE's oldest: `break` outside a loop, a repeated keyword argument and the like passed the check and stopped every program. The actor compiles the library before a trial too. - evolver.py: a curated function keeps its decorators, for the check to refuse (they were dropped silently); past the 60,000-byte cap the rest are checked again, so a caller of a function cut goes too. - paper.yaml and continual.yaml: keep_images false (a test split is thousands of trials). The stand-in's lost runs keep a frame, so the judge test checks that their images go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- evolver.py: with params.engine named (the four configs name the engine's sim.py and aspire_root), each library is checked by the engine's own validator, on the benchmark venv's Python in its sandbox, before it is kept; the functions it refuses go and the rest are checked again. The template's check runs on Hermit's Python, and ASPIRE's venv may be 3.10 or 3.11, whose parser refuses a 3.12 f-string that reuses its quote or holds a backslash, and a[*b]: such a library passed the check and every trial refused it. - evolver.py: a fenced block inside a list item loses the fence's indentation, as Markdown reads it (each such block failed as an unexpected indent and the step kept nothing); a reply that gave no function names the blocks that did not parse. - The template's check binds the names a match pattern captures. - tests: the check's compile is pinned to ASPIRE's runtime.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
CaP-Agent0, the training-free coding agent of CaP-X (Fu et al., arXiv:2603.22435v2, §4.1; project; capgym/cap-x at
acac62f), on LIBERO-Pro through the existing cap-harness engine (ASPIRE's robot harness,fa00f0e). The acting harness is cap-x's (the multi-turn loop with the Visual Differencing Module and the parallel ensemble); the adapter is its automatically synthesized skill library, which a new Evolver writes with cap-x's own compile code. Only CaP-Agent0 is integrated: CaP-Bench, CaP-Gym and CaP-RL are not, and the robot environment is the one the repository already has.Draft until the first evaluation (the reproduction guide's rule): the configs, splits and tests are in; no run on the simulator has happened yet (see Validation).
What is added:
cap-agent0@1.0hermit/adapter/templates/cap_agent0/skill_library.py(learnable, ≤ 60 KB), its readerlibrary(the context tool: the functions' signatures and docstrings in cap-x'sApiBase.combined_docformat, and their code), and a check against the engine's program rulesactor.pyCapAgent0Actor_run_single_trialon one task row; every model call oneDirectcall (Layer 1)cap_agent0evolver.py,evolver.yamlscripts/skill_library_compilation/);setting: paperorcontinualupstream/(MIT,LICENSE,NOTICE),prompts.pyexamples/libero/cap_agent0/rows.py(one row per trial, the splits),paper.yaml,continual.yaml,smoke_paper.yaml,smoke_continual.yaml,judge.py,tasks.sh,launch.sh, READMEdocs/methods/cap_agent0.md; rows indocs/methods/index.md(both tables),docs/index.md,examples/libero/README.md,CHANGELOG.mdtests/methods/cap_agent0/;tests/selection.py(METHODS),tests/README.md,tests/core/test_selection.py(the engine's and LIBERO's shared files now also select this group)The two settings: the paper's pipeline and ours
paper.yaml(the paper's pipeline)continual.yaml(ours, not in the paper)splits/collect.txt: the single-turn, low-level tier, no VDM, no ensemble, no library (the paper names its S3 rollouts, whose documentation adds usage examples, and cap-x's compile pools S3 and S4; the engine's API reference has no usage examples, as S4; each collection row carriesmulti_turn: false,vdm: false,ensemble: none, which win overagent.params)splits/train.txt: CaP-Agent0 itself, with the library as it standssplits/val.txt, run only by the Evolver throughrun_agent) of the starting library and each step's; a tie goes to the later./launch.sh eval --adapter final: CaP-Agent0 with the library, frozen, onsplits/test.txtThe paper synthesizes once, from S3 rollouts (cap-x's compile takes S3 and S4) of twelve models on CaP-Bench's Robosuite tasks, and calls the process "inherently iterative";
continualis that iteration, and is ours. Both are train / test protocols: the library is frozen at test time.The splits (LIBERO-Pro, one row = one trial = a task and one seed)
collectlibero_object,libero_spatial,libero_goal,libero_10(unperturbed, 40 tasks)paper.yaml's training rolloutstraincontinual.yaml's training rolloutsvalcontinual.yaml's Evolvertestlibero_{object,spatial,goal}_{swap,task}: Table 2's Pos and Task perturbationsevaltest_sampleeval, a cheaper look (rows oftest)test_longlibero_10_swap,libero_10_task(beyond Table 2)evalrows.pyrefuses seed sets that meet (training, validation and test never share a seed); a row'sseedis the actor's and itseval_seedsthe judge's (the same seed). The*_smokesplits are 2 + 2 + 1 + 2 trials. A seed is a scene LIBERO samples (the engine's--init-mode seeded), not one of the 50 saved states the paper's trials use, so a success rate here is not comparable with Table 2's.One trial (the acting agent)
flowchart TD P[probe program on the seed: the task's language, the reset frame] --> D{vdm} D -->|yes| V0[VDM: describe the initial frame] D -->|no| G V0 --> G[initial program: one request, or the ensemble and its synthesis] G --> X[turn k: the library and blocks 0..k replayed from the reset, each block in its own try] X --> T{episode over, or single-turn} T -->|yes| E[final program: the last turn's] T -->|no| V[VDM: how the turn's last frame differs from the one before] V --> Q[decision request: executed code, the block's stdout and stderr, the VDM's text] Q -->|REGENERATE, under the limit| X Q -->|FINISH, or the limit| E E --> J[judge on the host: the final program once more on the seed]The engine runs one program per episode, so a turn replays the library and the blocks so far from the reset; each block runs inside a
tryof its own (an exception ends that block only, as each cap-x turn is oneexecin the episode's namespace) and markers split the run's stdout by block. A block the engine's validator refuses, or that does not compile (areturnoutside a function), is left out and the refusal is its stderr. Each turn records whether its replay reached the frame the model saw (replay_matches). The model never sees the judge's score. A judge's rerun that ran no episode (no termination reason,harness_error,user_interrupt), or a refusal of the program the trial itself ran, is a judge error (judge_error), not a 0: the engine's judge countstask_successalone, so the example'sjudge.pychecks the rerun's records.One step (the Evolver)
flowchart TD R[the step's trial records: code and judge score] --> C[pool: each successful trial's code, by experiment] C --> S{paper: the epoch's last step? continual: every step} S -->|no| K0[library unchanged] S -->|yes| F[functions.txt per experiment: compile_successful_functions] F --> A[pooled by name, filtered: parse_functions_file, filter_functions, min_occurrences] A -->|none recurs| K0 A --> M[run's model: SKILL_LIBRARY_PROMPT with the list, then the engine's rules] M -->|cut off, or none kept: once more| M M --> L[the reply's Python functions, as written, each kept if the template's check takes it with the others] L --> W[skill_library.py, check_spec] W -->|continual| V[run_agent on the validation trials] V --> B[finalize: the best validation mean, the starting library included] W -->|paper| Z[finalize: the library]The pool is saved before the synthesis (a step stopped later keeps its trials) and a step's material read twice is pooled once. The curation request carries
max_tokens20,480 (cap-x sends none). A curation is tried once more when its call fails, its reply was cut off (finish_reasonlength, or a last block left open) or none of its functions is kept; a second failure fails the step and the library stays (inpaper,finalizethen says the library is empty and why). Python blocks may be```python,```pyor bare; type hints stay as written (ASPIRE'sruntime.pycompiles a program with its ownfrom __future__ import annotations, so the engine never evaluates one), and so do decorators, for the check to refuse; past 60,000 bytes the last function goes and the rest are checked again. Withparams.enginenamed (the four configs name the engine'ssim.pyandaspire_root), the engine's own validator, on the benchmark venv's Python in its sandbox, is asked about each library before it is kept, and the functions it refuses go (ASPIRE runs on Python 3.10 to 3.12, and the check, on Hermit's, cannot tell all that 3.10 refuses). A block inside a list item is read as Markdown reads it, the fence's indentation off its lines. A library that failscheck_specis put back; a validation run that failed (an agent or judge error) is run once more, and a library never scored is not selected.The authors' implementation against this one
cap-x's robot code cannot be imported (its trial loop's modules import torch, SAM 3, Ray, Open3D and JAX at package import;
capx/utils/launch_utils.pysets the process-wide multiprocessing start method on import; its client retries without end; the compile is a script outside the installed package), so it is not a dependency group: the pure functions the port calls are copied verbatim, pinned toacac62f, and the tests compare them with a checkout (CAPX_ROOT). Per component, the port follows:capx/envs/trial.py(_run_single_trial,_capture_initial_visual_feedback,_describe_initial_scene,_get_visual_differencing_feedback,_query_initial_code,_handle_multi_turn_step),capx/llm/client.py(query_model_ensemble,query_single_model_ensemble),scripts/skill_library_compilation/compile_skill_library.py(collect_all_functions,main). Every difference below is acceptable for this integration; none is left to close but the first evaluation.acac62f)FrankaLiberoEnv), cap-x's API classes and serversFrankaLiberoApiReducedSkillLibrary: the reduced low-level API and nine synthesized functions (numpy)combined_docformatimport math, no classes,with,global,nonlocal,del,asyncor_names; the task prompt's last line says so instead of cap-x's numpy line--init-mode seeded)execper blocktry; a refused block left outstdout_chars) and its exception asName: messageenv.render()after the reset and each turnagentviewkeyframes: the probe's first frame, each turn's last (a motion that raised, or that the step limit cut, recorded only itsbefore-frame: the VDM then sees the scene from before it){libero_environment_goal}unformatted, no initial descriptiondecision_prompt: upstream);initialstarts them from the first requestENSEMBLE_CONFIGSgpt-5.4 × 0.1/0.5/0.9 8000 ; single-model: nine temperaturessingle(nine temperatures of the acting model, which also synthesizes) by default;multiwithensemble_models; candidates in their configured ordervdm_model, default the acting modelreasoning_effortsent to GPT models only (medium by default); other models get noneeffortmedium sent to the run's model, GLM 5.3 Flash included, on every call (code, VDM, ensemble, curation)unserved_retrieswith pauses, then the trial fails (session_failed): an error row, whichhermit evalcounts inerrorsand as 0 inmean_scoretask_completedis_reduced_api_experiment) and its shipped LIBERO library: the S3 and S4 experiments (_reduced_api,_reduced_api_exampleless)paper), or CaP-Agent0 (continual)SKILL_LIBRARY_PROMPTto Gemini-3.1-Pro (nomax_tokens); the released code stops at the curated text (the paper calls the pipeline automated)prompts.ENGINE_RULES), to the run's model withmax_tokens20,480; the reply's functions, as written, that the check takes become the library; a reply cut off or with none kept is tried once morepaper: once;continual: after every stepcontinualis the added settingpaper: none;continual: best validation meanevolve_skill_library(nothing atacac62freads it back); the web UIThe first evaluation's settings
Not run yet: this PR stays a draft until the row is here. The planned row, on the splits above:
fireworks/accounts/fireworks/models/glm-5p3-flash), effort medium, temperature 1.0, 20,480 tokens; also the VDM and the ensemble's synthesisCapAgent0Actoron the cap-harness engine (ASPIREfa00f0e), LIBERO-Pro,--init-mode seeded, 8,000 steps, at most 10 regenerationscollect(paper) ortrain(continual) 200 trials,val60 (continual),test3,000 (test_sample300 for a first look)eval --adapter finalon the test split, one pass; the judge's success rate:mean_scorewitherrorsbeside it (rows the agent or the judge failed, whichmean_scorecounts as 0) and the rate over the scored rows--adapter root(CaP-Agent0 without a library) and the single-turn tier (agent.params.multi_turn=false agent.params.vdm=false agent.params.ensemble=none), same model and trialstrainer.budget)What the learner sees, and the boundaries
The Evolver reads only the learning material's successful trials' code (
pipeline_extra.trial.code, which_annotate_code_blocksbuilds from the blocks the model wrote) and the judge's score on each trial's own seed, the label cap-x'stask_completedis; incontinual, also the validation trials' scores throughrun_agent. No prompt or task text carries a held-out seed, an answer or solution guidance: the task rows give a suite, a task id and a seed, and the actor's prompt is cap-x's with the engine's API reference (its generated-program part; the host-only part is cut). Test seeds (1-50) are never run beforeeval; validation seed 66 only by the Evolver. Learned code and the model's code run only inside the engine's sandbox. The judge runs on the host and reruns the final program in a cap-harness sandbox of its own; there the program runs inside cap-harness's own process (ASPIRE's design), so one that escaped ASPIRE's validator could write its own run's outcome: that score would not be trustworthy, and the sandbox keeps it from any other run, the judge's process and the host (the engine's README); the judge wrapper's clean-up of the rerun's images follows no link the program could leave in its output. The validation trials are the test's 60 tasks on a seed of their own (66):continualselects on the perturbations it is tested on, never on a test trial, and the Evolver sees only their scores; taking the best of several means, its test score is optimistic besidepaper's one library.What is left out
CaP-Bench, CaP-Gym and CaP-RL (the request's scope); the paper's twelve-model collection on CaP-Bench's Robosuite tasks
(one acting model on LIBERO's own suites instead); video differencing, the wrist camera and images in the decision
request (off in cap-x's CaP-Agent0 config);
evolve_skill_library, cap-x's online recording of successful functions(nothing at
acac62freads it back into a prompt); cap-x's web UI. A Robosuite example would be the same rows onexamples/robosuite/; it is not added.Limits that stay (the audit's design questions): one validation trial that fails twice leaves its library unscored; a
paperrun stopped before the epoch's end has no library yet (a resume continues it); a trial has no wall-clock limit of its own (its bounds are under "What a task asks"); a provider outage inside an episode looks like a program error to the actor and the judge alike (the engine definesprovider_errorbut never produces it). A trial keeps its initial frame and each turn's last (up to twelve) in its log;paper.yamlandcontinual.yamlsetagent.params.keep_images: false, which removes them when the trial ends (the smokes keep them). Type hints reach the acting model as written (-> np.ndarrayin an engine without numpy), as cap-x'scombined_docshows them. The same module-load race fixed here inactor.pyexists onmaininhermit/agent/evolver/methods/aspire/direct.py(engine_module); it ismain's own and not changed here.Application-side changes
All under
examples/libero/cap_agent0/(rows, configs, the judge wrapper that runs the engine's judge unchanged and prunes the images of each run its rerun recorded: a test split is 3,000 episodes) andexamples/libero/.gitignore(the generatedtasks/,splits/). No shared framework code changes;tests/selection.pyis the registration every method adds. The index files (docs/methods/index.md,docs/index.md,CHANGELOG.md,examples/libero/README.md,examples/libero/.gitignore,tests/selection.py,tests/README.md,tests/core/test_selection.py) are the ones the open drafts #133, #134 and #135 also add rows to: whichever lands later rebases.Validation
Run on this branch (Linux, bubblewrap working;
TMPDIRon /home):python -m pytest tests/methods/cap_agent0→ 64 passed at0b8ec1b, withCAPX_ROOT(a cap-x checkout atacac62f) andASPIRE_ROOT(ASPIRE'ssrc/cap_harness/{runtime,api}.pyandlibero/adapter.pyatfa00f0e) set, so the five parity tests ran: the vendored functions' ASTs equal cap-x's,LICENSEequals cap-x's, every prompt text is cap-x's but the one adapted line, the reader's text equals cap-x's owncombined_doc, and the check's names and rules equal ASPIRE's (_SAFE_BUILTINS,_SAFE_CONSTRUCTORS,_ProgramValidator,register_tools), with both validators agreeing on a corpus that includes the actor's wrapped programs, and the check's compile is runtime.py's (compile(tree, ...)under its annotations future). Without the two variables those five skip (59 passed, 5 skipped).sim.Engine, its sandbox) on a stand-in cap-harness that executes each program as ASPIRE'sProgramExecutordoes and records keyframes; the model is scripted. The Evolver runs with a scripted model andrun_agent, and once through the Trainer on a toy task (train, validation selection,evaluate final1.0 vsroot0.5).rows.pyagainst the benchmark's realprepare.pyoutput; every config throughConfig.loadandBenchmark.from_config.pytest --changedselects every group: a new template'sadapter.yamlis shared), in four parallelchunks: 1,854 passed, 181 skipped, 9 failed. One failure was this PR's:
tests/core/test_selection.pylisted thegroups the engine's and LIBERO's shared files select, which now include
cap_agent0; its expectation is updatedand it passes. The other eight are this machine's, and none touches a file this PR changes:
tests/core/test_harbor_environment.py::test_rrsi_sees_a_harbor_rollouts_failure_and_a_cli_model_is_refused_for_harborand
tests/methods/harness2/test_harness2_on_pi.py::test_what_a_pi_session_spent_is_kept_when_it_times_out_or_is_stopped(2 cases): the
rrsiandharness2dependency groups are not installed here (ModuleNotFoundError; CI installs both).tests/core/test_sandbox.py::test_inside_the_sandbox_an_installed_hermit_is_covered_but_the_relay_runs: the chunk ranthe interpreter by a path with
.., which bubblewrap cannot exec; it passes run by the absolute path.tests/core/test_sandbox.py::test_a_linked_venv_runs_by_its_own_name_with_its_own_packages: this interpreter's baseinstallation is under
miniforge3/envs/, which the test's"env" incheck matches.examples/clbench_database/utils/tests/test_parity_golden.py(3): they compare with a local MetaWorld checkout thatdiffers from their golden files.
tests/methods/cap_agent0,tests/core/test_selection.py,test_packaging.py,test_spec.py,test_isolate.py,test_harbor_environment.py(all passed but therrsicase above).ffb24ce):pytest --changedselected every group: 2,045 passed, 136 skipped, 0 failed; the four parity tests skip there (no checkouts), and the eight failures above pass or skip there. On the second (061e22e): 2,051 passed, 136 skipped, 0 failed. On the third (2b60663): 2,049 passed, 136 skipped, 0 failed (the two withdrawn check cases fewer). On the fourth (1cac6fd): 2,054 passed, 136 skipped, 0 failed (the five new tests and cases more). On the fifth (0b8ec1b): 2,058 passed, 137 skipped, 0 failed (the new compile parity test skips there: no ASPIRE checkout).061e22e):tests/methods/cap_agent0withtest_selection.py,test_packaging.pyandtest_spec.py→ 83 passed. The third (round 2's,2b60663): the same four → 81 passed (two check cases of the withdrawn hint rule removed). The fourth (round 3's,1cac6fd): → 86 passed. The fifth (round 4's,0b8ec1b): → 91 passed; the docs build,ruff --select Fandhermit checkon the four configs again, the same results each time.bash docs/build.sh(Sphinx-W) → builds with no warnings.ruff check --select Fon the new files → only two names in cap-x's annotations, in the verbatim copies (np.ndarray,TrialData), whichfrom __future__ import annotationsleaves unevaluated (noted inupstream/__init__.py).hermit check --no-probeonpaper.yaml,continual.yaml,smoke_paper.yaml,smoke_continual.yaml(rows generated bytasks.sh's command) → all[ok]; the warnings are the expected ones (environment.runner: host; validation data given to the Evolver).Not run yet: the smoke and the first evaluation on the simulator. They need an ASPIRE checkout at
fa00f0ewith.venv-liberoand its four provider services on a GPU host; this machine has neither (its provider ports are another project's). Commands:ASPIRE_CONFIG=smoke_paper.yaml ./launch.sh, theneval --adapter final;ASPIRE_CONFIG=smoke_continual.yaml ./launch.sh(examples/libero/cap_agent0/README.md). The first evaluation's row (GLM 5.3 Flash acting, describing and curating, effort medium; the empty library as the start; the 3,000 test trials, one pass; baselines--adapter rootand the single-turn tier) goes into this description before it leaves draft.Review
Tests and documentation cover the affected behavior, where applicable. — Validation above; docs listed under Change.
Commands, defaults, and public interfaces are consistent. — the configs' params are the actor's defaults (cap-x's: temperature 1.0, 20,480 tokens, effort medium, 10 regenerations, 8,000 steps);
evolver.yamlis included in the method page.Agents follow the agent layers. —
CapAgent0Actoris an acting agent (Layer 3) whose every model call (code, VDM, ensemble candidates and synthesis) is oneDirectcall (Layer 1) over the framework'sChatClient(resolve/registryfor the spec, its retries); it declaressupports = ("context", "context_tool"), and the Evolverneeds: [llm, context_tool]and calls onlyctx.agentthroughask(metered, cancellable). It is not a copy of a loop of a core agent: the loop is cap-x's trial, which no core agent has. Where it runs is the run's environment (environment.runner: host), because the engine starts the GPU simulator; every program runs confined by the engine (sim.confine), as ASPIRE's direct actor does.Shared logs and examples contain no credentials or private data. — the configs name
FIREWORKS_API_KEYonly as a variable; the engine scrubs secrets from the simulator's environment.Documentation-only: not applicable (this PR changes code).
Core changes. None to shared code:
tests/selection.py(METHODS),tests/core/test_selection.py(its expected groups) and the docs' index rows are the registration the guide requires.Implementation correctness and failures. A failed model call past the retries, an engine that ran no episode, or a lost sign-in: the trial is
session_failed(an error row:hermit evalcounts it inerrorsand as 0 inmean_score; the Evolver neither pools it nor counts it in validation) and keeps what it spent; a lost sign-in stops the run (login_failure). The judge's rerun that ran no episode, or that refused the program the trial ran, is ajudge_errorrow, the same way. Concurrent trials wait for the engine module's one load (engine_module's lock), and a failed load is not kept. A curation cut off or with nothing kept is tried once more, then fails the step. A block that cannot compile or that the engine refuses is a block error, not a failed trial. The Evolver's misconfiguration (nollm, an unknown setting or select,continualwithoutdata.val) stops insetupand again instep; a budget stop is recorded and re-raised.Real execution paths and tests. The actor runs through the engine's own
Engine.run/validate/program_resultin its sandbox and the template's real context tool (Session); the Evolver through the Trainer andevaluate; the stand-ins are the simulator CLI (from ASPIRE'srun.py/runtime.pybehaviour) and the model.Documentation. Listed under Change.
Adapter template. New:
cap-agent0@1.0.prompt-onlyandaceare text the agent reads,aspire's library is Markdown entries, and none runs its content as code before the agent's own. Learnable:skill_library.py; fixed:exports.yaml,interface.py,README.md,.hermit/. What reaches the agent: the reader's text (in the prompt, after the API reference) and source (before every program); the check refuses what would stop every program, compiling the library as the engine does (as Python 3.10, ASPIRE's oldest, so far as Hermit's parser tells), and the Evolver asks the engine's own validator, on the benchmark venv's Python, about each library before it keeps it.Evolver. New:
cap_agent0; flow chart above.Upstream fidelity and adaptations. The comparison table above.
Learning information and evaluation boundaries. Above.
Sandbox control.
sandbox: {enabled: true, enforce: required}in every config;web_searchdoes not apply (no call goes through a CLI: every call is a chat completion with no tools); the learning material holds trial code and scores, no key values; the actor on the host (the GPU simulator), each program and the judge's reruns confined by the engine's bubblewrap sandbox, whose network reaches only the providers' services; the Evolver's model calls areDirectcalls (no process); the template's check runs incheck_spec's sandbox. No launch record yet: there has been no run (pending with the smoke).Experiments. Pending: the smoke and the first evaluation (above).
Agent three-layer abstraction. Model:
DirectoverChatClientfor every call; Base Agent: none (no CLI session); Acting:CapAgent0Actor; Evolver:cap_agent0withctx.agent. Timeouts: the client's request timeout and retries, the engine'srun_timeout_sper episode, the Trainer'scall_timeout_minper step; cancellation: the Evolver checksctx.cancelbefore each curation attempt and each validation run; usage: each trial's tokens and cost intoRunOutput(unknown when a call is unpriced), the Evolver's throughask.Group and selection.
tests/methods/cap_agent0/is groupcap_agent0(tests/selection.py: the method, the template andexamples/*/cap_agent0/*);select()givescap_agent0foractor.py,interface.py,rows.pyand the test file, and the engine's and LIBERO'sshared files select it too (
tests/core/test_selection.py). No new helper or fixture directory: the stand-ins are inthe test file, which loads the engine's
examples/cap_harness/utils/tests/cap_fakes.py.Names. Every test is a sentence (
test_a_block_that_cannot_compile_or_that_only_the_engines_run_refuses_is_left_out).Docstrings. The file opens with what it covers and its stand-ins (the stand-in ASPIRE checkout, the scripted
models); a test whose name cannot carry it says why (the replay check, the compile refusal, the pool on a re-read).
What it asserts. Records a caller reads:
trial.json's turns (stderr,replay_matches),RunOutput(
output,extra.session_failed, cost, tokens), the Evolver'sstate.json,skill_library.py, theStepResult, theTrainer's
evaluatemeans. Regressions checked by reverting each fix: with the replay check as before, the collectiontest fails (
assert (False is None)); with blocks only parsed, the compile test fails on its stderr; with the templatecheck one directory too shallow, the file fails to import. Round 1's fixes, each file put back to
ffb24ce: theload test fails with
AttributeError: module ... has no attribute 'Engine', the reference test with the trial goingon to its first episode, the judge test with no error raised, the curation test with an empty library called done.
Round 2's, each file put back to
061e22e: the judge test fails with the rerun'smedia/still there, theassembly test with
List, nprefused (the check) or noHINTABLE(the Evolver), the collection test withimages/kept. Round 3's, each file put back to2b60663: the link test fails with the folders the links namedemptied of
media/, the crash test with a lost run'smedia/left, the three new check cases with nothingrefused, the library test with the trial going on to its first episode, the assembly test with the decorator
dropped (and, run alone, the cap's helper's caller kept). Round 4's, each file put back to
1cac6fd: thelist-item test fails with nothing found, the two engine-validator tests with the refused function kept (no
refuse, noengineread), the curation test with no block named, the match test witha, bunknown names. Errortext is matched where it is the contract (the engine's
program rejected: ..., the model's stderr).Real entry points and stand-ins.
Config.load,Benchmark.from_config, the Trainer andevaluate, thetemplate's context tool through
Session, the engine'ssim.Engine(validate,run,program_result) in itsbubblewrap sandbox; stand-ins only at the edge: the model (
CapAgent0Actor.directscripted) and the simulator CLI, arun-batchthat executes each program as ASPIRE'sProgramExecutoratfa00f0edoes (its validator, one namespace,stdout redirected) and writes its files (
results.jsonl,outcome.json,source/program-result.json, keyframes).Isolation. Files only under
~/.cache/hermit-tests(the engine's fixture, removed after the test; the sandboxes'/tmpis empty); no network, no sign-in, no installed CLI. Skips with reasons: without bubblewrap (needs_bwrap),and the five parity tests without
CAPX_ROOT/ASPIRE_ROOT.Time and order. No timestamps; the retry pauses are recorded through a patched
time.sleep, not waited; nostate shared between tests.
Cost.
--durations: the group is 64 tests in under two minutes here (load average ~100); the slowest are thebubblewrap trials and judge runs (up to ~30 s under that load) and the template checks (~10 s). The Trainer runs once.
Hygiene. No unused imports (
ruff --select F: Validation); nothing fromconftest; the engine's runs end withtheir test, and the directories go with the fixture.
Reuse the framework's sandbox. Processes this change starts: each program (probe, turns, the judge's rerun) and
each validator check runs through the engine's
sim.confine, which ishermit.sandbox.Sandbox(the network only to theproviders' services: their loopback ports forwarded, a remote one through the allowlist proxy; ASPIRE's checkout
read-only less its hidden paths; writable only the run's storage); the template's check runs in
check_spec's sandbox. The actor itself runs in the Trainer's process (environment.runner: host, as ASPIRE'sdirect actor does): it is trusted code that starts the GPU simulator and runs no adapter code itself; the library's
code runs only inside the confined programs. The judge on the host reads the rerun's verdict. Launch records: none
yet (no run); a run writes one per sandbox under
$ASPIRE_OUT/sandbox/(the engine'srecord_dir, as for ASPIRE'sdirect actor), linked here with the smoke.
Sandbox changes are core changes. No change to the sandbox.
Task directories. The rows are task directories written by the engine's
tasks.write_task(
hermit.task.directory.write_task), one per trial; no new row format.Public and private halves. A row holds
benchmark,suite,task_id,seed,eval_seeds,score_label,role(andmulti_turn,vdm,ensembleon collection rows); the view is the engine'sfields.py:task_row(themetadata as the row), no answer or verifier. The judge's feedback the learner sees is the success score on the
trial's own seed;
continualalso sees validation means, not their trials.What a task asks.
network_mode: no-network(the engine'swrite_task); the actor runs on the host, so thetask sandbox's network and memory checks do not apply; the programs' sandbox reaches only the providers' services. Effective timeouts: no
agent.timeout_min; each engine runrun_timeout_s3,600 s and 8,000 steps, a trial atmost a probe and 11 turns, each model request the client's timeout and retries (then
unserved_retries3 withpauses); a step
trainer.call_timeout_min60 (paper: one curation, at most two calls) / 1,440 (continual: its sixty validation trials, and at step 1 the starting library's sixty too).Parity, for a moved benchmark. Not applicable: no benchmark is moved.
A real run. Pending: the smoke (Validation).
This description. Read end to end against the code at
0b8ec1b.Independent review (post-PR audit). Round 1: an Opus 5.5 agent at max effort, a separate session in its own
worktree, on
ffb24ceagainst the general, method, test, sandbox and benchmark checklists (code, callers, tests,configs, cap-x at
acac62f, ASPIRE atfa00f0e, the paper; no model calls, no simulator). No P1. Three P2, allfixed in the second commit (
061e22e):Engine): the first trials of everyprocess with
agent.concurrency4 were lost as errors; now a lock, and a failed load is not kept;paperpool, a validation 0 not rerun); now a judge error;max_tokenssent) or with nothing kept became an empty library in a step calleddone (in
paperthe final adapter would equal the root); now tried once more, then the step fails, withmax_tokenssent and bare fences read (a type-hint rule added with it was withdrawn in round 2).Six P3, all addressed: step 1 of
continualvalidates two libraries (timeout raised to 1,440 min); three claimsof this description corrected (an error row is 0 in
mean_score; the judge's rerun runs the program incap-harness's own process, disclosed above; the timeout); the collection's tier is nearer S4 than S3 (said so
everywhere); the API reference without its host-only heading now fails the trial instead of passing whole; the
VDM's frame after a motion that raised is documented; the
reasoning_effortdifference is in the table. Designquestions that stay are listed under "What is left out". Not verified by the audit: anything needing the
simulator, the endpoint's default
max_tokens, the whole suite's local breakdown.Round 2: the same, on
061e22e(both commits, the fixes in particular). No P1. Two P2, both fixed in the thirdcommit (
2b60663):runs/*/media, one level short of ASPIRE's run layout (<output-root>/<seed:04d>/<run-id>/,artifacts.pyRunRecorder), so no rerun's keyframes were ever removed (tens of gigabytes a test split); thetest's stand-in wrote the same wrong layout. Now each run directory the rerun's
stage2.jsonrecords loses itsmedia/(the engine keeps only run directories inside the rerun's output), and the stand-in writes ASPIRE'slayout;
runtime.pyhasfrom __future__ import annotationsand compiles a program without
dont_inherit, so a program never evaluates a hint (reproduced with ASPIRE's ownProgramExecutor). The check refused libraries the engine runs, and the assembly stripped hints and reprintedthe function (its comments gone). The rule, the removal and the prompt's sentence are withdrawn; the check reads
no names in hints; the actor's compile check and the stand-ins compile with that flag.
Round 1's three fixes hold (each re-checked). Three P3, all addressed: the synthesis input is S3 by the paper but
S3 and S4 in cap-x's compile and its shipped LIBERO library (said so); "by hand" was unsupported (the released
code stops at the curated text);
smoke_paper.yaml's step comment,rows.py's sample-seed message, CI on061e22e. Added with the fix:keep_images(above). Not verified: anything needing the simulator or a GPU (realkeyframe sizes,
program-result.json's real shape), whether GLM's reasoning counts againstmax_tokens.Round 3: the same, on
2b60663. One P1 and one P2, both fixed in the fourth commit (1cac6fd):links in its output; the engine removes them after the run, and when that removal fails (a run tree past the
path limit) the judge raises before
stage2.jsonis written, and the clean-up globbedruns/*/*through thelinks (reproduced: the folders a link named lost their
media/); a stalestage2.jsonwas trusted as is. Itneeds a program that escaped ASPIRE's validator. Now no link is followed and only a real
media/inside thererun's folder goes, from the run folders and the records alike (a run ASPIRE lost, a folder with no record,
loses its images too);
only compiling finds (
breakoutside a loop, a repeated keyword argument, a duplicate parameter) passedcheck_specand stopped every program (inpaper, every test trial an error row). The check now compiles eachfunction and the library as the engine does, parsing as Python 3.10 (ASPIRE's
requires-pythonis 3.10 to3.12; the parser tells
except*and type parameters, not 3.12's f-string quoting), and the actor compiles thelibrary before a trial.
Round 2's fixes hold (re-checked). The P3s, all addressed: a curated function's decorators were dropped silently
(now kept, so the check refuses it); the 60,000-byte cap could cut a function another calls (the rest are now
checked again); the stand-in's lost runs wrote no images (now a frame, so the judge test checks they go); the test
count and
keep_images's wording. Of the design questions,keep_imagesis now false inpaper.yamlandcontinual.yaml; the hints the acting model reads are under "What is left out".Round 4: the same, on
1cac6fd(a first attempt stopped on an authentication error and was run again). No P1.Two P2, both fixed in the fifth commit (
0b8ec1b):requires-python;bootstrap_libero.shbuilds the venv from the host'spython3): a 3.12 f-string that reuses its quote or holdsa backslash, or
a[*b], passesfeature_version=(3, 10)(checked on real 3.10.20 and 3.11.13 parsers), so sucha library passed the check and every trial refused it (in
paper, every test row an error). Now the Evolver,with
params.enginenamed, asks the engine's own validator, on the benchmark venv's Python in its sandbox,about each library; the functions it refuses go and the rest are checked again;
indentation and failed to parse, and the failure named no block. Now a fence's indentation comes off its lines,
as Markdown takes it, and a reply that gave nothing names the blocks that did not parse.
Round 3's fixes hold (the clean-up tried again with more link layouts; the compile matches ASPIRE's on one
Python). The P3s, addressed: the names a match pattern captures are bound in the check; a test pins the check's
compile to ASPIRE's (
runtime.py'scompile(tree, ...)and its annotations future); the body's CI line.Round 5: the same, on
0b8ec1b. No P1 and no P2; round 4's fixes hold (the engine check run end to end with thereal
validatein bubblewrap and a Python 3.11 parser as the venv's: the f-string function dropped, the restkept). Five P3 are open: the Evolver counts a validator that could not run (a broken venv) as a refusal of every
function, and a refusal no single function reproduces drops them all (the actor's block check shares the first);
code at column 0 under an indented fence, which the reading before
0b8ec1btook, no longer parses;aspire_root: ~/...resolves under the config directory in the Evolver (the actor expands~), and a wrongengineoraspire_rootshows only at the first synthesis; the method page's setup snippet leaves outengineandaspire_root,docs/methods/index.mdsays one curation call (up to two), and the grammar Hermit's parser cannottell also takes in
*args: *Tsand comments or newlines inside f-string expressions; the Evolver's engine testreplaces
sim.Enginewhole.