Repository navigation
Every Bot is an orchestrator, with subagents that inherit all its permissions - #956
Merged
Merged
Conversation
Every Bot, built in or a remote AG-UI agent, is offered run_subagent on every run but a subagent's own and a check-in. OpenBot runs it: a fresh headless turn of the same Bot, as the same person and initiator, one level deeper, in its own thread derived from the conversation and the call. It holds the Bot's granted tools, its computer, its approval rules and standing instructions, and no components, subagents, message_bot or ask_person. Only its answer, its thread and its step count go back. Up to five run at once for one answer; the sixth is refused. For a remote agent it goes through the headless middleware, which now starts calls marked concurrent together. A subagent never waits on the person: an action that needs a yes stops it, the request it opened is withdrawn without resuming its thread, and the Bot is told exactly what it wanted to do, so it asks in the conversation. The parent's abort and the turn timeout stop it. Every Bot's prompt and remote standing role now tells it to work as an orchestrator. The check-in prompt for a remote Bot strips the standing guidance it repeats again, which the component rule had broken. In the chat, each call is a subtask card: the task, its steps as they happen (read from its thread through the existing history route), then its answer with the steps folded away, or the action it handed back.
# Conflicts: # server/src/copilot.ts
davidmckayv
requested review from
MikeRyanDev,
dustywusty,
guidovizoso,
mxmzb,
samjulien and
tylerslaton
as code owners
November 2, 2026 23:07
9 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every Bot is now an orchestrator. It hands work that needs many tool calls or a lot of reading to subagents. Each subagent inherits all of the Bot's permissions, and only its answer comes back, so the Bot's own context stays clean.
run_subagent(task, answer)is offered on every run of every Bot: built-in Bots, background turns, and any AG-UI agent someone brings. It runs a fresh turn of the same Bot, as the same person and initiator, on its own new thread. The subagent has:The parent gets back a compact result: the answer, plus the subagent's thread id and step count for the card.
For remote AG-UI agents the tool runs on OpenBot through
HeadlessToolsMiddleware, the same path OpenBot already uses to run tools for any agent, so no harness changes. That middleware now starts calls marked concurrent together, so a remote Bot's subagents run in parallel; everything else still runs in order.Limits:
Approvals stay in the conversation. A subagent never waits on the person. When it reaches an action that needs a yes, it stops, withdraws the approval request it opened so nobody is asked twice, and hands the action back. The main Bot then asks through the normal approval. The parent's abort and the turn timeout stop it too.
For concurrent native tool calls, hand-back waits for the calls already started to settle before withdrawing their approval requests. Parent cancellation, direct Stop, and the child deadline can interrupt that wait.
Default. A new standing instruction (
ORCHESTRATION_GUIDANCEinshared/bot-prompt.ts) reaches built-in prompts and remote standing roles, in chat and background turns. It tells the Bot to hand anything needing more than two or three tool calls to a subagent, with a self-contained task and the answer wanted.Chat. Each call is a "Subtask" card, live from its first step:
Tests:
subagent.integration.test.tsruns on real Postgres with a real MCP server and a real AG-UI endpoint; the repo's scripted model is the only fake. It covers:approvals.test.tsreproduces two concurrent approval requests with the second commit held, verifies both are withdrawn before hand-back, and checks parent cancellation, direct Stop, and the child deadline while that commit remains held.copilot.test.tscovers the instruction.Live check with the real model in headless Chrome: