Order tracking with a map
The user asks where an order is; the assistant fetches the shipment and answers with status, ETA and a map with the courier's position.
Goal
“Where is my order ORD-2201?” → track_shipment → a card with steps (timeline), a map marker at the courier’s location, and a countdown to the ETA.
Pieces
- Tool
track_shipment:GET https://api.kletso.ai/demo/acme/orders/{{ input.orderId }}/shipment, schema{ orderId: string }required. Mark act as user when you connect your own API so the runtime forwards the user’s token and your API refuses other people’s orders. - Blocks: built-ins
card,steps,map,countdown,text. Nothing to register. Optionally replacemapwith a real map widget:registerComponent('map', myMapBuilder). - Prompt line: “order status → track_shipment; render the shipment as a card with steps for the timeline and a map marker at location.”
Steps
- Ensure
track_shipmentis attached to the agent. Publish. - If the user is signed in, the JWT’s
subidentifies them; put the order lookup behind that identity on your API.
Verify
- Preview “Where is my order ORD-2201?” → tool call →
ui.rendercontainingmapandsteps. - In the app the map shows a marker labelled Shibuya and the timeline shows three steps.
- Ask “and ORD-9999?” → the tool returns 404; the model explains it could not find the order (no invented data). The inspector shows
tool.failedor a completed call with an error body depending on your API.
Variations
- Add a
buttonwith aurlaction to the courier’s tracking page; add the courier’s host to the agent’s URL allowlist. - Send a proactive update when the status changes on your side: Order shipped push.