Coordinating Multiple Tools
The Multi-Tool Routing Challenge
Real-world agent systems rarely operate with a single interface. A support assistant must query structured customer profiles, search unstructured policy documents, trigger payment APIs, or send notification emails. Presenting multiple tool schemas to the language model transforms its role from a simple translator into a dynamical router and coordinator.
When an agent is equipped with more than one tool:
- Intent Classification: The model evaluates the user's natural language input and determines which schema is semantically aligned with the task.
- Parameter Extraction: It extracts parameters specific to the selected schema (e.g. compiling a SQL SELECT string for a database query vs. extracting keywords for a text index search).
- Sequential Coordination: For compound requests, the model can chain tools in sequence - using the outputs of one tool as the parameters for the next.
Structured vs. Unstructured Routing
The diagram below shows the model routing queries between structured relational stores (SQL) and unstructured document indices (RAG):
- SQL Path: Used when requests involve calculations, aggregations, or specific record fields (e.g., "What is customer Bob's current account balance?").
- RAG Path: Used when requests involve semantic text lookup or policy interpretations (e.g., "Can I return an item after 30 days?").
Interactive Playground: The Multi-Tool Router
The following playground provides the agent with access to both the SQL database tool (run_readonly_query) and the unstructured search index tool (search_policies). When given a compound request, the model executes a multi-turn sequence: first query the SQL database, then search the policy manual, and finally combine the results.
Observe the agent's behavior during this compound turn sequence. The model analyzes the request and routes parts of it to different tools: it compiles a SQL SELECT query targeting the customers database to look up Bob Jones's balance, and constructs a semantic keyword query to search the returns manual. The agent integrates the structured and unstructured tool outputs to formulate a cohesive summary.