-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Open
Labels
feature:coreneeds-more-infoWaiting for a reply/more info from the authorWaiting for a reply/more info from the author
Description
Description
When invoking my tool, it is called twice with different versions of the context variable:
ToolContext -> RunContextWrapper -> Context (dict I passed)
ToolContext -> Context (dict I passed)
On the first call (with RunContextWrapper), the agent’s response is ignored (By ignored I mean the tool returns an answer but the agent calls it again).
On the second call (with the plain Context dict), the agent’s response is accepted and returned to the user.
This leads to redundant tool executions and inconsistent behavior.
Debug information
- Agents SDK version: (e.g.
v0.3.3
) - Python version (e.g. Python 3.11)
Repro steps
Ideally provide a minimal python script that can be run to reproduce the bug.
run_context = {
"available_agents": available_agents,
"conversation_id": user_identity.platform_user_id,
"conversation_manager": conversation_manager,
}
run_result = await agent_runner.run(
initial_agent_instance,
input=history_str,
context=run_context,
)
@function_tool
async def tool_one(
ctx: ToolContext,
**kwargs
) -> dict:
...
Expected behavior
The tool should only be called once, with a consistent context structure.
The agent response from the first invocation should not be discarded.
Metadata
Metadata
Assignees
Labels
feature:coreneeds-more-infoWaiting for a reply/more info from the authorWaiting for a reply/more info from the author