Skip to main content

Your support agent has two tools, search_orders and search_tickets, and it often calls the wrong one or passes a phone number where an order ID is needed. How do you fix it?

Agents and tools · Intermediate 3

Short answer

I would read the failing traces first, then fix the tools before the prompt. Rewrite each description to say when to use it and when not to, state the exact format of each parameter with an example, and return clear error messages on bad input. If two tools still overlap, merge them. Then measure with a small tool-selection test set.

Deeper answer

The model sees only the tool name, the description and the parameter schema. If a new team member could not choose between the two tools from that text, the model cannot either. So the description should read like a note to a colleague: what the tool returns, when to use it, when to use the other one, and what an order ID looks like.

The second fix is in code. Validate arguments, and when a phone number arrives in the order ID field, return an error that says what was wrong and what to do next, for example to call find_customer_by_phone first. The model can then correct itself in the next step. Interviewers listen for a method: look at traces, change one thing, and rerun a fixed set of test requests to see whether the wrong-tool rate fell. They also like hearing that fewer, clearer tools are better than many similar ones.

What a strong answer covers

Answer it out loud in the mock interview about 2 min

Follow-ups to expect

Common mistakes

Learn it

Designing tools for agents

Practice Agents and tools questions

More on this topic

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.