Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/agents/util/_approvals.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ def _reject_nonstandard_json_constant(value: str) -> NoReturn:

def parse_function_tool_arguments(arguments: str | None) -> dict[str, Any] | None:
"""Return parsed object arguments, or None when an approval policy cannot inspect them."""
if arguments is None or not arguments.strip():
return None
try:
parsed = json.loads(
arguments or "{}",
arguments,
parse_constant=_reject_nonstandard_json_constant,
)
except ValueError:
Expand Down
1 change: 1 addition & 0 deletions tests/realtime/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -3125,6 +3125,7 @@ async def test_function_tool_needs_approval_emits_event(
@pytest.mark.parametrize(
"arguments",
[
"",
'{"subject": "refund"',
"null",
"[]",
Expand Down
1 change: 1 addition & 0 deletions tests/test_hitl_error_scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,7 @@ def bad_tool() -> str:
@pytest.mark.parametrize(
"arguments",
[
"",
'{"subject": "refund"',
"null",
"[]",
Expand Down
Loading