Skip to content

hylo.codeagents.agents

Package: hylo-code-agents · Core contracts

agents

Code-writing agents (RFC-0006 parts 4 and 5).

code.llm: a chat model writes one Python block per turn against the toolkit (robot), in a persistent restricted namespace; it sees what the block printed, errors, the robot's status and images it asked for, never the task's score. It ends the episode with finish() or when a budget runs out.

agent: {type: code.llm, params: {model: {backend: ollama, model: qwen3.5:35b-a3b, vision: true},
        max_turns: 30, max_cost_usd: 1.0, block_timeout_s: 60,
        skills: {type: skill_library, params: {path: runs/skills/manip, frozen: true}}}}

code.program: runs a frozen solve(robot) (from a sealed program artifact, or source in params for experiments) with the same toolkit and no model: free to run and reproducible.

agent: {type: code.program, params: {artifact: artifact:pick-place-sub2@1a2b3c4d}}

Both drive the robot through EpisodeBridge, so every motion is an ActionChunk the kernel executes step by step through the SafetyShield. tools names the toolkit factory (default hylo.manip.tools:Tools; tests use hylo.codeagents.fakes:FakeTools); it is called as factory(robot_spec, executor, control_hz=..., show=..., **params).

DEFAULT_TOOLS module-attribute

DEFAULT_TOOLS = 'hylo.manip.tools:Tools'

CodeLLMAgent

CodeLLMAgent(model: str | Mapping[str, Any] | ChatModel = 'ollama:qwen3.5:35b-a3b', tools: str | Mapping[str, Any] | None = None, max_turns: int = 30, max_tokens: int | None = None, max_cost_usd: float | None = None, max_steps: int | None = None, block_timeout_s: float = 60.0, reply_tokens: int | None = None, act_wait_s: float = 21600.0, demonstration: str | None = None, skills: str | Mapping[str, Any] | Any | None = None, max_skills: int = 3, min_skill_similarity: float = 0.2, max_history_turns: int = 24, max_context_chars: int | None = 80000)

Bases: _CodeAgentBase

name class-attribute instance-attribute

name = 'code.llm'

model instance-attribute

model = build_chat(model)

budget instance-attribute

budget = Budget(turns=max_turns, tokens=max_tokens, cost_usd=max_cost_usd, steps=max_steps)

max_context_chars instance-attribute

max_context_chars = max_context_chars

demonstration instance-attribute

demonstration = self._demo(demonstration)

library instance-attribute

library = registry.build('memory', {'type': 'skill_library', 'params': {'path': skills, 'frozen': True}}) if isinstance(skills, str) else registry.build('memory', dict(skills)) if isinstance(skills, Mapping) else skills

join_s instance-attribute

join_s = block_timeout_s + 15.0

loop instance-attribute

loop: CodeLoop | None = None

spec

spec() -> AgentSpec

CodeProgramAgent

CodeProgramAgent(artifact: str | None = None, source: str | None = None, entry: str = 'solve', tools: str | Mapping[str, Any] | None = None, timeout_s: float = 300.0, act_wait_s: float = 600.0, kwargs: Mapping[str, Any] | None = None, record_output: int = 4000)

Bases: _CodeAgentBase

name class-attribute instance-attribute

name = 'code.program'

source instance-attribute

source = str(source)

digest instance-attribute

digest = 'sha256:' + hashlib.sha256(self.source.encode()).hexdigest()[:16]

join_s instance-attribute

join_s = 30.0

last instance-attribute

last: dict[str, Any] = {}

spec

spec() -> AgentSpec

load_ref

load_ref(ref: str) -> Any

tools_ref

tools_ref(tools: str | Mapping[str, Any] | None) -> str

tool_status

tool_status(tools: Any, fallback: Any) -> dict[str, Any]

The robot's status for feedback; with the reason the last plan() failed when the toolkit says (robot.why()).

make_tools

make_tools(tools: str | Mapping[str, Any] | None, env_spec: EnvSpec, executor: Any, show: Callable[[Any, str], None] | None) -> Any