rasa init --engine mantle creates. If you
have not made one yet, follow Getting Started up to step 3,
and configure the Inspector’s speech providers as in
step 3. Keep the generated
model_groups configuration: the speech keys do not replace your LLM provider
key or Rasa license. Restart the Inspector after changing integrations.yml or
your environment.
The card data and order operation below are mocks. They do not authenticate a
caller, lock a real card, or place a real order. Before connecting a card API,
add authorization and retry protection in your tools.
What you’ll build
A skill that:- greets the caller with a recording notice,
- finds the card from its last four digits,
- locks a stolen card straight away,
- confirms the order out loud before placing it,
- reads the order number back digit by digit.
1. Write the skill
Createskills/card_replace/ with three files. The instructions are plain prose
with no voice-specific wording:
skills/card_replace/skill.md
skills/card_replace/memory.yml
skills/card_replace/tools.py
find_card runs. If you talk over the agent, it stops and listens. What is
still missing: the agent says nothing until you speak, and the order goes
through without the caller agreeing to it.
2. Greet the caller
A caller expects to hear the agent first. The bundled session-start skill stays silent, so replace it with one that plays a recording notice and a greeting. Voice channels start every call with/session_start, which runs this skill:
skills/default_session_start/skill.md
skills/default_session_start/responses.yml
3. Give the pauses your agent’s voice
The acknowledgement you heard in step 1 is generated by the model. Give it a few examples in your agent’s tone so it sounds like your brand rather than a generic agent. Add afillers block to agent.yml:
agent.yml
fillers.
4. Confirm before placing the order
On chat, the customer can scroll back and check what they agreed to. On a call, they hear it once. Make the engine ask for a spoken yes before the order goes through, and have the question restate what is being ordered. Addtool_constraints to the skill frontmatter, and change step 5 of the prose
so the model calls the tool and leaves the asking to the engine:
skills/card_replace/skill.md
skills/card_replace/responses.yml
requires:keeps each tool unavailable until its facts exist, so the model cannot lock a card that was not stolen or order before shipping is chosen.requires_confirmation:pauses the order and asksutter_confirm_order. The tool runs on a yes and is cancelled on a no. See Explicit confirmations.on_success:speaks the lock and order lines exactly as written.complete_when:finishes the skill once an order number exists.
5. Read the order number back clearly
Read aloud,482193 can come out as “four hundred eighty-two thousand…”. The
process_card_replacement tool already stores a second, spaced-out copy in
order_reference_spoken (“4 8 2 1 9 3”), and utter_order_placed uses that
copy, so the caller hears one digit at a time. The plain order_reference stays
available for your systems and for chat.
Speech providers differ in how they read numbers, so listen to your own
identifiers in the Inspector. For more on exact wording, see
Use a response when the words have to be exact.
6. Make the order safe to interrupt
A caller can talk over the agent whileprocess_card_replacement is waiting on
your card system. When Mantle accepts the interruption, it ends the turn and
cancels the tool at its current await. Check context.is_cancelled right
before starting an irreversible step:
skills/card_replace/tools.py
await can run again on the next turn. For a real
order API, keep a stable idempotency key for that order attempt and use it to
reconcile an uncertain result before retrying. Do not treat a saved key as proof
that the order succeeded. See
Cancellation.
7. Say goodbye once
When the caller says they are done, the agent should close the call, not ask another question. Add a rule toagent.yml:
agent.yml
8. Try it
Train, restart the Inspector, and start a new voice conversation:- You hear the recording notice and the greeting.
- Say My card was stolen, then four eight two one. The card is locked and you hear the exact lock message.
- Choose rush shipping. The agent restates the card and shipping and asks whether to go ahead.
- Say yes. You hear the order number one digit at a time.
- Say That’s all, thanks. The agent says goodbye once.
process_card_replacement. Repeat yes and
no as short answers, then interrupt while the mock order tool is waiting. See
Test the speech path separately
for a reusable test checklist.
Now type the same conversation in the chat box. The skill is unchanged, and the
replies take the shape of text instead.
Continue with a community project
To apply these patterns across several skills, follow the Rasa Community travel-agent tutorial. The runnable companion project includes demo data and setup instructions; its chapter snippets show how each step changes the project. These links leave the Mantle docs: the walkthrough is on rasa.community, and the code is in the public rasa-community-resources repository. Check their tested versions before adapting them to your project.Next steps
Connect a phone line
Put this agent behind a real phone number.
Designing for voice
More patterns: lists, buttons, keypad input, and ending calls.
Speech providers
Change the recognition model, the voice, or the provider.
Test and monitor voice
Check latency and interruptions before and after launch.