Subagents and background tasks
Agents can hand part of a job to a subagent, or start a command that keeps running in the background. IZ Code shows both the same way for every agent: subagents get their own block and chat, background work stays visible and stoppable, and the Agent map shows the whole tree.
Subagents#
A subagent is a second agent session that works on one part of a task and reports back. Some agents start subagents on their own: Claude's Agent tool, Codex's subagents and similar features of other agents. Any agent can also call IZ Code's sessionSpawnSubAgent tool, which can start a subagent of a different agent, for example a Claude chat that asks Codex to review a file.
sequenceDiagram
participant You
participant Main as Main agent
participant Sub as Subagent
You->>Main: Task
Main->>Sub: Start with a part of the task
Sub->>You: Permission request, in the main chat
You-->>Sub: Allow or Deny
Sub-->>Main: Result
Main-->>You: AnswerIn the chat, a subagent appears as a block inside the answer:
- The block shows the subagent's title and status while it works, and the tool calls it makes are nested inside it.
- Open Subagent opens the subagent's own chat in a tab. It is read-only: you watch what it did, but you talk to the main chat.
- If the subagent needs permission for something, the request appears in the main chat and in the subagent's tab. Answer it in either place.
Starting a subagent never asks for permission (unless your Permission Policy is Deny all). The subagent itself still asks for each edit or command, under the same rules as the main chat.
Cross-agent subagents#
sessionSpawnSubAgent takes the agent to start and the task for it:
- With
waiton (the default), the calling agent waits for the result. If the subagent takes longer than about 45 seconds, the call returns a result id and the agent asks for the result later withsessionGetSubAgentStatus. - With
waitoff, it returns at once and the agent checks back later. - Subagents can start their own subagents, up to four levels deep.
Background work#
When an agent runs a long command in the background (a dev server, a watcher, a long test run), IZ Code keeps it as background work of the chat:
- The agent starts it with
runCommandandbackground: true, reads its output withcommandOutputand stops it withcommandStop. - Claude's own background shell commands go through these tools, so they are tracked too.
- A subagent still running when the main turn ends also becomes background work.
Stopping a background command stops the whole process tree, including child processes it started.
The Agent map#
- Open it Click Agent Map in the chat header, or run Agent Map from the Command Palette.
- Read the tree The chat's agent is at the top, with every subagent below it. Each node shows its status (Running, Waiting for you, Done, Failed, Cancelled), how long it ran, and its tokens or tool calls.
- Open a subagent Click a node to open that subagent's chat. Back to the chat returns to the main conversation.
- Stop background work The list of background tasks shows shell commands and subagents still running. Click Stop to end one.
How each agent reports subagents#
| Agent | Subagents | Background commands |
|---|---|---|
| Claude | Its Agent / Task tool, with a full child chat | Tracked through IZ Code's command tools |
| Codex | Its subagents, with a full child chat and token counts | Codex's own command tool, shown as a tool call |
| Google Antigravity | Its subagents; tool calls go to the child chat | Shown as a running tool call |
| Kimi Code | Its Agent tool; the child chat shows the prompt and final result | Kimi's own shell |
| Any agent | sessionSpawnSubAgent | runCommand with background: true |
Settings#
Subagents and background work have no switches of their own. They follow your permission settings:
| Setting | Values | Default |
|---|---|---|
izcode.agent.permissionMode | default, ask, autoAllow, deny | default |
izcode.agent.chatModeControlsApprovals | true, false | true |