Your Agent Isn't Bad at Tools. Your Tool Descriptions Are.
Your Agent Isn't Bad at Tools. Your Tool Descriptions Are. Every vendor demo shows an agent gliding through tool calls like it was born to it. Then you ship one, and it calls the wrong endpoint, invents an argument your schema never asked for, and retries the same broken call until your budget screams. The model isn't the problem. The contract you handed it is. Reliable tool selection isn't a…
Your agent may be skilled, but the issue lies in the quality of your tool descriptions. It is not the model's fault when it calls the wrong endpoint, generates unnecessary arguments, or retries a broken call repeatedly. The problem stems from the contract you provide to the model.
Reliable tool selection is not achieved through a more intelligent model; it requires better description, a more precise schema, and a validation gate. Most teams overlook these factors and then blame the LLM for the failure.
The description serves as the documentation for the model, which only receives a name, a paragraph of text, and a JSON schema. This limited documentation often leads to inaccurate routing between similar tools. Anthropic emphasizes the importance of providing detailed descriptions, stating that it is the most critical factor in tool performance.
When tools overlap, and the model cannot determine which one to use, it is left to guess, often resulting in incorrect predictions in a production environment. A loose schema invites the model to generate incorrect arguments, while a tight schema prevents a wide range of faulty calls from being executed.
Structured Outputs in OpenAI ensure that arguments match your schema, but shape alone is not correctness. Even if the call is perfectly structured, selecting the wrong tool will still result in an error. Therefore, validation must occur in your own code before executing the call.
Validation acts as the gate between the model's output and your systems. If the tool name is unknown, a required argument is missing, or the wrong type is provided, the call should be rejected safely, providing no side effects and returning a specific error indicating what failed, which field was involved, and what constitutes a valid call.
Every call, even those that fail, should receive a result, including the specific error details. Swallowing errors leads to agents confidently reporting refunds they never issued. With up to 512 tools declared in a single request, 512 tools should be a ceiling, not a target. A dozen well-described tools with distinct purposes will be selected far more reliably than a hundred overlapping ones.
As the catalogue grows, narrow the set offered on each turn to what that step can plausibly require, or implement a router in front of it.
In conclusion, an agent that "usually works" is not suitable for user interaction. The difference between a demo and a deployable tool loop lies in the often overlooked but essential plumbing: providing accurate descriptions, constraining with schemas, validating before execution, returning honest errors to the model, and enforcing a stop condition to prevent loops. Implement these practices, and the model will perform brilliantly. Neglect them, and no amount of prompt engineering can save you.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to