Course contentsShow
← Machine Learning and Deep Learning
Lesson 2074 of 3,53844. AI Agents: FoundationsFree lesson

Tool Selection Strategy

How agents decide which tool to use from multiple options based on context and task requirements.

Tool Selection Strategy

What you'll learn: How an AI agent decides which tool to call when it has multiple options available, based on the task context and requirements.

The Decision Problem

Imagine you're a chef with dozens of kitchen tools hanging on the wall. For each cooking task, you need to pick the right one—a whisk for whipping cream, a knife for chopping, tongs for flipping. An AI agent faces the same challenge: given multiple tools in its registry, it must intelligently select which one(s) to use.

How Agents Choose Tools

Tool selection happens during the action selection phase of the agent loop. The LLM examines:

  1. Tool descriptions and schemas – Each tool comes with metadata explaining what it does and what inputs it expects
  2. Current task requirements – What the user asked for and what information is still missing
  3. Available context – Previous observations, conversation history, and agent state
  4. Tool constraints – Some tools may have prerequisites or be applicable only in certain situations

The agent's reasoning prompt typically presents all available tools, and the LLM decides which one best matches the current goal. This is why clear, descriptive tool schemas are critical—they guide the selection process.

Selection Patterns

  • Direct matching: User asks for weather → agent selects get_weather tool
  • Multi-step reasoning: User asks "Should I bring an umbrella?" → agent first selects get_weather, observes the result, then selects generate_recommendation
  • Contextual routing: Same query might route to search_vector_db vs. query_sql_database depending on whether the question is about unstructured documents or structured data

Key Takeaway: Tool selection is the agent's decision-making process where it maps task requirements to available tools using the LLM's reasoning over tool schemas, context, and current goals—essentially teaching the agent to "think" about which action is most appropriate.