[FEATURE]: Allow subagents to spawn subagents #6719

Closed
opened 2026-02-16 18:05:02 -05:00 by yindo · 3 comments
Owner

Originally created by @zackheil on GitHub (Jan 18, 2026).

Originally assigned to: @thdxr on GitHub.

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

I was trying to build a helper subagent that takes different paths and calls tools to fulfill a request based on what was asked of it, but seemed to have run into the limitation that a subagent cannot use the task tool at all? The docs don't call this out from looking over the agent page, and there are no docs on the task tool.

The idea being that one of the routes my subagent could take would be to browse the web using the chrome devtools MCP, but because I only want a subset of tools enabled for the main helper subagent, and my rules for browsing the web warranted their own system prompt, I made a browsing subagent to not clutter up the main subagent. After troubleshooting why it couldn't be called, I saw using mitmproxy that my tool permissions for the task tool were ignored. Looking at the code, I also saw a flag here on line 60 that looks like it would deliberately take this permission away. I understand that this is probably to prevent recursion issues, but was wondering if this could be a feature in the future and just have OpenCode put a max depth on the task tool call to stop possible recursion.

Originally created by @zackheil on GitHub (Jan 18, 2026). Originally assigned to: @thdxr on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request I was trying to build a helper subagent that takes different paths and calls tools to fulfill a request based on what was asked of it, but seemed to have run into the limitation that a subagent cannot use the task tool at all? The docs don't call this out from looking over the agent page, and there are no docs on the task tool. The idea being that one of the routes my subagent could take would be to browse the web using the chrome devtools MCP, but because I only want a subset of tools enabled for the main helper subagent, and my rules for browsing the web warranted their own system prompt, I made a browsing subagent to not clutter up the main subagent. After troubleshooting why it couldn't be called, I saw using mitmproxy that my tool permissions for the task tool were ignored. Looking at the code, I also saw a flag [here](https://github.com/anomalyco/opencode/blob/dac099a4892689d11abedb0fcc1098b50e0958c8/packages/opencode/src/tool/task.ts#L60) on line 60 that looks like it would deliberately take this permission away. I understand that this is probably to prevent recursion issues, but was wondering if this could be a feature in the future and just have OpenCode put a max depth on the task tool call to stop possible recursion.
yindo added the discussiondocs labels 2026-02-16 18:05:02 -05:00
yindo closed this issue 2026-02-16 18:05:02 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 18, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #7296: [FEATURE]: Allow configurable subagent-to-subagent task delegation with call limits - Directly addresses allowing subagents to call the task tool with configurable limits to prevent infinite recursion
  • #2906: Limit Subagent Tree Depth - Discusses limiting the depth of subagent nesting to prevent recursive duplication of work
  • #8114: Task tool permission override no longer works for nested sub-agents - Related issue about task tool permissions being ignored for nested subagents

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 18, 2026): This issue might be a duplicate of existing issues. Please check: - #7296: [FEATURE]: Allow configurable subagent-to-subagent task delegation with call limits - Directly addresses allowing subagents to call the task tool with configurable limits to prevent infinite recursion - #2906: Limit Subagent Tree Depth - Discusses limiting the depth of subagent nesting to prevent recursive duplication of work - #8114: Task tool permission override no longer works for nested sub-agents - Related issue about task tool permissions being ignored for nested subagents Feel free to ignore if none of these address your specific case.
Author
Owner

@zackheil commented on GitHub (Jan 18, 2026):

So I wasn't able to find the subagent-to-subagent issue before making this one. That is pretty much what I want. Looks like that issue has been closed without actual resolution but a PR was opened. Would be nice to get https://github.com/anomalyco/opencode/pull/7756 in to support this

@zackheil commented on GitHub (Jan 18, 2026): So I wasn't able to find the subagent-to-subagent issue before making this one. That is pretty much what I want. Looks like that issue has been closed without actual resolution but a PR was opened. Would be nice to get https://github.com/anomalyco/opencode/pull/7756 in to support this
Author
Owner

@macastro9714 commented on GitHub (Jan 19, 2026):

@zackheil the issue that you linked has been reopened (until the PR is merged or another solution is implemented). I'd suggest leaving a comment there to generate more traction and closing this one to avoid splitting it

@macastro9714 commented on GitHub (Jan 19, 2026): @zackheil the issue that you linked has been reopened (until the PR is merged or another solution is implemented). I'd suggest leaving a comment there to generate more traction and closing this one to avoid splitting it
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6719