Skip to content

[FEATURE]: Real-time Agent-to-Agent (A2A) & Non-blocking SubAgent Communication #17303

Closed as not planned

Description

@surapuramakhil

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 await on 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

  1. Complex Workflow Orchestration: Coordinate multiple SubAgents concurrently with dynamic task management
  2. Real-time Progress Updates: Stream intermediate results/status to user UI without waiting for full completion
  3. Dynamic Task Adaptation: Parent Agent responds to user input or errors while SubAgent is still executing
  4. Agent Negotiation: SubAgents can request clarification or escalate decisions back to parent
  5. 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

  1. Messaging Layer: Event-based channel or pub-sub system between parent/child sessions
  2. Async Await Pattern: Replace blocking await taskTool.execute() with non-blocking handlers
  3. Stream-based Results: Use existing session event streams to deliver intermediate messages
  4. API Design: Provide both callback-style and promise-style interfaces for flexibility
  5. Session Linking: Leverage existing parentID in 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

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Mar 13, 2026
  2. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 13, 2026
  3. github-actions commented on Mar 13, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • The description appears to be AI-generated (extensive structured sections, implementation approaches, technical considerations, use cases — this level of detail is typically not written organically). Please rewrite in your own words describing the actual problem you're facing and what you'd like to see changed.

    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.

  4. github-actions commented on Mar 13, 2026

    @github-actions
    Contributor

    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.

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

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)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