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 replace map with 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

  1. Ensure track_shipment is attached to the agent. Publish.
  2. If the user is signed in, the JWT’s sub identifies them; put the order lookup behind that identity on your API.

Verify

  • Preview “Where is my order ORD-2201?” → tool call → ui.render containing map and steps.
  • 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.failed or a completed call with an error body depending on your API.

Variations

  • Add a button with a url action 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.

Last updated 2026-09-28 · Report an issue with this page