Repository navigation
Closed as not planned
Closed as not planned
Copy link
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)discussionUsed for feature requests, proposals, ideas, etc. Open discussionUsed for feature requests, proposals, ideas, etc. Open discussion
Description
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
Current Problem
OpenCode's SubAgent invocation pattern has the following limitations:
- Blocking execution: Parent Agent is blocked via
awaiton SubAgent completion - One-way communication: SubAgent returns only a final message, no intermediate updates
- No real-time interaction: Parent Agent cannot respond to user input while waiting for SubAgent
- Limited orchestration: Complex multi-agent workflows difficult to coordinate
Proposed Enhancement
Enable real-time, asynchronous Agent-to-Agent (A2A) communication:
Core Features:
- SubAgent can send intermediate results/status updates to parent Agent (streaming)
- Parent Agent remains responsive—processes new inputs without blocking on SubAgent
- Non-blocking task execution model (fire-and-forget with callback/listener pattern)
- Optional bi-directional messaging during task lifetime
- Parent Agent can cancel, preempt, or modify SubAgent tasks based on new information
Use Cases
- Complex Workflow Orchestration: Coordinate multiple SubAgents concurrently with dynamic task management
- Real-time Progress Updates: Stream intermediate results/status to user UI without waiting for full completion
- Dynamic Task Adaptation: Parent Agent responds to user input or errors while SubAgent is still executing
- Agent Negotiation: SubAgents can request clarification or escalate decisions back to parent
- Resource Management: Parent Agent monitors SubAgent resource usage and can preempt if needed
Benefits
- Improved UX: Agents always responsive; users see real-time progress instead of blocking
- Better Observability: Streaming logs/status from SubAgents visible throughout execution
- Advanced Orchestration: Enables agent collaboration, negotiation, and adaptive workflows
- Backward Compatible: Old synchronous mode remains available for simple workflows
Implementation Approach
- Messaging Layer: Event-based channel or pub-sub system between parent/child sessions
- Async Await Pattern: Replace blocking
await taskTool.execute()with non-blocking handlers - Stream-based Results: Use existing session event streams to deliver intermediate messages
- API Design: Provide both callback-style and promise-style interfaces for flexibility
- Session Linking: Leverage existing
parentIDin session creation for parent-child relationship
Technical Considerations
- WebSocket or SSE for real-time delivery (already used in ACP)
- Maintain session isolation while allowing controlled message passing
- Handle error propagation and task cancellation across agent boundaries
- Ensure permission/security model accounts for A2A communication
Related Issues
- #SubAgent-async
- #A2A-agent-interaction
- Task tool in
packages/opencode/src/tool/task.ts - Session management in
packages/opencode/src/session/prompt.ts
Metadata
Metadata
Assignees
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)discussionUsed for feature requests, proposals, ideas, etc. Open discussionUsed for feature requests, proposals, ideas, etc. Open discussion
Activity
github-actions commentedon Mar 13, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Mar 13, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.
Feel free to open a new issue that follows our issue templates.