Skip to content

Python: remove function_invocation_configuration from BaseChatClient.as_agent - #5198

Closed
Andrew Barnes (Bortlesboat) wants to merge 2 commits into
microsoft:mainfrom
Bortlesboat:codex/issue-5180-as-agent-function-config
Closed

Python: remove function_invocation_configuration from BaseChatClient.as_agent#5198
Andrew Barnes (Bortlesboat) wants to merge 2 commits into
microsoft:mainfrom
Bortlesboat:codex/issue-5180-as-agent-function-config

Conversation

@Bortlesboat

Copy link
Copy Markdown

Motivation and Context

Fixes #5180.

BaseChatClient.as_agent() currently accepts function_invocation_configuration but forwards it into Agent(**agent_kwargs), where Agent.__init__() does not accept that keyword. In practice this raises a TypeError instead of applying the configuration to function-invoking clients.

Description

This change keeps the override on the client side, which is where FunctionInvocationLayer consumes it:

  • stop passing function_invocation_configuration into Agent()
  • when the client supports FunctionInvocationLayer, normalize and apply the override directly to self.function_invocation_configuration
  • add a regression test covering as_agent(function_invocation_configuration=...) so the issue stays fixed

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@moonbox3 Evan Mattson (moonbox3) added the python Usage: [Issues, PRs], Target: Python label Apr 10, 2026
@eavanvalkenburg

Copy link
Copy Markdown
Member

just added a note on the original issue, that this is not the way to fix that issue, if you are up for it, you can change this PR, open a new PR or we can pick it up with the team

@Bortlesboat

Copy link
Copy Markdown
Author

Rescoped this draft to match the issue note: the unction_invocation_configuration kwarg is removed from BaseChatClient.as_agent() instead of being applied there. Verified with python -m pytest python/packages/core/tests/core/test_clients.py -q.

@Bortlesboat Andrew Barnes (Bortlesboat) changed the title Python: apply function_invocation_configuration in BaseChatClient.as_agent Python: remove function_invocation_configuration from BaseChatClient.as_agent Apr 11, 2026
@moonbox3

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework
   _clients.py135695%324, 375, 531–534
TOTAL27198318388% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
5440 20 💤 0 ❌ 0 🔥 1m 30s ⏱️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: [Bug]: BaseChatClient.as_agent() passes function_invocation_configuration to Agent() which doesn't accept it

3 participants