Some tools must never run too early, or without the customer’s yes: booking an appointment, moving money, cancelling a card. In this part of the Rasa Tutorial, you add tool constraints to your Rasa Mantle agent: rules in a skill’s frontmatter that Rasa itself enforces, whatever Claude decides.
By the end, the banking agent from Part 7 won’t even be offered its booking tool until it knows the branch, the topic and the day, and Rasa will ask the customer to confirm, in your exact words, before any booking is made. You’ll watch the tool appear in the Rasa Inspector.
This is Part 8 of the Rasa Tutorial. The parts in Module C, Progressive Control:
- Part 8: Tool Constraints: Make Your Agent Ask Before It Acts (you are here)
- Part 9: Scoped Instructions: Show Claude Only the Rules That Apply
- Part 10: Ordered Blocks
- Part 11: Sub-skills and Composition
All parts of the Rasa Tutorial
Module A: Start Here
Module B: Building Skills
- Part 3: Write a Skill’s Instructions
- Part 4: Tools: Let Your Agent Run Python
- Part 5: Memory: Remember What Matters
- Part 6: References: Answer from Your Documents
- Part 7: Responses: Control the Exact Wording
Module C: Progressive Control
- Part 8: Tool Constraints: Make Your Agent Ask Before It Acts
- Part 9: Scoped Instructions: Show Claude Only the Rules That Apply
- Part 10: Ordered Blocks
- Part 11: Sub-skills and Composition
Module D: Orchestration
- Part 12: The Runtime Loop: How Mantle Handles a Turn
- Part 13: Guarantees and Guardrails
- Part 14: Skills and Routing
- Part 15: Context Management
Module E: Agent Setup
- Part 16: agent.yml: Identity, Persona and Rules
- Part 17: integrations.yml: Claude, Model Groups and Routing
- Part 18: MCP Tools
- Part 19: Hooks
- Part 20: Build Faster with the Rasa Copilot
Module F: Voice
- Part 21: Talk to Your Agent in the Browser
- Part 22: Designing for Voice
- Part 23: Connect a Phone Line
- Part 24: Monitor Voice Calls
Module G: Channels
- Part 25: The REST Channel and a Website Chat Widget
- Part 26: Microsoft Teams
Module H: Observability
- Part 27: Tracing with Langfuse
- Part 28: Metrics and Conversation Events
Module I: Deploy
- Part 29: Run Your Agent with Docker
- Part 30: CI/CD for a Rasa Agent
- Part 31: Deploy to Kubernetes with Rasa’s Helm Chart
- Part 32: Deploy on AWS
- Part 33: Deploy on Azure
- Part 34: Deploy on Google Cloud
Module J: Rasa Studio
- Part 35: Rasa Studio with a Mantle Agent
Module K: Wrap-up
- Part 36: Final Project, Cheat Sheet and What to Learn Next
Cost: Rasa’s Developer Edition licence is free. Claude is pay-per-use: Claude Sonnet 5.5, the model this series uses, costs $2 per million input tokens and $10 per million output tokens (Claude pricing (opens in a new tab)). In this part you send six messages, which make nine calls to Claude: about $0.05. That’s an estimate: in Part 2, eight calls cost $0.05 on the Claude Console. Training also indexes Part 6’s reference document with Azure OpenAI again, which costs far less than a cent. The confirmation question and the other responses cost nothing: Rasa sends them without calling Claude.
Prerequisites
- The
my-rasa-agentproject from Part 7: Responses: Control the Exact Wording.
Step 1: Hide the Booking Tool Until Every Detail Is In
Open Terminal, go to your project folder and turn on its virtual environment:
cd my-rasa-agent
source .venv/bin/activate
A tool constraint is a rule about one tool, written in the frontmatter of the skill that uses it. Claude still decides when to call the tool, but Rasa decides whether the call can happen. Use one wherever a tool changes something for real: a booking, a payment, a cancellation.
In Part 5, the booking tool checked by itself whether the branch, topic or day was missing. Now let Rasa hold it back until all three are in memory. Open skills/book_appointment/skill.md and add tool_constraints to the frontmatter, after description:
tool_constraints:
- book_appointment:
requires: >
session.book_appointment.branch
and session.book_appointment.topic
and session.book_appointment.day
tool_constraintslists the rules, one entry per tool, named exactly as the tool is:book_appointment.requiresis a condition. Until it’s true, Rasa leaves the tool out of what Claude is offered, and blocks any call to it. Claude can’t call a tool it isn’t offered.session.book_appointment.branchon its own means “the skill’sbranchfield has a value”, as in Part 7.andjoins the three, so all of them must have one.>lets the condition run over several lines. YAML joins them into one.- If Rasa can’t work a condition out, it keeps the tool hidden: the safe way to fail.
Step 2: Make Rasa Ask Before the Tool Runs
Add requires_confirmation under the same tool, so the whole entry reads:
tool_constraints:
- book_appointment:
requires: >
session.book_appointment.branch
and session.book_appointment.topic
and session.book_appointment.day
requires_confirmation:
enabled: true
utter_for_confirmation: utter_ask_book_appointment_confirmation
utter_on_user_denial: utter_book_appointment_cancelled
enabled: trueturns the pause on. When Claude calls the tool, Rasa holds the call, asks the customer, and runs the tool only if they agree.utter_for_confirmationnames the response Rasa asks with, andutter_on_user_denialthe response it sends when the customer says no. Leave both out and Claude words them itself.
Add both responses to skills/book_appointment/responses.yml, under the confirmation from Part 7. Here’s the whole file now:
responses:
utter_book_appointment_confirmed:
- text: >-
Your appointment is booked. Your booking reference is
{booking_reference}. Please bring a photo ID with you.
utter_ask_book_appointment_confirmation:
- text: >-
Shall I book this appointment? Branch: {branch}. Topic: {topic}.
Day: {day}.
utter_book_appointment_cancelled:
- text: No problem. I haven't booked anything.
{branch},{topic}and{day}are filled in from the skill’s memory exactly as it holds them, so the topic and the day appear in lower case.- The question repeats the details, so the customer sees exactly what they’re agreeing to.
Advertisement
Step 3: Let Rasa Do the Asking
Your instructions from Part 5 still tell Claude to read the details back and ask for a yes. Now Rasa asks, so take that job out of them: if Claude asked too, the customer would confirm twice. Replace steps 2 and 3 with this one step:
2. When you have all three, book it with @tool.book_appointment.
Claude calls the tool as soon as it has the three details, and Rasa takes it from there.
Step 4: End the Skill When the Booking Is Made
Once the booking is made, the skill’s job is done. Say so in the frontmatter, after description:
complete_when:
condition: "session.book_appointment.booking_reference"
complete_whenstates what must be true before the skill can finish.- A
conditionon its own also ends the skill by itself the moment it becomes true: here, as soon as the tool saves the booking reference. - Rasa then moves straight on to your wrap-up question from Part 7, and Claude doesn’t get another turn to talk about a booking that’s already done.
Here’s the whole file now:
---
name: Book an Appointment
description: Branch appointments - book a meeting with an adviser at one of our branches
complete_when:
condition: "session.book_appointment.booking_reference"
tool_constraints:
- book_appointment:
requires: >
session.book_appointment.branch
and session.book_appointment.topic
and session.book_appointment.day
requires_confirmation:
enabled: true
utter_for_confirmation: utter_ask_book_appointment_confirmation
utter_on_user_denial: utter_book_appointment_cancelled
utter:
- utter_book_appointment_confirmed:
when: "session.book_appointment.booking_reference"
---
Help the customer book an appointment with an adviser at a branch.
1. Find out which branch they want to visit, what the appointment is about
and which day suits them. Ask for anything they haven't said, one question
at a time. Record each answer with `set_memory` as soon as they give it.
2. When you have all three, book it with @tool.book_appointment.
Step 5: Train Your Agent
rasa train
Rasa checks your constraints while it trains, including the response names they use. When it finishes, the last line names your new agent package:
2026-11-21 17:32:15 INFO rasa.mantle.model_archive.snapshot - [info ] Mantle agent package saved at 'models/20261121-173214-diachronic-deck.tar.gz'.
The INFO notes above it are the same as in Part 7; they aren’t errors.
Step 6: Book an Appointment
rasa inspect
When the Rasa Inspector opens in your browser, send I would like to book an appointment with an adviser. Claude asks which branch. Reply Riverton Station, please. It's about a loan, and Tuesday suits me. Rasa asks your confirmation question. Reply Yes, please.

