opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[feat] True Async/Background Sub-Agent Delegation

Open ramarivera opened this issue 1 month ago • 6 comments

Problem

Currently, sub-agent delegation in opencode appears to be synchronous or modal. When a primary agent delegates a task to a sub-agent, the interface typically switches context to that sub-agent, blocking the primary flow or requiring manual navigation. There is no native "fire-and-forget" mechanism where a sub-agent runs fully in the background while the main agent continues to be interactive, accepting new commands or performing other work simultaneously.

Proposed Solution

Implement a true asynchronous delegation flow:

  1. Delegation: The Main Agent delegates a task (e.g., "Run the integration tests and fix any timeouts").
  2. Async Execution: The Sub-Agent spins up in a dedicated background session.
  3. Non-Blocking: The Main Agent immediately regains control/interactive state, allowing the user to continue working on other tasks.
  4. Completion Notification: The Main Agent receives a signal, message, or callback when the Sub-Agent completes, allowing it to surface the results or integrate the changes.

Related Issues & Community Interest

This feature aligns with high community interest in concurrency and background workflows:

  • #5826 (Agent Session Tab Bar Navigation): Requests UI to manage "concurrent agent sessions" and an orchestrator pattern, highlighting the need to monitor parallel tasks.
  • #1970 (Background Bash Execution): Requests async execution for long-running bash tasks (similar to Ctrl+b), which is a foundational requirement for non-blocking sub-agent work.
  • #4790: Requests fully autonomous systems working with multiple agents concurrently.
  • #4278 (File locks): Proposes safety mechanisms (locking) specifically to handle the "multiple agents/tools in parallel" scenario.

Use Case

  • Orchestration: A main "Architect" agent delegates coding tasks to "Developer" sub-agents and a "QA" sub-agent simultaneously.
  • Efficiency: A user asks the agent to "fix the build" (delegated to sub-agent) and immediately asks "explain this other file" (main agent) without waiting for the build fix to finish.

EDIT: Ofc, AI generated issue, but I did do a search of the docs and similar issues before

ramarivera avatar Dec 21 '25 07:12 ramarivera

This issue might be related to or build upon existing work in the following areas:

  • #1293: The foundational feature request for "subagent" AI task delegation, which this async delegation feature extends
  • #4422: Specific issues with subagent view context and delegation problems that would be addressed by proper async delegation architecture

The issues you've already referenced (#5826, #1970, #4790, #4278) are excellent foundational work for this feature.

Feel free to ignore if this issue has a specific scope different from those above.

github-actions[bot] avatar Dec 21 '25 07:12 github-actions[bot]

This looks like what Claude Code is doing.

HelloGGX avatar Dec 21 '25 10:12 HelloGGX