Python: Fix DurableState schema serializations (#2670)

* Fix created at

* Add pattern matching
This commit is contained in:
Laveesh Rohra
2025-12-08 14:38:45 -08:00
committed by GitHub
Unverified
parent c6e73a4ebe
commit 71d9d268dd
5 changed files with 370 additions and 162 deletions
@@ -19,8 +19,9 @@ an HTTP API that can be polled by a web client or dashboard.
Complete the shared environment setup steps in `../README.md`, including creating a virtual environment, installing dependencies, and configuring Azure OpenAI credentials and storage settings.
> **Note:** The sample stores callback events in memory for simplicity. For production scenarios you
> should persist events to Application Insights, Azure Storage, Cosmos DB, or another durable store.
> **Note:** This is a streaming example that currently uses a local in-memory store for simplicity.
> For distributed environments, consider using Redis, Service Bus, or another pub/sub mechanism for
> callback coordination.
## Running the Sample
@@ -27,7 +27,9 @@ from azure.identity import AzureCliCredential
logger = logging.getLogger(__name__)
# 1. Maintain an in-memory store for callback events keyed by thread ID (replace with durable storage in production).
# 1. Maintain an in-memory store for callback events keyed by thread ID.
# NOTE: This is a streaming example using a local console logger. For distributed environments,
# consider using Redis or Service Bus for callback coordination across multiple instances.
CallbackStore = DefaultDict[str, list[dict[str, Any]]]
callback_events: CallbackStore = defaultdict(list)