From 9af93a994a9da76aba2207d4fddacf511801c917 Mon Sep 17 00:00:00 2001 From: eavanvalkenburg Date: Mon, 15 Jun 2026 15:15:36 +0200 Subject: [PATCH 1/2] Remove unsupported as_agent config parameter Fixes #6313 Remove the unsupported function_invocation_configuration parameter from BaseChatClient.as_agent(), which currently forwards an invalid kwarg into Agent.__init__(). This keeps the existing TypeError behavior for callers but changes the error source to the public API boundary, which we do not consider a breaking change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- python/packages/core/agent_framework/_clients.py | 9 +-------- python/packages/core/tests/core/test_clients.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/python/packages/core/agent_framework/_clients.py b/python/packages/core/agent_framework/_clients.py index f0bd051980..de6b47b0a3 100644 --- a/python/packages/core/agent_framework/_clients.py +++ b/python/packages/core/agent_framework/_clients.py @@ -29,10 +29,7 @@ from ._docstrings import apply_layered_docstring from ._serialization import SerializationMixin -from ._tools import ( - FunctionInvocationConfiguration, - ToolTypes, -) +from ._tools import ToolTypes from ._types import ( ChatResponse, ChatResponseUpdate, @@ -580,7 +577,6 @@ def as_agent( context_providers: Sequence[Any] | None = None, middleware: Sequence[MiddlewareTypes] | None = None, require_per_service_call_history_persistence: bool = False, - function_invocation_configuration: FunctionInvocationConfiguration | None = None, compaction_strategy: CompactionStrategy | None = None, tokenizer: TokenizerProtocol | None = None, additional_properties: Mapping[str, Any] | None = None, @@ -611,7 +607,6 @@ def as_agent( service-managed conversation is the source of truth (persistence still happens after each model call). When no HistoryProvider is present, this flag has no effect (no middleware is installed and nothing is persisted). - function_invocation_configuration: Optional function invocation configuration override. compaction_strategy: Optional agent-level compaction override. When omitted, client-level compaction defaults remain in effect for each call. tokenizer: Optional agent-level tokenizer override. When omitted, @@ -656,8 +651,6 @@ def as_agent( "tokenizer": tokenizer, "additional_properties": dict(additional_properties) if additional_properties is not None else None, } - if function_invocation_configuration is not None: - agent_kwargs["function_invocation_configuration"] = function_invocation_configuration return Agent(**agent_kwargs) diff --git a/python/packages/core/tests/core/test_clients.py b/python/packages/core/tests/core/test_clients.py index ac110a4a17..397e75d192 100644 --- a/python/packages/core/tests/core/test_clients.py +++ b/python/packages/core/tests/core/test_clients.py @@ -62,6 +62,16 @@ def test_base_client_as_agent_uses_explicit_additional_properties(chat_client_ba assert agent.additional_properties == {"team": "core"} +def test_base_client_as_agent_rejects_function_invocation_configuration( + chat_client_base: SupportsChatGetResponse, +) -> None: + with pytest.raises( + TypeError, + match=r"as_agent\(\) got an unexpected keyword argument 'function_invocation_configuration'", + ): + chat_client_base.as_agent(function_invocation_configuration={"enabled": False}) + + async def test_base_client_get_response_uses_explicit_client_kwargs(chat_client_base: SupportsChatGetResponse) -> None: async def fake_inner_get_response(**kwargs): assert kwargs["trace_id"] == "trace-123" From 1d81979c929d593682b3ba129d5dbb87a46c07e9 Mon Sep 17 00:00:00 2001 From: eavanvalkenburg Date: Mon, 15 Jun 2026 15:47:00 +0200 Subject: [PATCH 2/2] fix sample --- python/samples/02-agents/a2a/a2a_agent_as_function_tools.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/samples/02-agents/a2a/a2a_agent_as_function_tools.py b/python/samples/02-agents/a2a/a2a_agent_as_function_tools.py index c441fe77e1..745cb569f0 100644 --- a/python/samples/02-agents/a2a/a2a_agent_as_function_tools.py +++ b/python/samples/02-agents/a2a/a2a_agent_as_function_tools.py @@ -6,6 +6,7 @@ import httpx from a2a.client import A2ACardResolver +from agent_framework import Agent from agent_framework.a2a import A2AAgent from agent_framework.foundry import FoundryChatClient from azure.identity import AzureCliCredential @@ -86,7 +87,8 @@ async def main() -> None: model=model, credential=credential, ) - host_agent = client.as_agent( + host_agent = Agent( + client=client, name="assistant", instructions="You are a helpful assistant. Use your tools to answer questions.", tools=skill_tools,