Define what counts as finished
Start with the decision someone needs to make. For a warranty enquiry, the first job might be to locate a dated invoice that matches the product and customer account. That is a narrower task than deciding whether to approve a repair. Write down the evidence that lets staff move to the next stage and the outcome to record if it is missing.
An agent can choose its next tool after seeing the previous result. That flexibility helps when the route to an invoice varies. It also lets a dead end consume several more calls. Anthropic’s guidance on building agents describes using environmental feedback and stopping conditions, including a maximum number of iterations. For a desk with a fixed sequence of two lookups, ordinary workflow rules may already cover the job.
Illustrative example: the invoice that the desk cannot see
Imagine a repair desk that can search its own sales ledger and a registered reseller’s invoice index. A delivery note shows that a particular machine reached a branch in March. It gives the assistant a product reference to search, but the sale could have happened later. The desk needs the purchase date before it can check coverage.
The first ledger lookup finds the delivery note. A reseller lookup returns an invoice reference for the same serial number. Fetching that invoice has a specific purpose and may complete the task. If the reseller lookup instead returns the original delivery note, trying the serial number again in different punctuation adds little unless the search tool handles those forms differently.
If the index says access is denied, record that separately from a search that completed with zero matches. In the first case a colleague with the right access may be able to retrieve the invoice. In the second, staff might ask the customer for a copy. In neither case has the desk established that the warranty has expired.
Set limits that match what each call consumes
Agree how long a customer should wait for an initial answer. From that deadline, reserve time to save the result and place unresolved work in a staffed queue. Set a maximum number of model steps and a separate limit on external searches. One model step may request several searches, and a search may have its own retries. Count the work at the point where the application actually sends it.
For an illustrative pilot, allow three external lookups per enquiry. If the agent has already made two and requests two more at once, the application has room for one. Reserve that slot before dispatching an eligible lookup, or hand the case over if both results are needed together. A counter updated after both calls finish would allow the limit to be exceeded.
Vercel’s AI SDK documents step limits and custom stopping conditions for tool loops. OWASP’s guidance on unbounded consumption also recommends timeouts and throttling. Use the relevant controls at each layer. A step limit bounds turns through the loop. A tool timeout bounds how long the caller waits. A daily allowance protects the team when many individually small jobs arrive together.
Give the next person enough to finish
A handover should name the missing fact, the sources already checked and the next action available to staff. For example: ‘Purchase date unresolved. Sales ledger returned delivery note D-12. Reseller invoice index denied access. Ask the reseller liaison to check the invoice against this serial number.’ Include references the reviewer is authorised to open.
Save a distinct outcome for evidence found, sources exhausted, access blocked or time limit reached. The customer needs a clear next step. The operator needs enough detail to avoid repeating the same searches. Route unresolved cases to a named team and show when each one needs attention.
Keep the original deadline and usage totals if a worker restarts the job. Give staff an explicit way to resume when new evidence arrives, such as an invoice number from the customer. Otherwise a handover can start a fresh loop on the same evidence every time the queue is processed.
Decide whether another lookup earns its place
Test a mix of straightforward purchases, reseller sales and enquiries with missing evidence. Include an unavailable system and a slow response. Ask staff to judge the evidence on each completed case and whether each handover leads to an action they can take. Count incorrect completions as well as unresolved enquiries.
Suppose 30 pilot enquiries reach the lookup limit. In a controlled replay, an extra lookup resolves four with a verified invoice and leaves 26 for staff. That is 30 extra lookups for four additional resolved cases. Inspect the four: if each already had a new invoice reference, trial an extra lookup only when that reference exists. Measure the effect on fresh cases before changing the live limit.
For the first shift, give the desk supervisor three figures: verified completions, handovers still waiting at the deadline and total tool calls. Pair them with a sample of the handover notes. The supervisor can then decide whether to increase a limit, improve access to a missing source or keep a particular enquiry type with staff.