Give a model two tools and one question that only needs one of them β and verify it actually picks correctly, not just that tool calling works at all.
1Selection Is a Separate Skill From Calling
The previous lesson proved a model can format a correct tool call given exactly one option. This lesson tests something different and arguably more important for a real agent: given multiple plausible tools, does it pick the right one? A single-tool test can't distinguish 'the model calls tools correctly' from 'the model calls whatever tool it's given, correctly or not.'
2Descriptions Are the Actual Selection Mechanism
There's no separate routing logic choosing between tools β the model reads each tool's name and description text and semantically matches them against the question, the same way it would match any other text. A vague or overlapping description directly degrades selection accuracy, which is why tool descriptions deserve the same care as a well-written docstring.
3Step-by-Step Breakdown
Real agents rarely have just one tool. Give the model a list of several, and its job β before any Action even happens β is picking the right one for the question actually asked. That selection is itself a real capability worth testing directly.
Watch a Real Agent Choose the Right Tool. Two real tool schemas are attached below: get_weather and get_stock_price. The question only needs one of them. Run it and confirm the model correctly picks get_stock_price and ignores get_weather entirely β βtool selection, not just tool calling.
What actually determines which tool a model chooses when given several options?
- βThe model matches the semantics of the user's question against each tool's name and description β clear, specific, distinct descriptions are what make correct selection reliable.
- βThe model always picks whichever tool is listed first in the tools array.
Module 5 complete: real tool calls, a real agent loop, and real multi-tool selection. Final module: the production concerns β streaming, observability, and evaluation β that separate a demo agent from a shippable one.
Level Up π
Advanced cheat sheets, SEO tricks, and interview prep for this topic.
Browser Support
Fully supported.
Fully supported.
Fully supported.
Fully supported.
Accessibility (A11y)
1Log Which Tool Was Selected, Not Just That One Was Called
When debugging agent behavior, always log the specific tool name selected (not just 'a tool call happened'), so developers reviewing logs can immediately spot incorrect selection.
logger.info(f'Agent selected tool: {tool_name}')SEO Implications
- 1
Target 'LangChain agent choosing wrong tool' as an anticipated troubleshooting search
Incorrect tool selection is a common real-world debugging scenario developers search for once they move from single-tool to multi-tool agents.
Best Practices
Write Distinct, Non-Overlapping Tool Descriptions
If two tools' descriptions are vague or semantically similar, a model has a genuinely harder time reliably choosing between them β invest in specific, clearly differentiated descriptions exactly as you would for any other prompt engineering task.
Frequent Bugs
Two tools with overlapping or vague descriptions causing the model to inconsistently pick the wrong one, or call both when only one was needed.
Test multi-tool selection explicitly with unambiguous questions targeting each tool, and sharpen any description that leads to incorrect or inconsistent selection.
Real-World Examples
Customer Service Agent With Multiple Tools
An agent with lookup_order, process_refund, and update_shipping_address tools correctly routes a 'where is my package' question to lookup_order and ignores the other two entirely, purely because each tool's description clearly and distinctly signals its purpose.
tools = [lookup_order, process_refund, update_shipping_address]