hylo.codeagents.motion_free¶
Package: hylo-code-agents · Core contracts
motion_free ¶
Free mode of the motion studio: the model composes its own pipeline as scripts in its run directory.
hylo motion --free "REQUEST" --out DIR [--video V] [--image I] [--model SPEC] [--budget turns=12]
[--max-tool-calls 40] [--script-timeout-s 900] [--max-wall-s S]
Each turn the model writes one Python script; motion_scripts checks it, saves it as scripts/turnNN.py and runs it
in a guarded process in the run directory (motion_freerun). Scripts import the kit (from studio import *,
motion_freekit) and may do their own processing with numpy and scipy, writing any files inside the run directory.
Every tool call is a request answered here by FreeTools (an allowed tool, every path inside the run directory, the
tool-call budget), run with the studio's tools (motion_tools.StudioTools) and logged in log.jsonl with every
script. finish(motion, characters) ends the session; the studio then reports each character (retargeting error,
joint-limit hits, plausibility) and renders the lineup (motion_tools.finalize). Inputs are copied into inputs/.
TOOLS
module-attribute
¶
TOOLS = ('text_motion', 'video_motion', 'pose_from_image', 'tool', 'characters', 'retarget', 'check', 'render', 'lineup', 'look', 'finish')
PATH_KEYS
module-attribute
¶
SYSTEM
module-attribute
¶
SYSTEM = 'You are a motion director with a studio of tools. You turn a request into a humanoid motion shown on\nrobots and human characters, by writing Python scripts. You decide the pipeline: which tools, which processing,\nwhich characters.\n\nEach turn: a short thought, then exactly ONE fenced ```python``` block. The studio saves it as scripts/turnNN.py\nand runs it as a separate process in your run directory (the current directory). You see what it printed, any\nerror, and images you asked to look at. Scripts do not share variables: save what you need to files (save_motion,\nnp.save, json) and load it in the next script.\n\nStart every script with `from studio import *`. The studio kit:\n- Sources (each returns a Motion): text_motion(prompt, seconds=4.0, seed=0) (NVIDIA Kimodo; a list of prompts\n and a list of seconds makes one continuous motion; several minutes per call), video_motion(path, start=0.0,\n seconds=None) (pose estimation from a video of one person), pose_from_image(path) (a one-frame Motion).\n- Other tools: hands(video), depth(image), segment(image, prompts), human(video) -> {"outputs", "files"}.\n- Motion: .joints (T, 17, 3) metres, z up, ground z = 0, facing +x at the start; .fps; .frames; .seconds;\n .summary(); .joint(name); .pose(t). NAMES lists the 17 keypoints. motion_from_array(joints, fps) wraps your\n own array. save_motion(m, path=None) -> path, load_motion(path).\n- Edits (return new motions): concat(m1, m2, ..., blend=0.3), blend(a, b, seconds=0.5), loop(m, times=2),\n mirror(m), retime(m, speed=None, seconds=None), trim(m, start, end), hold(pose, seconds), keyframe(m, pose, at,\n width=0.8). You can also write your own processing with numpy and scipy (filters, blending, stylising, looping)\n on m.joints; keep bone lengths plausible and the feet on the ground (z >= 0).\n- characters() lists the characters; retarget(m, character) -> metrics (keypoint error, limb angle error,\n joint-limit hits); check(m, character) -> {"problems", "kinematics"}.\n- render(m, character, camera="track") -> MP4 path (Blender, minutes); lineup(m, characters) -> one MP4 with\n the motion on several characters side by side (minutes per character). look(path, n=4) shows you frames of a\n video or an image in your next feedback: look at your renders and fix what is wrong.\n- finish(m, characters=[...], note="") ends the session; the studio then checks the motion on each of those\n characters and renders them together. A ToolError means a request was refused or failed.\n\nRules: work only inside the run directory (relative paths; inputs are in inputs/). Imports allowed: numpy, scipy,\nmath, json, statistics, itertools, functools, collections, random, re, copy, pathlib, studio, and your own\nmodules in lib/ (write them with open("lib/name.py", "w")). No processes, network or eval. Each script has a\ntime limit (tool time excluded) and the session a tool-call budget. print() what you need to know.\nBe economical: plan in few scripts, generate once, process, check on the characters, render once and look, then\nfinish. Never drop part of the request to make the motion easier.'
FreeTools ¶
Answers the kit's requests (motion_freekit) with StudioTools, inside the run directory and the budget.
op_video_motion ¶
first_message ¶
run_free ¶
run_free(request: str, out: str | Path, *, image: str | None = None, video: str | None = None, model: Any = None, budget: Budget | str | None = None, backend: Any = None, max_tool_calls: int = 40, script_timeout_s: float = 900.0, max_wall_s: float | None = None, samples: int = 16, style: str = 'auto', log: Callable[[str], None] = lambda s: None) -> dict[str, Any]
One free-mode session; returns summary.json's content.
free_command ¶
hylo motion --free: the model composes its own pipeline as scripts in its run directory