You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python: [Bug]: Duplicate arguments in declaration-only function call when streamed #6973
When streaming an agent with a declaration-only tool, the arguments of the function call are duplicated when looking at the message contents.
Code Sample
importasynciofromagent_frameworkimportAgent, FunctionToolfromagent_framework.foundryimportFoundryChatClientfromazure.identityimportAzureCliCredentialfrompydanticimportBaseModel, FieldclassWeatherInput(BaseModel):
location: str=Field(description="The location to get the weather for.")
asyncdefmain() ->None:
client=FoundryChatClient(
credential=AzureCliCredential(),
)
agent=Agent(
client=client,
name="WeatherAgent",
instructions="You are a helpful weather agent. Use the get_weather tool to answer questions.",
tools=[
FunctionTool(
name="get_weather", description="Get the weather for a given location.", input_model=WeatherInput
)
],
)
response_stream=agent.run("What's the weather like in Seattle?", stream=True)
outputs=awaitresponse_stream.get_final_response()
print(outputs.messages[0].contents[0].arguments) # {"location":"Seattle"}{"location":"Seattle"}if__name__=="__main__":
asyncio.run(main())
🤖 Automated triage reproduction notes(agent-authored — trust but verify)
Agent analysis
Repro: FunctionInvocationLayer._stream() in packages/core/agent_framework/_tools.py (around line 2821) re-yields function_call contents that were already yielded from the inner stream (line 2774), causing _process_update in _types.py (line 1910) to concatenate arguments via +=. The fix should prevent the duplicate yield of function_call contents for declaration-only tools in the streaming path — either by not yielding the extra update when the results are already function_call type, or by not including function_call items in result["function_call_results"] at line 2379. Minimal repro: create a MockBaseChatClient with FunctionInvocationLayer, set streaming_responses with function_call chunks for a declaration-only FunctionTool, call get_response(stream=True), and check final_response arguments.
Activity
github-actions commentedon Jul 7, 2026
🤖 Automated triage reproduction notes (agent-authored — trust but verify)
Agent analysis
Repro: FunctionInvocationLayer._stream() in packages/core/agent_framework/_tools.py (around line 2821) re-yields function_call contents that were already yielded from the inner stream (line 2774), causing _process_update in _types.py (line 1910) to concatenate arguments via +=. The fix should prevent the duplicate yield of function_call contents for declaration-only tools in the streaming path — either by not yielding the extra update when the results are already function_call type, or by not including function_call items in result["function_call_results"] at line 2379. Minimal repro: create a MockBaseChatClient with FunctionInvocationLayer, set streaming_responses with function_call chunks for a declaration-only FunctionTool, call get_response(stream=True), and check final_response arguments.
python/packages/core/tests/core/test_declaration_only_streaming_duplication.py1.10.01.10.0fix: avoid duplicating arguments in streamed declaration-only tool ca…
fix: avoid duplicating arguments in streamed declaration-only tool ca…
fix: avoid duplicating arguments in streamed declaration-only tool ca…
fix: avoid duplicating arguments in streamed declaration-only tool ca…