Python: provide AzureAIAgent thread msg id during streaming#13032
Merged
eavanvalkenburg merged 7 commits intomicrosoft:mainfrom Aug 30, 2025
Merged
Python: provide AzureAIAgent thread msg id during streaming#13032eavanvalkenburg merged 7 commits intomicrosoft:mainfrom
eavanvalkenburg merged 7 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds thread message ID support to the AzureAIAgent streaming functionality. Previously, when invoking an AzureAIAgent via streaming, the thread_id was not provided in the AgentStreamEvent.THREAD_MESSAGE_CREATED event.
- Captures thread message ID from
THREAD_MESSAGE_CREATEDevents during streaming - Passes the thread message ID to the streaming message content generator
- Includes the thread message ID in the returned StreamingChatMessageContent metadata
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| python/semantic_kernel/agents/azure_ai/agent_thread_actions.py | Captures thread message ID from stream events and passes it to content generation |
| python/semantic_kernel/agents/azure_ai/agent_content_generation.py | Updates streaming message generation to include thread message ID in metadata |
| python/samples/concepts/agents/azure_ai_agent/azure_ai_agent_streaming.py | Demonstrates usage of thread message ID in streaming callback |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
python/samples/concepts/agents/azure_ai_agent/azure_ai_agent_streaming.py
Outdated
Show resolved
Hide resolved
Collaborator
Author
TaoChenOSU
approved these changes
Aug 29, 2025
eavanvalkenburg
approved these changes
Aug 30, 2025
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
As part of invoking an AzureAIAgent via streaming, we weren't providing the
thread_idvia theAgentStreamEvent.THREAD_MESSAGE_CREATEDevent.Description
Supply the caller with the
thread_msg_idby sticking it into the returned SCMC'smetadatadictionary.Sample output looks like:
Contribution Checklist