Skip to content
RasaGet a free license
Menu
Guides for AI teams

Guide

How to track split shipments with a Rasa voice agent.

Build a delivery lookup for split shipments that asks which item the caller means and uses the carrier scan for that parcel to answer.

by Rod Rivera

About 4 minutes to readAI product engineer

Key takeaways (3)
  • Ask which item the caller means when their order has more than one parcel.
  • Use the scan for the selected parcel to build the answer.
  • Test both parcels and check that an order-only lookup returns no milestone.

A caller asks where their order is. The warehouse packed their chair and cushions in separate boxes. The chair arrived and the cushions are still on the way. Give the caller a choice by item, then answer for the box they picked. Otherwise, a correct delivery scan can send them looking for cushions that have yet to arrive.

See what happens when the lookup picks the first box

The fictional order-status project models this order as two parcels. The example lets you test a common shortcut. When the lookup receives only an order number, should it use the first parcel?

Lookup on the same orderTool replyWhat that means for the caller
Order only with a first-parcel fallbackAnswered. Desk chair, delivered.The tool picked the chair before the caller chose an item.
Order only with the original lookupBlocked. Both item names, with no milestone.Ask which item the caller means.
Cushion parcel with either lookupAnswered. Cushion set, in transit.The cushions are on the way.
Select an item before giving a delivery status
FigureSelect an item before giving a delivery status

Ask by item, answer from the scan

Give the caller a choice they can answer with an item name. “Do you mean the desk chair or the cushion set?” Match their choice to the parcel number beside that item in the tool’s reply. Send both numbers to the lookup. For both items, fetch each parcel separately and name the item in each answer. If their answer could refer to either box, ask again. In the sample, a single-parcel order can skip that question. The parcel lookup checks ownership before it selects the parcel or offers choices. On the caller’s own split order, an order-only lookup returns parcel_not_selected and both choices. For an unknown order or one outside the customer’s account, it leaves out the choices.

Rasa’s tools documentation shows how a Mantle tool returns data to the model. The sample wrapper passes the selected parcel to the lookup. Build the answer from the returned item, scan, and observer. If the tool also returns an arrival estimate, call it an estimate when you speak it. The order-status case study shows how to answer when the selected parcel’s tracking feed is stale.

Check the spoken reply

Match the question to the parcel

Ask which item they mean if the conversation has yet to establish it. Then check the selected parcel. Even if the chair scan says delivered, the cushion result is the one the caller needs.

Run the parcel checks

You can run the parcel guard tests offline with Python 3.12. Clone the companion repository and run this from its root.

git checkout --detach 4aa0c4419dc193fef7a969c12d59edcf720f2606
cd examples/mantle-voice-retail-order-status-gemini
python3 -m unittest discover -s tests -p test_guard.py -v

Find the split-order and parcel tests. Expect both tests to report ok. One checks that the order-only answer contains both items and omits the milestone. The other checks both parcel statuses and their distinct references. If the first test fails after you add a fallback, check whether it used a scan before the caller picked a parcel. These tests call the lookup on supplied inputs. If you adapt it to a voice agent, test a separate call where a person chooses the cushion set by name.