Skip to content
AITroveRead. Build. Understand.
Make this comfortable

Project: a voice call that renews the right library item

Last updated: 2 Oct 202619 min read
project
AdvancedBy AITrove Editorial

Design a fictional library voice assistant for one authorized task: renew the patron's loan of BK-421 if eligible. The caller is in a café, the recognition stream is provisional, and a separate catalog and loan service own the actual state. Produce a prompt contract, an event trace, and a release decision. The prompt can request clarification and state tool results; it cannot make interim speech final, cancel audio by itself, or authorize a loan from a recognized sentence alone. The application checks identity, renewal rules, and receipts.

Build the call path

Begin with the utterance 'Renew BK-412—no, BK-421, if it is still available.' Show the interim and final transcript separately and assert that no renewal call occurs before the final turn. Inject blender noise so the last digit could also be seven. The agent asks a focused code question, then checks the catalog title after account access is verified. Once the patron confirms Harbor Atlas, code BK-421, it asks for explicit renewal confirmation. A nearby 'yes' from another voice is not sufficient unless the caller can be identified. Keep the due-date lookup read-only until the requested effect is clear.

Interrupt and recover

While the assistant begins a due-date sentence, the patron says, 'Wait, do not renew; due date only.' Stop queued speech, preserve the portion actually spoken, and process the new intent. If a renewal call was already transmitted, do not claim the interruption undid it; reconcile the receipt. Add a 2.6-second tool delay with a truthful waiting phrase. In one case the server returns receipt RN-638 and a new due date of 3 December. In another, the response is lost and the loan view is stale: the spoken status remains uncertain, no blind retry occurs, and a review path receives the request identifier.

Output
Interim: BK-412 -> no tool effect. Final: correction to BK-421.
Noisy digit: BK-421 or BK-427 -> ask narrowly.
Barge-in: stop unheard audio; check any transmitted effect.
Slow tool: say checking, not renewed.
Receipt RN-638 -> confirmed; lost response -> reconcile.

Performance and operating cost

Let C be test calls, V prompt variants, and M review modes. A broad comparison uses O(CVM) runs, plus listening time proportional to recorded duration. Each extra confirmation turn adds latency; each early action risks the wrong loan. Measure the time to the first truthful spoken response and the time to a confirmed result separately. Preserve recognizer, endpoint, model, voice, and tool versions so a prompt change is not confused with a pipeline change. The release gate blocks any wrong-record renewal or duplicate effect, even when average latency improves.

Common Mistakes

  • Do not call the renewal tool from an interim transcript.
  • Do not assume stopping speech reverses a server request.
  • Do not report a renewal as complete without a receipt or authoritative state.

Connected lessons

prompt engineering
voice agents
Storage details