Skip to content

hylo.codeagents.watch

Package: hylo-code-agents · Core contracts

watch

hylo watch: follow a tool-agent episode in the terminal, replay a finished one, or steer a running one.

hylo watch RUN_DIR [--episode ID]        print the newest episode (or ID) and keep following it while it runs
hylo watch RUN_DIR --replay [--speed 4]  replay a finished episode on its recorded timing
hylo watch RUN_DIR --raw                 the episode's agent events as JSON lines
hylo watch --say "MESSAGE" --inbox PATH  send a message to a running tools.llm agent (its `inbox`)
hylo watch RUN_DIR --inbox PATH --interactive   follow, and send every line typed to the agent (Ctrl-D stops typing)

One line per thing that happened: the model's words, each tool call with a condensed result, each action's receipt, operator messages, and the verdict, with a footer of calls, decisions, tokens and cost. Read-only, except --say.

COLOURS module-attribute

COLOURS = {'dim': '2', 'bold': '1', 'red': '31', 'green': '32', 'yellow': '33', 'blue': '34', 'magenta': '35', 'cyan': '36'}

SHOWN module-attribute

SHOWN = ('episode.start', 'episode.end', 'agent.tool.start', 'agent.tool.turn', 'agent.tool.result', 'agent.tool.operator', 'agent.tool.finish', 'agent.tool.summary')

Printer

Printer(out: TextIO = sys.stdout, colour: bool | None = None, width: int | None = None)

out instance-attribute

out = out

colour instance-attribute

colour = out.isatty() if colour is None else colour

width instance-attribute

width = width or max(60, min(160, os.get_terminal_size().columns if out.isatty() else 120))

c

c(text: str, *styles: str) -> str

line

line(text: str = '') -> None

clip

clip(text: str, room: int | None = None) -> str

condense

condense(name: str, result: str) -> tuple[str, bool]

A one-line summary of a tool result and whether it succeeded.

render

render(ev: dict[str, Any], pr: Printer, totals: dict[str, Any]) -> None

episode_file

episode_file(run: Path, episode: str | None) -> Path

events

events(path: Path, follow: bool, poll_s: float = 0.5, idle_s: float = 3600.0) -> Iterator[dict[str, Any]]

Events of an episode file; with follow, keep reading new lines until episode.end (or idle_s of silence). The agent's last events (the final receipt, its summary) may land after episode.end: they are read too, and episode.end itself comes last.

watch

watch(run: Path, episode: str | None = None, *, follow: bool = True, replay: bool = False, speed: float = 4.0, raw: bool = False, out: TextIO = sys.stdout, colour: bool | None = None) -> dict[str, Any]

main

main(argv: Sequence[str] | None = None) -> int

follow, replay or steer a tool-agent episode in the terminal