You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs/config: subagent_depth defaults to 1 and is undocumented, so subagents can't delegate #59826
experimental.subagent_depth defaults to 1 in 2.1.4, so a subagent cannot spawn another subagent ("Subagent depth limit reached (1)"). The default and the setting are not mentioned in the V2 docs (agents / config pages), so agent designs that delegate one level down (for example a coder subagent spawning explore) fail with no documented fix.
Environment
opencode version: 2.1.4
OS: Darwin 25.6.0 (darwin arm64); also Linux
Install/channel: latest (official installer)
Active plugins: not required to reproduce
Reproduction
Define a subagent coder whose permissions allow subagent on explore.
From the main session, spawn coder and ask it to delegate a search to explore.
Expected Behavior
Either a documented default and setting, or a default that allows at least one nested level (common pattern: main → specialist → explore).
Actual Behavior
The nested spawn fails with Subagent depth limit reached (1). Setting experimental.subagent_depth: 3 in opencode.json fixes it; the only place we found the setting was the config schema.
Additional Context
Related closed issues on depth-2 behaviour: #49342, #39112.
You're asking for the default experimental.subagent_depth to allow at least one nested level (main → specialist → explore), or for the setting to be easier to find. Maintainers will consider it.
Some context:
The default of 1 is intentional. The depth check in packages/core/src/tool/plugin/subagent.ts uses subagent_depth ?? 1, and the tests expect nesting to be blocked unless you raise the setting.
The setting is in the V2 docs, but only in the Experimental section of the config page ("Subagent depth"). It says the default is 1, so a subagent cannot start another subagent. It isn't mentioned on the agents page, which is probably where most people look when designing delegating agents.
Your workaround is the supported way to allow nesting:
{
"experimental": { "subagent_depth": 2 }
}
2 allows main → subagent → subagent; use higher values for deeper chains.
Activity
opencodejr commentedon Oct 28, 2026
Thanks for the clear write-up, @srobroek!
You're asking for the default
experimental.subagent_depthto allow at least one nested level (main → specialist → explore), or for the setting to be easier to find. Maintainers will consider it.Some context:
1is intentional. The depth check inpackages/core/src/tool/plugin/subagent.tsusessubagent_depth ?? 1, and the tests expect nesting to be blocked unless you raise the setting.1, so a subagent cannot start another subagent. It isn't mentioned on the agents page, which is probably where most people look when designing delegating agents.{ "experimental": { "subagent_depth": 2 } }2allows main → subagent → subagent; use higher values for deeper chains.Related issues:
subagenttool, so they try to delegate and fail with this error.subagent_depth> 1) don't show in the Desktop running-subagents indicator.generalagent.