Skip to content

feat(agent-core): stream live subagent events into background task output buffer #667

Open

Description

@thecannabisapp

The /tasks view only shows a static output preview for background agents. While a subagent is running, the user cannot see what it is currently doing; the output only appears once the task completes or errors.

We fixed this in our fork by wiring the subagent's AgentEvent stream into the background task output buffer via formatAgentEvent(), so live turn starts, tool calls, results, and errors are appended as they happen.

Commit with the fix: thecannabisapp@003420b9

If the maintainers want to merge this, the key change is in packages/agent-core/src/agent/background/agent-task.ts.

Activity

  1. 2youg1 commented on Jul 24, 2026

    @2youg1

    Thank you for the clear write-up and the fork fix — this issue sat unattended for a while, so I've opened PR #2130 that rebases your approach onto the current architecture (the AgentBackgroundTask / SubagentHandle shapes have changed since June). The main difference: instead of monkey-patching agent.emitEvent, it adds a small Agent.onEvent subscription API and exposes it through SubagentHandle.subscribeToEvents. Your commit and this thread are credited in the PR description. Very happy to hear whether this matches what you had in mind — and of course feel free to tell me if you'd rather land your own version.

  2. thecannabisapp commented on Jul 24, 2026

    @thecannabisapp
    Author

    Thank you

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

Metadata

Metadata

Assignees

No one assigned

    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