Skip to main content

Invoking as sub-agents

Sub-agents let you hand off focused tasks to agents that run in their own isolated context. The main agent spawns sub-agents when a task benefits from parallelism, specialized tools, or context isolation - then aggregates the results when they finish.

CapabilityIDECLIWebMobile
Automatic sub-agent invocation✓✓✓✓
Explicit sub-agent invocation✓✓✓✓
Custom agents as sub-agents✓✓✓✓
Parallel execution✓✓✓✓

On Web, custom agents committed to .kiro/agents/ can be invoked as sub-agents, along with Kiro's built-in sub-agents. Sessions you start from Mobile can use the same custom agents as Kiro Web.

How sub-agents work

  1. Task assignment - You describe a task (or the main agent identifies one that benefits from delegation)
  2. Agent selection - Kiro selects the appropriate agent configuration based on the task and available agents
  3. Isolated execution - The sub-agent runs with its own context window, tools, and permissions
  4. Result return - When finished, the sub-agent returns findings to the main agent

Any custom agent can be invoked as a sub-agent. The main agent automatically selects agents based on their description field, or you can request one explicitly:

Use the code-reviewer agent to analyze src/auth/ for security issues

What sub-agents inherit

Sub-agents share the workspace environment but run with isolated conversation context:

Shared with main agentIsolated per sub-agent
Steering filesConversation history
MCP serversContext window
Workspace file accessSpec state
Permissions configurationHook triggers

Built-in sub-agents

Kiro includes internal sub-agents used automatically when appropriate:

  • Context gathering - Explores your project structure and gathers relevant files and context
  • General purpose - Handles parallelized tasks of any kind using the default agent configuration
  • Validation - Checks a finished change against your request (rolling out gradually). See Validation sub-agent
  • Introspect - Answers questions about Kiro from its documentation (CLI V3). See Introspect sub-agent

You don't need to configure these - the main agent uses them as needed.

Parallel execution

Sub-agents run in parallel, each working independently. This is useful for:

  • Refactoring multiple files simultaneously
  • Researching several topics in parallel
  • Running independent analysis tracks
Refactor these three services to use the new auth middleware - do them in parallel

Task dependencies

Sub-agents support directed acyclic graphs (DAGs) where tasks depend on each other. The main agent plans the full task graph upfront, then executes in the right order - running independent tasks in parallel and waiting for dependencies before starting dependent ones.

┌─────────────┐ │ 1. Analyze │ │ dependencies │ └──────┬───────┘ │ ┌──────▼───────┐ │ 2. Refactor │ │ modules │ └──────┬───────┘ │ ┌──────▼───────┐ │ 3. Run and │ │ fix tests │ └──────────────┘

Review loops

A stage can loop back to an earlier stage when its output signals that more work is needed - for example, a reviewer sends work back to an implementer for revisions.

Implement the feature, then have a reviewer check it and send it back for fixes until it passes

The agent builds a looping pipeline with:

  • target - the stage to re-run when the loop triggers
  • trigger - text in the stage output that fires the loop (e.g., NEEDS_CHANGES)
  • max_iterations - safety cap (between 1 and 10)

Constraints:

  • A stage cannot loop back to itself
  • Mutual loops (A → B → A) are rejected
  • The trigger must be at least four characters

Tool availability

The default sub-agent has the same built-in tools as the main agent - read, write, shell, web_search, web_fetch, and any configured MCP tools.

When you delegate to a custom agent, the sub-agent uses that agent's tools and permissions configuration. Tools not listed in the custom agent's config won't be available to the sub-agent. In CLI V3 and the IDE, the parent session's permissions also apply to the sub-agent's tool calls. See Sub-agent permissions.

Configuring sub-agent access

In CLI 2.x, control which agents can be spawned and which run without approval prompts using toolsSettings.subagent in your agent configuration:

json
{ "toolsSettings": { "subagent": { "availableAgents": ["reviewer", "tester", "docs-*"], "trustedAgents": ["reviewer", "tester"] } } }
FieldDescription
availableAgentsGlob patterns for agents this agent can spawn. Omit to allow all.
trustedAgentsAgents that start without a permission prompt.

