Python: Thread storage and serialization (#394)

* Updates for message store support

* Added unit tests

* Added suspend-resume example

* Added example with custom chat message store

* Small fix

* Addressed PR feedback

* Renaming and documentation

* More renaming

* Addressed more PR feedback

* Small fixes in Foundry chat client and examples

* Small update

* Addressed PR feedback

* Increased timeout for Azure tests
This commit is contained in:
Dmytro Struk
2025-08-14 14:15:42 -07:00
committed by GitHub
Unverified
parent 95cb20ca40
commit dea736e550
18 changed files with 1151 additions and 316 deletions
@@ -27,7 +27,7 @@ from agent_framework import (
use_tool_calling,
)
from agent_framework._pydantic import AFBaseSettings
from agent_framework.exceptions import ServiceInitializationError
from agent_framework.exceptions import ServiceInitializationError, ServiceResponseException
from agent_framework.telemetry import use_telemetry
from azure.ai.agents.models import (
AgentsNamedToolChoice,
@@ -48,6 +48,7 @@ from azure.ai.agents.models import (
RequiredFunctionToolCall,
ResponseFormatJsonSchema,
ResponseFormatJsonSchemaType,
RunError,
RunStatus,
RunStep,
SubmitToolOutputsAction,
@@ -427,6 +428,12 @@ class FoundryChatClient(ChatClientBase):
raw_representation=event_data,
response_id=response_id,
)
elif (
event_type == AgentStreamEvent.THREAD_RUN_FAILED
and isinstance(event_data, ThreadRun)
and isinstance(event_data.last_error, RunError)
):
raise ServiceResponseException(event_data.last_error.message)
else:
yield ChatResponseUpdate(
contents=[],