Description
- What happened?
I noticed an error during a tool call that just gave me the following message: "Error: Function failed." I searched for this and found that you can get more detailed error output (which for some reason isn't the default) by using FunctionInvocationConfiguration(include_detailed_errors=True). The BaseChatClient.as_agent call that I'm using has the ability to set this but when you try to do this, you get the following error: Agent.__init__() got an unexpected keyword argument 'function_invocation_configuration'
- What did you expect to happen?
I expected function_invocation_configuration to set the appropriate configuration for the agent.
- Steps to reproduce the issue
See code sample.
Code Sample
import asyncio
from typing import Annotated
from pydantic import Field
from agent_framework import tool, FunctionInvocationConfiguration
from agent_framework.openai import OpenAIChatClient
@tool(name="weather_tool", description="Retrieves weather information for any location")
def get_weather(
location: Annotated[str, Field(description="The location to get the weather for.")],
) -> str:
return f"The weather in {location} is cloudy with a high of 15°C."
async def main():
"""
"""
chat_client = OpenAIChatClient(
model="gpt-5.4",
base_url="https://api.openai.com/v1",
)
function_invocation_config = FunctionInvocationConfiguration(include_detailed_errors=True)
agent = chat_client.as_agent(
name="WeatherAgent",
instructions="You are a helpful weather assistant.",
tools=[get_weather],
function_invocation_configuration=function_invocation_config,
)
response = await agent.run("What is the weather like in Amsterdam?")
print(response.text)
if __name__ == "__main__":
asyncio.run(main())
Error Messages / Stack Traces
Traceback (most recent call last):
File "/usr/WS1/gunny/Projects/mada-orchestrator/agent_error.py", line 156, in <module>
asyncio.run(main())
~~~~~~~~~~~^^^^^^^^
File "/collab/usr/gapps/python/toss_4_x86_64_ib/anaconda3-2025.3.1/lib/python3.13/asyncio/runners.py", line 195, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "/collab/usr/gapps/python/toss_4_x86_64_ib/anaconda3-2025.3.1/lib/python3.13/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/collab/usr/gapps/python/toss_4_x86_64_ib/anaconda3-2025.3.1/lib/python3.13/asyncio/base_events.py", line 725, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "/usr/WS1/gunny/Projects/mada-orchestrator/agent_error.py", line 143, in main
agent = chat_client.as_agent(
name="WeatherAgent",
...<2 lines>...
function_invocation_configuration=function_invocation_config,
)
File "/usr/WS1/gunny/virtualenvs/mada_venv_py_3_13/lib/python3.13/site-packages/agent_framework/_clients.py", line 652, in as_agent
return Agent(**agent_kwargs)
TypeError: Agent.__init__() got an unexpected keyword argument 'function_invocation_configuration'
Package Versions
agent-framework: 1.2.2, agent-framework-a2a: 1.0.0b260429, agent-framework-ag-ui: 1.0.0b260429, agent-framework-anthropic: 1.0.0b260429, agent-framework-azure-ai-search: 1.0.0b260429, agent-framework-azure-cosmos: 1.0.0b260429, agent-framework-azurefunctions: 1.0.0b260429, agent-framework-bedrock: 1.0.0b260429, agent-framework-chatkit: 1.0.0b260429, agent-framework-claude: 1.0.0b260429, agent-framework-copilotstudio: 1.0.0b260429, agent-framework-core: 1.2.2, agent-framework-declarative: 1.0.0b260429, agent-framework-devui: 1.0.0b260429, agent-framework-durabletask: 1.0.0b260429, agent-framework-foundry: 1.2.2, agent-framework-foundry-local: 1.0.0b260429, agent-framework-github-copilot: 1.0.0b260402, agent-framework-lab: 1.0.0b251024, agent-framework-mem0: 1.0.0b260429, agent-framework-ollama: 1.0.0b260429, agent-framework-openai: 1.2.2, agent-framework-orchestrations: 1.0.0b260429, agent-framework-purview: 1.0.0b260429, agent-framework-redis: 1.0.0b260429
Python Version
Python 3.13.2
Additional Context
No response
Description
I noticed an error during a tool call that just gave me the following message: "Error: Function failed." I searched for this and found that you can get more detailed error output (which for some reason isn't the default) by using
FunctionInvocationConfiguration(include_detailed_errors=True). TheBaseChatClient.as_agentcall that I'm using has the ability to set this but when you try to do this, you get the following error:Agent.__init__() got an unexpected keyword argument 'function_invocation_configuration'I expected
function_invocation_configurationto set the appropriate configuration for the agent.See code sample.
Code Sample
Error Messages / Stack Traces
Package Versions
agent-framework: 1.2.2, agent-framework-a2a: 1.0.0b260429, agent-framework-ag-ui: 1.0.0b260429, agent-framework-anthropic: 1.0.0b260429, agent-framework-azure-ai-search: 1.0.0b260429, agent-framework-azure-cosmos: 1.0.0b260429, agent-framework-azurefunctions: 1.0.0b260429, agent-framework-bedrock: 1.0.0b260429, agent-framework-chatkit: 1.0.0b260429, agent-framework-claude: 1.0.0b260429, agent-framework-copilotstudio: 1.0.0b260429, agent-framework-core: 1.2.2, agent-framework-declarative: 1.0.0b260429, agent-framework-devui: 1.0.0b260429, agent-framework-durabletask: 1.0.0b260429, agent-framework-foundry: 1.2.2, agent-framework-foundry-local: 1.0.0b260429, agent-framework-github-copilot: 1.0.0b260402, agent-framework-lab: 1.0.0b251024, agent-framework-mem0: 1.0.0b260429, agent-framework-ollama: 1.0.0b260429, agent-framework-openai: 1.2.2, agent-framework-orchestrations: 1.0.0b260429, agent-framework-purview: 1.0.0b260429, agent-framework-redis: 1.0.0b260429
Python Version
Python 3.13.2
Additional Context
No response