Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions python/packages/core/agent_framework/_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down
10 changes: 10 additions & 0 deletions python/packages/core/tests/core/test_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion python/samples/02-agents/a2a/a2a_agent_as_function_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
Loading