Skip to content

Commit 2ed9432

Browse files
author
Copilot
committed
Address review feedback for #4963: Python: [Bug]: Cannot approve tool usage from sub-agents
1 parent 6f80206 commit 2ed9432

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

‎python/packages/core/agent_framework/_tools.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,9 +1368,11 @@ async def _auto_invoke_function(
13681368
# we assume it is a hosted tool
13691369
return function_call_content
13701370
# Re-invoke through the parent sub-agent tool with approval context.
1371-
parent_tool_call_id = function_call_content.additional_properties.get(
1372-
"_parent_tool_call_id"
1373-
) or function_call_content.id or function_call_content.call_id
1371+
parent_tool_call_id = (
1372+
function_call_content.additional_properties.get("_parent_tool_call_id")
1373+
or function_call_content.id
1374+
or function_call_content.call_id
1375+
)
13741376
function_call_content = Content(
13751377
type="function_call",
13761378
name=parent_tool_name,

‎python/packages/core/tests/core/test_agents.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2773,8 +2773,7 @@ def get_detail(location: str) -> str:
27732773
# Verify the outer tool result has the correct call_id matching the original tool call.
27742774
messages = session.state.get("in_memory", {}).get("messages", [])
27752775
assert any(
2776-
getattr(content, "type", None) == "function_result"
2777-
and getattr(content, "call_id", None) == "outer_call_1"
2776+
getattr(content, "type", None) == "function_result" and getattr(content, "call_id", None) == "outer_call_1"
27782777
for message in messages
27792778
for content in (getattr(message, "contents", None) or [])
27802779
), "Expected persisted outer tool result with call_id='outer_call_1' in session history"

0 commit comments

Comments
 (0)