Skip to content

fix(core): emit correct agent in agent_updated_stream_event during streaming handoff #205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 14, 2025

Conversation

vrtnis
Copy link
Contributor

@vrtnis vrtnis commented Jul 13, 2025

This change corrects a bug where the agent_updated_stream_event was emitting the stale currentAgent rather than the newly active agent after a handoff.

  • Updates run.ts to emit result.state._currentAgent
  • Adds a streaming test to verify the new agent is emitted
  • Includes a patch-level changeset for @openai/agents-core

Resolves #202

Copy link

changeset-bot bot commented Jul 13, 2025

🦋 Changeset detected

Latest commit: 342d3a6

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

This PR includes changesets to release 5 packages
Name Type
@openai/agents-core Patch
@openai/agents-openai Patch
@openai/agents-realtime Patch
@openai/agents Patch
@openai/agents-extensions 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 Jul 14, 2025
@seratch
Copy link
Member

seratch commented Jul 14, 2025

Thank you so much for fixing this! Having the corresponding unit test is appreciated too!

@seratch seratch merged commit ed66acf into openai:main Jul 14, 2025
5 checks passed
vrtnis added a commit to vrtnis/openai-agents-js that referenced this pull request Jul 17, 2025
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.

agent_updated_stream_event passes previous agent, not the target/current agent
2 participants