small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
albedo robot-docs agents.md

Agents #

The agents extension exposes session relationships and operations to Python code. Its routes are implemented by agents/extension.gleam, with daemon operations in daemon/agents.gleam. Each agent is a session. See session attachment.

Starting agents #

The Python binding exposes agents.start for a root peer and agents.self.spawn for a child. Both return an Agent handle. Spawn also accepts a verifier and cyber access choice. The host rejects an empty task or model, validates the name, and limits the verifier to 4096 Unicode scalars. dispatch passes the request to the daemon.

with_worktree handles the requested workspace before starting an agent. A workspace and its files are shared resources unless the chosen worktree gives the agent a separate directory.

Relationships and operations #

agents.self is the caller's handle. agents.get resolves another handle. A handle's children and siblings methods report family state, while switch, close, and cancel operate on an owned target. agents.models asks for available models. agents.cancel_all can include descendants. See the Python binding and service.act and stop_all.

agents.set_role permits changing the caller's role or that of an owned child or peer. Only a child's parent can call child.set_verifier. agents.progress publishes a nonempty status of at most 512 Unicode scalars. These checks are in dispatch.

Messages and resources #

An Agent handle's messages method reads its transcript with sequence and pagination arguments. search_messages searches that transcript. agents.sessions searches sessions and clamps its result limit to 1 through 100. See the Python binding and agents/sessions.gleam.

resources.query reports process and session resource observations through the Python binding. Its host implementation is agents/resources.gleam. An observation does not guarantee that a process remains alive after the read.

Agent workflow #

Read agents.models() before choosing a model for a child. agents.self.spawn returns a handle, not the child's answer. Use mail for the result rather than treating an idle snapshot as proof of completion.

Use child.set_verifier(command) for an observable completion check. The agents hook checks normal parent submissions and stops while a reply is owed. Ask questions with mail.request("parent", ...). Report a blocker with mail.submit("parent", ..., blocker=True) when the verifier cannot pass. Clear or replace a verifier whose condition is no longer relevant.

Limits #

The subagents settings section defaults to 12 open children per parent and three generations below a root. -1 removes either cap. The declarations are in family.limits_section. Use mail by session ID to reach another session rather than adding nesting solely for communication.

The order of agents #

Clients rank working agents before idle agents, then closed agents. More recent activity ranks first within a state. A branch uses its best descendant rank so a working child can bring its ancestors forward. Equal branches use creation order and ID. See TUI ordering and web ordering. Check both clients when changing this policy.

Deletion boundary #

agents.delete refuses the request. Its error directs the user to delete through the session browser because deletion loses the child's work. agents.close is a separate operation. See dispatch and session lifecycle.