The question is your response, word for word, with the details from memory. Only after your yes does the booking run; then your confirmation from Part 7 and your wrap-up question follow. Yours will show a different reference: the demo tool makes up a new one for each booking.
Now see the constraint at work. Click the Inspector mode button at the top of the chat and choose Inspect. Then click the LLM call just above Happy to help. Which branch would you like to visit? Its panel lists, under Tools, everything Rasa offered Claude for that call:

book_appointment is greyed out: its condition wasn’t met yet, so Claude couldn’t book. Now click the LLM call just above Tool call: book_appointment:

Once memory held all three details, Rasa offered the tool, and Claude called it: purple marks the tool Claude chose. Scroll down the chat to see what happened next:

- Right after Tool call: book_appointment comes your question, marked utter_ask_book_appointment_confirmation template, and the turn ends: Rasa held the call and waited for the customer.
- After
Yes, please., one LLM call records the answer (Tool call: resolve_tool_confirmation), and only then does the booking run. - Book an Appointment skill completed follows the confirmation with no LLM call in between: your
complete_whencondition ended the skill.
Now turn a booking down. Choose Preview from the Inspector mode menu, click the circular arrow (Restart conversation) at the top of the chat, and send Please book me an appointment at Lakeside about a card on Friday. Reply No, don't book it. to the question, then That is all, thanks.

