Skip to main content

Module task

Module task 

Source
Expand description

Remote tasks: a whole agent task on another of the user’s nodes (Node companions).

asking node                      serving node (runs the AgentSession)
  Run { request } ->
                                 <- Started, Delta, Step, ToolStarted, ToolFinished, Skipped, Blocked ...
                                 <- Ask { ask, prompt, tool }
  Answer { ask, answer } ->
  Cancel ->                      (optional, any time)
                                 <- Finished { outcome, messages } | Failed { error }

The serving node’s tools, budget and policy apply (its grants sync from the user’s other devices). Approval cards are shown on the asking device: the serving session’s Approver forwards each prompt and waits for the answer. The conversation lives with the asker: it sends its history with each task and gets the updated history back.

Structs§

RemoteOutcome
A finished remote task and the conversation to keep.
TaskRequest
One task for a companion that runs on the serving node.

Enums§

ClientMsg
ServerMsg

Constants§

CANCEL_GRACE
How long the asker waits for the node to wind down after a cancel.
PROTOCOL
Stream protocol id for remote tasks.

Traits§

TaskHost
What the serving app offers: a session for the requested companion, built with the given approver (which forwards cards to the asker). Refuse companions that do not run here.

Functions§

run
Run a task on node. Events arrive as ordinary AgentEvents (so the app’s panel code is the same as for a local session), approval cards go to approver here, and cancel stops the task on the node.
serve
Serve one task on an accepted channel. The caller has already checked that the far end is a linked device (prefer serve_for, which checks it here). If the asker goes away the task is cancelled.
serve_for
Serve one task for caller: auth admits it first (Authorize::admit; a refusal is sent back as Failed), then the session comes from TaskHost::session_for.