Viewing the current order
A big part of voice agent design is giving users the same affordances they would have on a screen. On a website they can scroll up and see their cart. On voice, they have to ask. Make asking feel natural.
@function_tool()
async def view_current_order() -> str:
"""Returns a spoken summary of the order and the total."""
if not order_items:
return "Your order is currently empty."
total = sum(item["price"] for item in order_items)
lines = [f"{item['name']} for ${item['price']:.2f}" for item in order_items]
return f"You have {', '.join(lines)}. Your total comes to ${total:.2f}."The string already sounds like something a waiter would say. That is the quality bar. If you would not say it out loud to a customer, do not return it from a voice tool.
Good instinct. For long orders you would summarise, group items, and let the user ask for details. You could also add a send-to-screen fallback that shows the full cart while the agent speaks a summary. Voice is a layer on top of UX, not a replacement for it.
Quiz: Quiz
Loading practice…