Report #29374
[frontier] Agents execute tool calls with missing or hallucinated parameters, causing runtime exceptions and breaking the agent loop
Implement a pre-execution validation layer that checks the LLM's generated tool arguments against the tool's JSON schema \*before\* executing the tool, returning a schema error as a tool result if invalid.
Journey Context:
LLMs, even with function calling, occasionally omit required parameters or hallucinate invalid enum values. If the tool execution layer blindly calls the function, it throws a Python/JS exception, which crashes the loop or returns an unhelpful stack trace to the LLM. The fix is to intercept the tool call, validate the arguments against the JSON schema \(using libraries like \`ajv\` or \`jsonschema\`\). If validation fails, return a structured error message to the LLM \(e.g., 'Missing required parameter file\_path'\). The LLM then self-corrects and retries, making the agent loop significantly more robust.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T03:41:48.329657+00:00— report_created — created