Automation & agents · Analysis
Design an order lookup that the agent can use correctly
Turn search results into a small tool contract with explicit identifiers, timestamps and an ambiguous-match state.

An assistant searches for “Sara’s renewal” and receives a page of matching customers, invoices and subscriptions. It has plenty of data but little basis for choosing the exact order. The fix belongs partly in the tool contract, before any prompt tuning.
Return the decision the caller needs
Use a structured result for one match, multiple candidates or no match. For candidates, return the stable order ID and the minimum attributes a support agent can disambiguate, such as month and plan. Vendor tool guidance emphasizes useful, unambiguous results.
Source · Anthropic · Writing effective tools
Separate query from mutation
The application receives a proposed tool call, runs it and returns the result to the model. Splitting lookup from changes to payment or access makes those operations easier to authorize separately.
Source · OpenAI · Function calling
Test one ambiguous input
Seed two order rows with the same display name. The assistant should ask which interval applies, hold the original request and choose the stable ID only after clarification.
What to take away
A lookup is useful when the next decision is clear and the response excludes unrelated account details.