Skip to content

Commit 24678df

Browse files
authored
Update agent.py
1 parent 21984f2 commit 24678df

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

python_agent_harness/agent.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,16 @@ def _execute_tool_call(self, call: ToolCall) -> str:
319319
args = {}
320320
if not isinstance(args, dict):
321321
args = {}
322+
# Validate required parameters from the tool schema
323+
tool = self.session.registry.get(call.name)
324+
if tool is not None:
325+
required = tool.parameters.get("required", [])
326+
missing = [k for k in required if k not in args]
327+
if missing:
328+
return (
329+
f"Error: {call.name} is missing required argument(s): "
330+
f"{', '.join(missing)}"
331+
)
322332
return self.session.execute_tool(call.name, args, call_id=call.id)
323333

324334
def _deliver_tool_result(self, p: ToolCall, result: str) -> None:

0 commit comments

Comments
 (0)