CLI V3 ignores toolsSettings. To limit which agents an agent can spawn in CLI V3, list subagent/<name> entries in its tools instead of subagent. Don't add @builtin or * to that agent's tools, since both include invoke_sub_agent, which can start any agent. To start a sub-agent without a prompt, add a subagent rule to its permissions:

json
{ "tools": ["read", "write", "shell", "web", "subagent/reviewer", "subagent/tester"], "permissions": { "rules": [ { "capability": "subagent", "match": ["reviewer", "tester"], "effect": "allow" } ] } }

To restrict the tools a sub-agent can use, configure tools in the sub-agent's own config file rather than in the parent.

Sub-agent permissions

How Kiro approves a sub-agent's tool calls depends on the CLI version.

CLI 2.xCLI V3
Agent fields readallowedTools and toolsSettingspermissions (allowedTools and toolsSettings are ignored)
Starting a sub-agent without a promptAdd the agent to toolsSettings.subagent.trustedAgentsAdd a subagent capability allow rule
Sub-agent's own pre-approved toolsRun without a prompt, even if the parent doesn't allow themRun without a prompt only when the parent session also allows them

In CLI V3 and the IDE, Kiro checks every sub-agent tool call against two policies:

  • The parent session's policy. This is your user and workspace permissions.yaml, the parent agent's permissions, and the approvals you gave earlier in the session.
  • The sub-agent's own permissions.

The stricter result wins:

  • A deny from either policy denies the call.
  • An ask rule in either policy prompts you.
  • If the parent session's policy has no rule for the call, Kiro prompts you, even when the sub-agent's own rules allow it.

A sub-agent's allow rules take effect only when that agent runs as the top-level agent, for example with kiro-cli chat --agent <name>. A call that the sub-agent's rules don't mention follows the parent session's policy. A sub-agent with no permissions block runs under the parent session's policy.

To let a sub-agent's tool calls run without prompts in CLI V3, add the sub-agent's allow rules to one of these:

  • The parent agent's permissions.rules. The parent agent doesn't need the MCP server or tool itself.
  • Your user-scope ~/.kiro/settings/permissions.yaml. These rules apply to every agent.
  • Your workspace-scope permissions.yaml. These rules apply to every agent in that workspace.

For example, a sub-agent named data-analyst that allows every tool from the analytics MCP server needs the same rule in the parent agent:

json
{ "tools": ["read", "write", "shell", "subagent/data-analyst"], "permissions": { "rules": [ { "capability": "subagent", "match": ["data-analyst"], "effect": "allow" }, { "capability": "mcp", "match": ["analytics/*"], "effect": "allow" } ] } }

In a session where you trust every tool, --trust-all-tools approves sub-agent tool calls that would otherwise prompt. deny rules still apply.

Surface-specific behavior

When workflows are disabled, sub-agents run in parallel and the main agent waits until all complete before proceeding. When workflows are enabled, the main agent instead launches custom-agent delegation as a background workflow run, so you can continue the parent conversation and monitor the run under Workflows. Each delegated agent has its own context window.

You can speed up development by leveraging sub-agents to perform multiple tasks simultaneously - for example, fetching and analyzing several tickets in parallel.

Best practices

  1. Use for complex tasks - Most valuable for multi-step operations that benefit from isolation or parallelism
  2. Provide clear instructions - Specific task descriptions lead to better agent selection and results
  3. Monitor progress - In CLI, use Ctrl+G to check on long-running sub-agents
  4. Configure access - Limit which agents an orchestrator agent can spawn, and decide which ones start without a prompt. See Configuring sub-agent access

Troubleshooting

IssueSolution
Sub-agent not startingVerify the task description is clear and actionable
Unknown agentCheck the agent name with kiro-cli agent list; a request naming an unknown agent fails instead of falling back to the default agent
Missing tool accessCheck the agent configuration's tools field
Approval prompts blockingIn CLI 2.x, add the agent to trustedAgents to skip the start prompt, and pre-approve its tools in its own allowedTools. In CLI V3, add a subagent allow rule to skip the start prompt, and add the sub-agent's allow rules to the parent session's policy. See Sub-agent permissions
Main agent can't spawn sub-agentsAdd subagent to the orchestrator agent's tools array
Incomplete resultsProvide more specific instructions or break into smaller tasks
Page updated: November 13, 2026