diff --git a/src/agents/run_internal/tool_actions.py b/src/agents/run_internal/tool_actions.py index 005a0b163f..d7b93d3e9d 100644 --- a/src/agents/run_internal/tool_actions.py +++ b/src/agents/run_internal/tool_actions.py @@ -169,7 +169,11 @@ async def _run_action(span: Any | None) -> RunItem: "image_url": image_url, }, type="computer_call_output", - acknowledged_safety_checks=acknowledged_safety_checks, + **( + {"acknowledged_safety_checks": acknowledged_safety_checks} + if acknowledged_safety_checks is not None + else {} + ), ), ) diff --git a/tests/test_computer_action.py b/tests/test_computer_action.py index bb6823942d..4b56c7eea0 100644 --- a/tests/test_computer_action.py +++ b/tests/test_computer_action.py @@ -391,6 +391,7 @@ async def test_execute_invokes_hooks_and_returns_tool_call_output() -> None: assert raw["output"]["type"] == "computer_screenshot" assert "image_url" in raw["output"] assert raw["output"]["image_url"].endswith("xyz") + assert "acknowledged_safety_checks" not in raw @pytest.mark.asyncio