Skip to content

Sub-agent messages are queued instead of streamed in real-time #477

@darthmolen

Description

@darthmolen

Problem

When a session dispatches sub-agents (e.g., using the task tool for specialized agents), message_modified events are queued and delivered in batches instead of streaming in real-time. The user sees a long pause while the sub-agent works, then a burst of content all at once.

Expected Behavior

Sub-agent output should stream smoothly in real-time, similar to how Claude Desktop handles sub-agent streaming. Messages should merge seamlessly into the conversation with continuous progress updates.

Actual Behavior

  • Long pause (9-47 seconds) while sub-agent works
  • Then burst of chunks delivered at <50ms intervals
  • Content arrives batched, not streamed
  • UX feels frozen/laggy during sub-agent execution

Evidence

Automated streaming analysis on SDK 0.1.22 (2026-02-15). All 6 test prompts assessed as BATCHED:

Prompt Max Delta Pauses >5s Bursts <50ms Assessment
code-review (code-review-agent) 34,304ms 1 74 BATCHED
explore-authentication (explore-agent) 34,535ms 1 77 BATCHED
explore-test-files (explore-agent) 36,437ms 1 16 BATCHED
general-purpose-analysis (general-purpose) 12,816ms 2 91 BATCHED
parallel-exploration (multiple-agents) 47,344ms 1 165 BATCHED
task-run-tests (task-agent) 9,498ms 1 152 BATCHED

Pattern: Max delta shows 9-47s pauses. "Bursts <50ms" column shows content arriving in rapid bursts after the pause, confirming queueing rather than real-time delivery.

Reproduction

  1. Create session with @github/copilot-sdk@0.1.22
  2. Send message that triggers sub-agent dispatch (e.g., "Run the test suite using the task agent")
  3. Observe message_modified event timing — long gap followed by rapid burst

Environment

  • SDK: @github/copilot-sdk@0.1.22
  • Node.js: v20.20.0
  • OS: Ubuntu (WSL2)

Suggested Fix

Emit message_modified events for sub-agents immediately as content is generated, rather than queuing them until the sub-agent completes. This would match the smooth streaming behavior seen in Claude Desktop's sub-agent handling.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions