hylo.codeagents.research¶
Package: hylo-code-agents · Core contracts
research ¶
Research sessions (RFC-0006 part 5): a model develops a program on development cases, then it is frozen.
The model works in one persistent namespace across episodes of the benchmark's search split (development
cases). Besides the toolkit (robot, on the live episode) it has:
cases the development cases: [{"case": i, "instruction": ...}]
reset(case=None) end the live episode, return its outcome (success, steps, reason), start `case` (default: again)
submit(source=None) validate a program defining solve(robot) (default: the imports, functions and constants the
blocks defined) and run it, without the model (code.program), on a
fresh episode of every development case; returns each case's outcome and printed output
finish() end the session
The submission with the most development successes (the earliest on a tie) is frozen into a sealed program
artifact (provenance: the search split only) and becomes a Candidate(kind="code") whose patch sets
agent.type: code.program and the artifact: from there it is an ordinary candidate (search_val, gate, held-out,
approval). The model never sees anything but development cases. Budgets: turns, model tokens and cost, resets,
submissions. Everything goes to the session directory:
log.jsonl one record per turn, reset, submission and the end (images as PNG files under images/)
live/ traces of the live episodes
submissions/sub-NN/ solve.py, results.json and the traces of each submission's runs
frozen/<name>/ the sealed program artifact
summary.json turns, usage, dev outcomes per submission, the frozen program and the candidate
SYSTEM
module-attribute
¶
SYSTEM = 'You are developing a Python program that makes a robot solve a family of tasks. You experiment on\ndevelopment cases, then submit programs; the best submission is frozen and later evaluated on unseen cases of the\nsame family that you will never see.\n\n{robot}\n\nToolkit API (`robot`, acting on the live development episode):\n{api}\n\n{rules}\n\nResearch functions (in your namespace):\n- `cases`: the development cases, a list of {{"case": i, "instruction": ...}}. A live episode of one case is running.\n- `reset(case=None)`: ends the live episode and returns its outcome {{"case", "success", "steps", "reason"}}, then\n starts case `case` (default: the same case again). Your variables survive resets.\n- `submit(source=None)`: submits a program that defines `solve(robot)`; it is validated, then run without you on a\n fresh episode of every development case. `submit()` with no argument submits what your blocks defined at the top\n level: every import, function definition and constant assignment (the latest of each name), which must include\n `solve(robot)`. Or pass the complete program as a string. The program does not see your other variables. Defining\n `solve` does not submit it: only submit() evaluates it. Returns {{"submission", "successes", "cases", "results": [per case: success,\n steps, reason, output, error]}}. A program can call finish() to end its episode early; returning also ends it.\n- `finish()`: ends the session. The submission with the most development successes is frozen.\n\nWrite general code: read the instruction from robot.status()["instruction"], measure the scene every time, and never\nhard-code positions seen in one case.{skills}{demo}{parent}{guidance}'
ResearchConfig ¶
ResearchSession ¶
ResearchSession(cfg: ExperimentConfig, model: str | Mapping[str, Any] | ChatModel, out_dir: str | Path, *, config: ResearchConfig | Mapping[str, Any] | None = None, name: str | None = None, log: Any = None)
rc
instance-attribute
¶
rc = config if isinstance(config, ResearchConfig) else ResearchConfig.model_validate(dict(config or {}))
candidate ¶
The frozen program as a code candidate (None when nothing was frozen).
evaluate ¶
Run the frozen program on other splits (search_val, gate, heldout) and record the results in summary.json.
dev_cases ¶
The first n instances of the search split, interleaved across tasks (seed 0 of every task, then seed 1, ...).