Skip to content

Conversation

CLowbrow
Copy link

Description

Fixes a bug where onTraceEnd was called immediately after onTraceStart when streaming is enabled, without waiting for the stream loop to complete.

Behavior

Before: When stream: true, onTraceEnd was called immediately after the run() call returned, before spans ended.

After: When stream: true, onTraceEnd is called asynchronously after the stream loop completes and all spans have ended. The run() call still returns immediately (non-blocking).

Closes #570

Copy link

changeset-bot bot commented Oct 10, 2025

🦋 Changeset detected

Latest commit: 1ef4da0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@openai/agents-core Patch
@openai/agents-openai Patch
@openai/agents-realtime Patch
@openai/agents Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@seratch seratch added bug Something isn't working package:agents-core labels Oct 11, 2025
@seratch
Copy link
Member

seratch commented Oct 11, 2025

Thanks for sending this! At a glance, it looks good to me, but I will take a closer look early next week.

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

Labels

bug Something isn't working package:agents-core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tracing: onTraceEnd called before all spans finished when running agent with streaming: true

2 participants