Python: Fix DurableState schema serializations #2670
Merged
larohra merged 5 commits intomicrosoft:mainfrom Dec 8, 2025
Merged
Conversation
Member
Python Test Coverage Report •
Python Unit Test Overview
|
|||||||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Pull request overview
This PR consolidates and fixes serialization for the DurableState schema by introducing centralized constants, fixing a created_at timestamp bug, and improving documentation for streaming examples.
Key changes:
- Introduces
DurableStateFields,ContentTypes, andApiResponseFieldsconstant classes to eliminate hardcoded field names and ensure consistency across serialization/deserialization - Fixes the
created_atbug whereDurableAgentStateMessage.from_run_requestwas incorrectly defaulting to current time instead of preservingNonewhen no timestamp was provided - Moves
DurableAgentStateEntryJsonTypeenum to the top of the file for better code organization - Updates streaming example documentation to clarify in-memory store limitations and suggest distributed alternatives
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
python/packages/azurefunctions/agent_framework_azurefunctions/_constants.py |
Adds comprehensive constant classes for JSON field names, content type discriminators, and API response fields to centralize serialization constants |
python/packages/azurefunctions/agent_framework_azurefunctions/_durable_agent_state.py |
Replaces all hardcoded strings with constants, fixes created_at handling in DurableAgentStateMessage.from_run_request, moves enum definition, and updates correlation_id type to allow None in DurableAgentStateResponse |
python/packages/azurefunctions/tests/test_entities.py |
Adds tests to verify created_at field handling in DurableAgentStateMessage.from_run_request with both None and valid timestamp values |
python/samples/getting_started/azure_functions/03_callbacks/function_app.py |
Clarifies that the in-memory callback store is for streaming examples and suggests Redis or Service Bus for distributed environments |
python/samples/getting_started/azure_functions/03_callbacks/README.md |
Expands documentation to explain streaming nature of the example and recommends distributed alternatives for production use |
python/packages/azurefunctions/agent_framework_azurefunctions/_durable_agent_state.py
Show resolved
Hide resolved
cgillum
reviewed
Dec 6, 2025
Member
cgillum
left a comment
There was a problem hiding this comment.
Some comments below.
Also, is the python/uv.lock change required? I can't view it in GitHub because it's too big, and I worry that it will create merge conflict headaches. Please remove that change if it's not required.
python/packages/azurefunctions/agent_framework_azurefunctions/_constants.py
Show resolved
Hide resolved
python/samples/getting_started/azure_functions/03_callbacks/README.md
Outdated
Show resolved
Hide resolved
moonbox3
reviewed
Dec 8, 2025
python/packages/azurefunctions/agent_framework_azurefunctions/_durable_agent_state.py
Outdated
Show resolved
Hide resolved
cgillum
approved these changes
Dec 8, 2025
moonbox3
approved these changes
Dec 8, 2025
arisng
pushed a commit
to arisng/agent-framework
that referenced
this pull request
Feb 2, 2026
* Fix created at * Add pattern matching
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
This PR addresses the following bugs -
created_atbug where the timestamp for each response content was always getting updated for each reply.Description
Fixes #2483 and #2644
Contribution Checklist