Python: [BREAKING] Remove deprecated kwargs compatibility paths (#4858)

* [BREAKING] Remove deprecated kwargs compatibility paths

Remove the deprecated kwargs compatibility shims across core agents, clients, tools, middleware, and telemetry.

Keep workflow kwargs behavior intact in this branch and follow up separately in #4850.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix PR CI fallout for kwargs removal

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address PR review feedback

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* updates

* Fix Azure AI CI fallout

Remove the stale _get_current_conversation_id override from the Azure AI client after the OpenAI base helper was deleted.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fixed new classes

* Fix Assistants deprecated import gating

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix integration replay regressions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Switch multi-agent hosting samples to Azure chat completions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Simplify Azure multi-agent sample config

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Eduard van Valkenburg
2026-03-27 22:00:12 +01:00
committed by GitHub
Unverified
parent ca6cdd142e
commit b1b528e4a8
52 changed files with 1136 additions and 971 deletions
@@ -23,6 +23,7 @@ from ._callbacks import AgentCallbackContext, AgentResponseCallbackProtocol
from ._durable_agent_state import (
DurableAgentState,
DurableAgentStateEntry,
DurableAgentStateMessage,
DurableAgentStateRequest,
DurableAgentStateResponse,
)
@@ -151,10 +152,11 @@ class AgentEntity:
try:
chat_messages: list[Message] = [
m.to_chat_message()
replayable_message
for entry in self.state.data.conversation_history
if not self._is_error_response(entry)
for m in entry.messages
if (replayable_message := self._to_replayable_message(m)) is not None
]
run_kwargs: dict[str, Any] = {"messages": chat_messages, "options": options}
@@ -190,6 +192,21 @@ class AgentEntity:
return error_response
@staticmethod
def _to_replayable_message(message: DurableAgentStateMessage) -> Message | None:
"""Convert persisted history into a message safe to replay into chat clients."""
chat_message = message.to_chat_message()
replayable_contents = [content for content in chat_message.contents if content.type != "reasoning"]
if not replayable_contents:
return None
return Message(
role=chat_message.role,
contents=replayable_contents,
author_name=chat_message.author_name,
additional_properties=chat_message.additional_properties,
)
async def _invoke_agent(
self,
run_kwargs: dict[str, Any],
@@ -21,7 +21,9 @@ from agent_framework_durabletask import (
DurableAgentStateData,
DurableAgentStateMessage,
DurableAgentStateRequest,
DurableAgentStateResponse,
DurableAgentStateTextContent,
DurableAgentStateTextReasoningContent,
RunRequest,
)
from agent_framework_durabletask._entities import DurableTaskEntityStateProvider
@@ -391,6 +393,54 @@ class TestAgentEntityRunAgent:
assert len(history) == 6
assert entity.state.message_count == 6
async def test_run_filters_reasoning_content_from_replayed_history(self) -> None:
"""Replayed durable history should not include reasoning-only content items."""
captured_messages: list[Message] = []
async def mock_run(*args, stream=False, **kwargs):
if stream:
raise TypeError("streaming not supported")
captured_messages.extend(kwargs["messages"])
return _agent_response("Response")
mock_agent = Mock()
mock_agent.run = mock_run
entity = _make_entity(mock_agent)
entity.state.data = DurableAgentStateData(
conversation_history=[
DurableAgentStateRequest(
correlation_id="corr-entity-prev-request",
created_at=datetime.now(),
messages=[
DurableAgentStateMessage(
role="user",
contents=[DurableAgentStateTextContent(text="Hi")],
)
],
),
DurableAgentStateResponse(
correlation_id="corr-entity-prev-response",
created_at=datetime.now(),
messages=[
DurableAgentStateMessage(
role="assistant",
contents=[
DurableAgentStateTextReasoningContent(text="Let me think."),
DurableAgentStateTextContent(text="Hello there."),
],
)
],
),
]
)
await entity.run({"message": "What next?", "correlationId": "corr-entity-replay"})
assert captured_messages
assert all(content.type != "reasoning" for message in captured_messages for content in message.contents)
assert [message.text for message in captured_messages] == ["Hi", "Hello there.", "What next?"]
class TestAgentEntityReset:
"""Test suite for the reset operation."""