feat(subagent): add session-owned task messaging and cancellation (#5985)

let's go!
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-05 05:16:33 +08:00
1 parent f75470e72f
commit 6ff96f2a8f
93 files changed
+5632 -1156

No files matched your search

+31
View File
@@ -173,6 +173,37 @@ Tools are discovered automatically from built-in modules and plugin entry points
Security-sensitive controls live in [`configuration.md#security`](./configuration.md#security). For production or shared chat apps, also configure channel access controls such as `allowFrom`, pairing, or WebSocket tokens.
## Subagents
Nanobot can delegate parts of a request to subagents while remaining responsible
for the final answer. In the conversation that started the work, you can ask it
to check progress, send follow-up instructions, wait for results, or cancel a
task. Cancelling one task leaves the others running. A delivered instruction
means the subagent received it, not that it has acted on it yet.
Background tasks return their results to the conversation that started them.
Single-turn CLI and SDK calls wait for results when background delivery is
unavailable. Tasks that reach their iteration limit are marked incomplete;
cancelled, failed, and incomplete tasks retain available partial results.
Use `/stop` to stop the current session and its subagents. Other sessions are
unaffected. Some operations may take time to stop, and cancellation does not
undo file changes or other actions already taken.
Subagents belong to their original conversation. They do not appear as separate
topics or in general conversation searches. Deleting the conversation stops its
subagents and removes their saved history; forking it does not copy them.
Saved task history and results remain available after a gateway restart.
Unfinished tasks are marked interrupted, with saved partial results when
available. Nanobot does not automatically resume them or resend completion
notifications; ask it to start a new task to continue the work.
See [Delegated work in the WebUI](./webui.md#delegated-work) for progress and
task details. WebUI temporary chats do not support subagents. SDK calls with
`ephemeral=True` wait for delegated results without saving the temporary
conversation or its subagent history.
## Background Jobs
When `nanobot gateway` starts, it runs workspace-scoped automations and
+22
View File
@@ -238,6 +238,28 @@ by the summary remain in your chat history but are no longer sent to the model
verbatim. Use `/compact` to compact the current topic's context manually.
See [Memory](./memory.md) for compaction and Dream consolidation.
### Delegated work
When nanobot delegates work to subagents, a work group appears under the request
that started it. Progress continues to update after the main reply finishes.
Completed tasks stay available for inspection, and refreshing or reopening the
WebUI restores saved progress and results without restarting the work.
Work groups follow the browser's **Activity details** preference: **Auto** opens
running work and folds it when all tasks finish; **Expanded** keeps it open by
default. You can also expand or fold a group manually to check individual
outcomes, including failures and partial results.
Select a task to open its read-only conversation on the right, or across the
screen on mobile. Read its messages, tool activity, file edits, and results,
including formatted Markdown. Closing the details leaves the task running; its
stop button cancels only that task. Give follow-up instructions to nanobot in
the main conversation.
These controls appear when the connected host supports subagent tasks. See
[Subagents](./concepts.md#subagents) for cancellation, saved history, and gateway
restart behavior.
## Temporary Chats
Use a temporary chat for a conversation that should not be added to nanobot's