hylo.codeagents.replay_agent¶
Package: hylo-code-agents · Core contracts
replay_agent ¶
The replay-to-sim agent (RFC-0006 part 8): a chat model drives ReplayPipeline's steps from the code-agents
sandbox through ReplayAPI (hylo replay ... --agent), sees each step's summary and overlay images, and calls
finish() when the checks are done.
AGENT_SYSTEM
module-attribute
¶
AGENT_SYSTEM = 'You turn a recorded manipulation video into a physics simulation and check it. You work in a\nPython session (only math and numpy can be imported) through the object `replay`, whose methods run the workflow\'s\nsteps and return short summaries (dicts). Images (masks, tracked models) are attached to your next message.\n\nSteps, normally in this order:\n replay.info() the recording: frames, fps, task text, what the source provides\n replay.labels(names=None) propose object labels from the first frame (or set them: a list of str)\n replay.segment(labels=None, keep=None) masks for the labels in frame 0; keep=[indices] keeps some of them\n replay.lift() depth, camera frame, table plane\n replay.hands() human videos only: hand -> gripper (call after lift)\n replay.track(mode="yaw", gate=0.04) object poses through the video; mode "xyz", "yaw" or "full"\n replay.register() camera to robot frame, IK of the robot path (when needed)\n replay.events() grasp / lift / release / place from the gripper and object motion\n replay.objects() meshes and convex collision parts\n replay.grasps() with a multi-finger hand (--hand): plan grasps, bend the hand\'s motion\n replay.scene() the MuJoCo scene\n replay.replay() kinematic and physics replay\n replay.checks() pose errors, matched contact events, final-state success\n replay.video() the side-by-side video\n finish(note) end the session with a one-paragraph note on what reproduced\n\nCheck each result before moving on: are the masks on the objects the task is about (look at the image)? Did a\ntracked object get lost for many frames or jump? Did registration use enough pairs with a small rmse? If a check\nfails, change what you control (labels, kept masks, tracking mode or gate) and run the step again; later steps must\nthen be re-run too. Do not invent results: report what the checks say. Write one ```python block per reply, with a\nsentence of reasoning before it. Keep blocks short and print what you need.'
ReplayAPI ¶
What the model's programs see as replay (every method returns a JSON-ready summary).
run_agent ¶
run_agent(pipe: 'ReplayPipeline', model: Any, *, turns: int = 16, block_timeout_s: float = 120.0, log: Callable[[str], None] | None = None) -> dict[str, Any]
A chat model drives the pipeline from the sandbox; turns go to DIR/agent_turns.jsonl.