Watch tasks
Passwatch to propose() to hear how a task ended without awaiting it. Your agent’s watch handler receives the outcome:
- With
true, the handler receives the task’s outcome once it ends. - With a group name, the handler receives the outcomes of every task proposed with that name together, once the last of those tasks ends. This way, related tasks report back together.
watch throws unless the agent connected with a watch handler.
List delegated tasks
listTasks() (list_tasks() in Python) lists the tasks an agent delegated, newest first. Each entry has the task’s status, latest update, and whether it produced a result:
statuses, agent, watch, or unread, and pass a page’s next as cursor to get the following page.
Collect tasks after a restart
Delegated tasks keep running when the requester’s process ends, whether the process closes, crashes, or restarts. The task handles in that process throw anAgentJamError.
collect() reattaches every task the agent delegated that is still running. It also reattaches every delegated task that ended before the agent received the task’s outcome. Each handle that collect() returns replays what the executor sent:
Tracking from a model
Models get the same capabilities through the network tools:delegate_tasktakeswait: falseto start several tasks at once. It also takes awatchgroup.wait_for_taskswaits for all or any of the tasks the model started.list_taskslists them.
wait_for_tasks.