Skip to content

[FEATURE]: Allow configurable subagent-to-subagent task delegation with call limits #7296

Closed

Description

@NamedIdentity

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

Problem
Currently, task.ts hardcodes task: false for all subagent sessions (lines 65-69, 132-137), preventing any subagent from delegating to another subagent. This blocks legitimate workflows like:

  • Principal-Partner delegating to Assistants
  • Assistant-Sonnet having Assistant-Flash cross-check its work
  • Assistant-Flash asking Assistant-Sonnet for thorough analysis

The agent config already supports granular task permissions:

assistant-sonnet: {
tools: { task: true },
permission: {
task: { *: deny, assistant-flash: allow }
}
}

But this config is ignored because task.ts unconditionally overrides it.

Proposed Solution

  1. Respect agent-level task permissions instead of hardcoding task: false
  2. Add optional task_limit config to prevent infinite loops:
    assistant-sonnet: {
    tools: { task: true },
    permission: {
    task: { *: deny, assistant-flash: allow }
    },
    task_limit: 3 // Max task calls per session (0 = current behavior)
    }

Use Case
Building an Agentic Collaboration Framework where:

  • Principal-Opus orchestrates work
  • Principal-Partner (subagent) can delegate to Assistants
  • Assistant-Sonnet and Assistant-Flash can cross-check each other's work

The permission system already expresses "Sonnet can only task Flash" - it just needs to be honored.

Backward Compatibility
Default behavior unchanged - task_limit: 0 (or absent) means task tool disabled for subagents, matching current behavior. Only users who explicitly configure permissions get the new capability.

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Jan 8, 2026
  2. github-actions commented on Jan 8, 2026

    @github-actions
    Contributor

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

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

  3. NamedIdentity commented on Jan 9, 2026

    @NamedIdentity
    Author

    I am exploring trying to make a PR for this myself. I have no coding background, or developer experience. But I figure it's time to try to vibe code a contribution.

    It also seemed logical, that at the very least I need to construct a more detailed design for the PR to make sure it does what my use-case requires.

    My thinking is, even if I fail miserably in producing fully working code that can be pulled into the repo, I will succeed in defining a design that experienced developers managing the project can use to make a proper PR.

  4. akirfman commented on Jan 9, 2026

    @akirfman

    +1 to this feature request.

    I'd even be inclined to view parts of this as a bug since I was actively able to leverage subagents that could invoke other subagents before the v1.1.1 release.

    Example from v1.0.223 (https://github.com/anomalyco/opencode/blob/01237c5325f5c3eda142f459b22f902b5aa07d7c/packages/opencode/src/tool/task.ts)

          const result = await SessionPrompt.prompt({
            messageID,
            sessionID: session.id,
            model: {
              modelID: model.modelID,
              providerID: model.providerID,
            },
            agent: agent.name,
            tools: {
              todowrite: false,
              todoread: false,
              task: false,
              ...Object.fromEntries((config.experimental?.primary_tools ?? []).map((t) => [t, false])),
              ...agent.tools,
            },
    

    Even though task was hardcoded to false, I could override it by adding task: true into my subagent definitions. For example, I have a research orchestrator subagent that delegates to more focused subagents scoped to different groups of docs and sources that I didn't want to group together into one agent.

    Agent YAML frontmatter example:

    ---
    description: Research coordinator that routes queries to appropriate sources and consolidates results. Cross-cutting utility for all SDLC agents.
    mode: subagent
    tools:
      // ... other tools here
      task: true
    ---
    

    Working Example from v1.0.223:

    Image

    Running the same test with the same config on newer versions of OpenCode doesn't work any longer. I'm sure there's more nuance to the topic here in general, but it would be nice to have that optional override behavior back.

  5. NamedIdentity commented on Jan 11, 2026

    @NamedIdentity
    Author

    I have submitted a PR which provides these features. #7756

  6. macastro9714 commented on Jan 19, 2026

    @macastro9714

    @NamedIdentity I'd suggest to not close the issue until the PR gets approved, since it might still be rejected or not reviewed/allowed

  7. NamedIdentity commented on Jan 19, 2026

    @NamedIdentity
    Author

    @macastro9714 I'm new to this so I'll go with your suggestion to reopen this issue until the PR is accepted into main.

  8. github-actions commented on Mar 26, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

  9. NamedIdentity commented on Mar 26, 2026

    @NamedIdentity
    Author

    Issue is not closed. PR is not yet merged. #7756 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

discussionUsed for feature requests, proposals, ideas, etc. Open discussion

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions