Knowledge tree
Offensive Security
Shells
File Transfer
Web Applications
Subagents
A subagent is another agent given part of the main agent’s work. It receives its own goal and context, runs its own loop, and returns a result to the parent.
Unlike one tool call, a subagent can make several decisions and use tools of its own. A read_file call performs one operation. A subagent reviewing a module may inspect several files, run tests, and prepare a conclusion.
Delegation example
During a repository review, the parent agent can ask one subagent to inspect the authentication module and another to review the configuration parser.
Each worker receives:
- The specific review objective.
- The relevant files or instructions.
- The expected result.
If the reviews are independent, they can run in parallel. The parent then integrates the findings, removes duplicates, and decides which issues need action.
The useful return is not each worker’s complete transcript. Conclusions, necessary evidence, affected files, and open questions are usually enough.
Separate context
The subagent does not need the parent’s full conversation. A bounded context avoids copying irrelevant information and keeps intermediate searches or output out of the parent’s context.
Isolation can also hide an important constraint. If the review must not modify files, that rule needs to be in the delegation. It is not enough for it to exist only in a parent turn the subagent never received.
When parallel work hurts
If two subagents edit the same file, parallel execution can create conflicts and take more time than it saves. The same is true when the second task continually depends on discoveries from the first.
In those cases, one agent or sequential delegation is simpler. Read-only work and clearly separated modules are better candidates for parallel execution.
More agents also mean more model calls and processed context. They may reduce elapsed time when they run concurrently, but the extra work is not free. API Pricing covers how that usage accumulates.