opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[FEATURE]: Allow subagents to spawn subagents

Open zackheil opened this issue 1 day ago • 2 comments

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 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.

zackheil avatar Jan 18 '26 19:01 zackheil