Skip to content

[feat] True Async/Background Sub-Agent Delegation #5887

@ramarivera

Description

@ramarivera

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:

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions