Python: Fix ag-ui state handling issues#2289
Merged
moonbox3 merged 3 commits intomicrosoft:mainfrom Nov 18, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes state handling issues in the Python ag-ui package that were causing UI flickering - text would briefly appear and then disappear due to incorrect timing of MessageSnapshotEvent emissions and improper state context injection during agent execution.
Key Changes:
- Fixed timing of MessagesSnapshotEvent emission to prevent incomplete snapshots that cause UI flicker
- Improved state context injection logic to only inject on new user turns, not during mid-execution tool calls
- Added comprehensive logging throughout the stream processing pipeline for better debugging
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
python/packages/ag-ui/agent_framework_ag_ui_examples/agents/recipe_agent.py |
Added require_confirmation=False parameter to recipe agent configuration |
python/packages/ag-ui/agent_framework_ag_ui/_orchestrators.py |
Fixed state context injection logic and MessagesSnapshotEvent timing; added extensive logging |
python/packages/ag-ui/agent_framework_ag_ui/_message_adapters.py |
Added new agui_messages_to_snapshot_format function to normalize message format for snapshots |
python/packages/ag-ui/agent_framework_ag_ui/_events.py |
Added text accumulation tracking and logic to skip intermediate snapshots for predictive tools; enhanced logging |
Member
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||||||||||||
dmytrostruk
approved these changes
Nov 18, 2025
TaoChenOSU
approved these changes
Nov 18, 2025
arisng
pushed a commit
to arisng/agent-framework
that referenced
this pull request
Feb 2, 2026
* Fix ag-ui state handling * Bump package version and update changelog * Update changelog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
In the current code we're not sending the MessageSnapshotEvent at the proper time which was causing the UI to to handle weird state values, quickly showing some text and then having it disappear. These fixes were tested with the dojo app along with the getting started MAF Python scripts.
Description
Fix state problems.
Bump package to 1.0.0b251117 for a release.
Contribution Checklist