Use subagents for isolated work
Ask Embedder to delegate when an investigation would fill the conversation with detail, or when several independent questions can run at once:- VS Code: select the subagent’s row in the chat, or Open agent session on a background subagent’s card above the chat input. The session opens in its own chat tab.
- Terminal: select the subagent’s row in the conversation, or run
/background, select a background subagent, and pressEnter. PressEscto return to the main chat, or↑when the input is empty. With an empty input, use←and→to move between subagent sessions. PressCtrl+Cto stop the subagent’s current turn.
Subagent types
Embedder picks the type that fits the task. The subagent’s row shows the type: VS Code shows the name as listed below, and the terminal shows it in title case, such as Codebase Explorer.
The four read-only types can read code, documents, and the web. With subagent hardware access on, they can also check hardware status and read serial output that’s already been captured.
If the main chat is in Plan mode when a subagent starts, the subagent is read-only, including a general subagent, and stays that way until it finishes. Otherwise, a general subagent works in Act mode, even when the main chat is in Debug mode, so it doesn’t use the debugger. Keep debugger work in the main chat.
A general subagent can’t start more subagents, ask you questions, switch modes, add peripherals, upload documents, or stop background tasks. Give a general subagent enough context to resolve ambiguity on its own: the files it owns, the checks to run, and what the main chat has already ruled out.
Approvals inside a subagent
A subagent starts with the main chat’s approval mode and follows the same rules. If you change the approval mode, running subagents follow the change right away.- Shell commands on your allowlist run without asking. So do directories you allowed outside the project, such as a trusted toolchain folder.
- Any other shell command, file write, or path outside the project raises the normal request card. The card appears in the main chat, labeled with the subagent’s task title, and the subagent waits until you answer. See Approvals from subagents.
- Approving lets the action proceed. Rejecting without a reply stops the subagent’s current turn. In VS Code, you can instead reply with what to do, and the subagent continues with your instructions.
- In Always ask mode, Embedder also asks before it starts each subagent, and the subagent still asks before each of its actions.
west build or ctest. Each command asks exactly as it would in the main chat. Hardware access is controlled separately; see Control subagent hardware access.
Runtime limits
A subagent has no fixed time limit. A subagent working in the foreground runs until it finishes, you stop it, or the main chat’s turn is stopped. If it shows no activity for about 15 minutes, Embedder treats it as stalled and stops it.Run subagents in the background
For long work that the main chat doesn’t need right away, ask Embedder to run a subagent in the background:- In VS Code, select Stop on its row in the chat, or Stop background agent on its card above the chat input.
- In the terminal, run
/background, select the task, and pressxtwice.
Control subagent hardware access
General subagents have hardware access by default. They can use hardware tools and run hardware commands through the shell. Embedder lets one agent use a board at a time: the main chat and its subagents take turns, and the others wait until the board is free. To turn hardware access off, or back on, run:Long shell commands become background tasks
Embedder watches each shell command for up to one minute:- If the command finishes within a minute, its result appears in the chat.
- If it’s still running, it moves to the background without restarting.
- When it finishes, Embedder reports the result in the conversation.
A hardware command keeps the board reserved for its session until the command exits, including after it moves to the background. Flash commands and commands that disconnect serial monitors always stay in the foreground. See Hardware scripts.
View and manage background tasks
Background shell commands and background subagents appear in one place:
You can also ask Embedder in the conversation to:
- List the running background tasks.
- Report the status or latest output of a task.
- Stop a task. Stopping a shell command ends the command and any processes it started. Stopping a subagent ends its turn but keeps its session and transcript.
Parallelize with subagents
- Ask for several read-only subagents in one message when you have independent questions. They run at the same time.
- Use a general subagent for a self-contained implementation task, in the foreground or the background. Subagents share the project’s files, so give each one files that no other subagent edits.
- Keep tightly coupled edits in the main chat.