Python: Bug Report: Arguments Parameter Ignored in ResponsesAgentThreadActions.invoke()
Bug Report: Arguments Parameter Ignored in ResponsesAgentThreadActions.invoke()
Summary
The invoke method in ResponsesAgentThreadActions class ignores the arguments parameter due to incorrect usage of kwargs.get("arguments") instead of the named parameter.
Location
- File:
semantic_kernel/agents/open_ai/responses_agent_thread_actions.py - Line: 259
- Method:
ResponsesAgentThreadActions.invoke()https://github.com/microsoft/semantic-kernel/blob/4e9ea783903b5428debd777e5496bba997b5a150/python/semantic_kernel/agents/open_ai/responses_agent_thread_actions.py#L259
Problem Description
The method signature explicitly defines arguments as a named parameter:
@classmethod
async def invoke(
cls: type[_T],
*,
agent: "OpenAIResponsesAgent",
chat_history: "ChatHistory",
thread: "ResponsesAgentThread",
store_enabled: bool,
function_choice_behavior: "FunctionChoiceBehavior",
arguments: KernelArguments | None = None, # ← Named parameter
# ... other parameters ...
**kwargs: Any,
) -> AsyncIterable[tuple[bool, "ChatMessageContent"]]:
However, at line 236, the code incorrectly tries to access arguments from kwargs:
# Line 259 - INCORRECT
arguments=kwargs.get("arguments"),
Root Cause
In Python, when a parameter is explicitly named in the method signature, it is not included in **kwargs. Therefore, kwargs.get("arguments") will always return None, regardless of what value was passed for the arguments parameter.
Impact
- Any
KernelArgumentspassed to theinvokemethod are completely ignored Noneis always passed tokernel.invoke_function_call()instead of the intended arguments- Function calls may not receive their required arguments, potentially causing failures or unexpected behavior
Expected Behavior
The code should use the named parameter directly:
# Line 259 - CORRECT
arguments=arguments,
Reproduction
- Call
ResponsesAgentThreadActions.invoke()with a non-Noneargumentsparameter - Observe that the arguments are not passed through to
kernel.invoke_function_call() - The function call will receive
Noneinstead of the provided arguments
Suggested Fix
Change line 259 from:
arguments=kwargs.get("arguments"),
To:
arguments=arguments,
Additional Context
This appears to be a refactoring oversight where:
- Originally
argumentsmay have been passed via**kwargs - Later refactored to be an explicit parameter
- The usage was not updated to match the new signature
This bug affects the core functionality of the OpenAI Responses Agent and should be prioritized for fixing.