Rasa sent your cancel line and booked nothing. When you said you were done, Claude ended the booking task, and your wrap-up question followed.
When you’re done, go back to Terminal and press Ctrl+C to stop the agent.
Clean Up
If the agent is still running, press Ctrl+C in Terminal to stop it. Claude and Azure OpenAI both charge only for what your agent uses, so a stopped agent costs nothing.
Keep the my-rasa-agent folder: Part 9 builds on it.
Common Mistakes
| Mistake | Do this instead |
|---|---|
Naming the tool differently in tool_constraints than in tools.py | Use the tool’s exact name, book_appointment. |
Writing only the field’s name in a condition, such as branch | Write the full form: session, the skill’s folder name and the field, as in session.book_appointment.branch. |
| Leaving the “read the details back and ask” step in the instructions | Remove it when requires_confirmation is on, or the customer confirms twice. |
| Asking for confirmation on tools that only look things up | Keep confirmation for tools that change something, such as a booking or a payment. Finding a branch needs no yes. |
Putting a condition with : in it on one line without quotes | Quote it, or fold it over several lines with > as in Step 1. |
Troubleshooting
| Problem | Fix |
|---|---|
| Claude never books, even with all three details | The condition never became true. Check each field’s name against memory.yml and the skill folder’s name, then train again and restart rasa inspect. In Inspect mode, a greyed tool in an LLM call’s Tools list means its condition wasn’t met. |
| The customer is asked to confirm twice | Remove the confirmation step from the instructions, as in Step 3. |
| Claude adds its own message after the booking confirmation | Add complete_when from Step 4, so the skill ends as soon as the booking reference is saved. |
rasa train stops with an error about a response name | The names in utter_for_confirmation and utter_on_user_denial must match responses.yml exactly. |
FAQ
Does Claude still decide when to book?
Yes. Claude still asks for the details in its own words and chooses when to call the tool. The constraint decides only whether the tool is there to call, and whether it runs before the customer agrees.
What if the customer changes the subject instead of answering?
The question stays open. Rasa’s Tool Constraints (opens in a new tab) guide says it’s asked again when the conversation comes back to the booking.
Can the customer answer with Yes and No buttons?
Rasa lets you put two buttons on the confirmation question, with the payloads set:session.system.confirmation=true and =false, so a tap answers without a call to Claude. In Rasa Pro 3.22, though, Claude never sees the tap, so it can contradict the booking or ask again later; Fixed: Rasa Mantle Says “I haven’t booked it yet” After the Customer Taps Yes shows what happens and how to fix it. With typed answers, as in this part, Claude records the answer itself.
Can a tool constraint send a message after the tool runs?
Yes: on_success names a response sent after the tool succeeds, and on_failure one sent after it fails. Your utter trigger from Part 7 already sends the booking confirmation, so this part doesn’t need them.
Conclusion
You added tool constraints: requires keeps the booking tool away from Claude until memory holds every detail, requires_confirmation makes Rasa ask the customer in your words before the tool runs, and complete_when ends the skill once the booking is made. Claude still runs the conversation, but the booking can no longer happen too early or without a yes.
← Previous: Part 7: Responses: Control the Exact Wording
Next → Part 9: Scoped Instructions: Show Claude Only the Rules That Apply
Additional Resources
- Tool Constraints (opens in a new tab) (Rasa docs)
- skill.md reference (opens in a new tab), including
tool_constraintsandcomplete_when(Rasa docs) - Conditions (opens in a new tab), the grammar of
requires(Rasa docs) - State when the skill is finished (opens in a new tab) (Rasa docs)
Related
- Rasa Tutorial — Part 7: Responses: Control the Exact Wording
- Rasa Tutorial — Part 5: Memory: Remember What Matters, where the booking skill comes from
- Fixed: Rasa Mantle Says “I haven’t booked it yet” After the Customer Taps Yes
- Rasa Tutorial for Beginners: Mastering Rasa Pro in Python, with every part of the series
Rasa, Claude, Azure and other names mentioned are trademarks of their respective owners. JD Bots isn’t affiliated with or endorsed by Rasa Technologies, Anthropic or Microsoft.
0 comments