Python: emit AG-UI RUN_STARTED before the agent runs when thread and run IDs are supplied - #8541
Open
Christian Glessner (ltwlf) wants to merge 1 commit into
Open
Christian Glessner (ltwlf) wants to merge 1 commit into
Christian Glessner (ltwlf) wants to merge 1 commit into
Conversation
…run IDs are supplied RUN_STARTED waited for the first agent update so that service-generated IDs could be used. When the request already carries both threadId and runId there is nothing to wait for, so emit it (with PredictState, the initial state snapshot and approval results) before calling the agent. Requests missing either ID keep the previous behaviour. Fixes microsoft#8540
Christian Glessner (ltwlf)
deployed
to
github-app-auth
September 19, 2026 06:55 — with
GitHub Actions
Active
Christian Glessner (ltwlf)
deployed
to
github-app-auth
September 19, 2026 06:55 — with
GitHub Actions
Active
Christian Glessner (ltwlf)
deployed
to
github-app-auth
September 19, 2026 06:55 — with
GitHub Actions
Active
Christian Glessner (ltwlf)
deployed
to
github-app-auth
September 19, 2026 06:56 — with
GitHub Actions
Active
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 & Context
RUN_STARTEDis held back until the agent's first update so that service-generated IDs can be used. When the request already supplies boththreadIdandrunIdthat wait isn't needed. Context providers and the first model call can take seconds, and during that time the client gets no event at all. Since AG-UI requiresRUN_STARTEDfirst, the server can't send anything else in the meantime either (progress or activity events, for example).Description & Review Guide
RUN_STARTED,PredictState, the initial state snapshot, approval results) are built in one helper. If both IDs are supplied they're emitted before the agent is called; otherwise they're still emitted on the first update, as before. The provider conversation id is still captured from the first update in both cases.RUN_STARTEDbeing emitted afteragent.run()had started streaming.Related Issue
Fixes #8540
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.