Summary
When an LLM returns a tool call object whose function field has no arguments key (i.e. just {"name": "..."}), agentfield.tool_calling.execute_tool_call_loop raises an AttributeError instead of treating the missing arguments as a recoverable parsing error and continuing the loop.
This is a real-world failure mode — frontier LLMs occasionally emit malformed tool calls under load, and the SDK should report the error back to the model so it can retry, not crash the whole reasoner.
Where
- File:
sdk/python/agentfield/tool_calling.py
- Function:
execute_tool_call_loop
- Discovered by:
sdk/python/tests/test_tool_calling_error_paths.py::test_malformed_tool_call_missing_arguments_is_reported_and_loop_continues (currently skipped with pytest.skip("source bug: ..."))
Reproduction
The skipped test in PR #352 reproduces it directly. Minimal repro: feed execute_tool_call_loop an LLM response whose tool call looks like:
{
"id": "tc_missing",
"type": "function",
"function": {"name": "utility.echo"} # NOTE: no "arguments" key
}
The loop accesses tool_call.function.arguments without a guard and raises AttributeError.
Expected behavior
The loop should:
- Catch the missing-arguments case (treat it the same as malformed JSON arguments)
- Append a tool-role message back to the conversation describing the parse error
- Continue to the next turn so the LLM can retry or pivot
Acceptance criteria
Discovered via
PR #352 (test coverage improvements). One of 5 source bugs surfaced while writing failure-mode tests for the Python SDK.
Summary
When an LLM returns a tool call object whose
functionfield has noargumentskey (i.e. just{"name": "..."}),agentfield.tool_calling.execute_tool_call_loopraises anAttributeErrorinstead of treating the missing arguments as a recoverable parsing error and continuing the loop.This is a real-world failure mode — frontier LLMs occasionally emit malformed tool calls under load, and the SDK should report the error back to the model so it can retry, not crash the whole reasoner.
Where
sdk/python/agentfield/tool_calling.pyexecute_tool_call_loopsdk/python/tests/test_tool_calling_error_paths.py::test_malformed_tool_call_missing_arguments_is_reported_and_loop_continues(currently skipped withpytest.skip("source bug: ..."))Reproduction
The skipped test in PR #352 reproduces it directly. Minimal repro: feed
execute_tool_call_loopan LLM response whose tool call looks like:{ "id": "tc_missing", "type": "function", "function": {"name": "utility.echo"} # NOTE: no "arguments" key }The loop accesses
tool_call.function.argumentswithout a guard and raisesAttributeError.Expected behavior
The loop should:
Acceptance criteria
execute_tool_call_loopno longer raises on tool calls missing theargumentsfieldmessagesas atoolrole entrymax_turnstest_tool_calling_error_paths.py::test_malformed_tool_call_missing_arguments_is_reported_and_loop_continuesis unskipped and passesDiscovered via
PR #352 (test coverage improvements). One of 5 source bugs surfaced while writing failure-mode tests for the Python SDK.