Skip to main content
0 reactions

Rasa Tutorial — Part 10: Ordered Blocks: Run Steps in a Fixed Order

Featured card for Rasa Tutorial Part 10, Ordered Blocks: Run Steps in a Fixed Order. It shows the ordered block freeze_card with four numbered steps, ask for the card, ask whether to freeze it, run freeze_card and say it’s frozen, a no branch to not frozen, and the notes “Same order, every time” and “The tool runs without Claude”.
Rasa Tutorial Part 10: Ordered Blocks

Some tasks have steps that must happen in the same order every time. When a customer reports a lost debit card, the agent has to find out which card, get a clear yes, freeze the card and give a reference, with nothing skipped or swapped. In this part of the Rasa Tutorial, you build those steps as an ordered block in a Rasa Mantle skill. Rasa runs the steps itself, one after another, and uses Claude only to understand the customer’s answers.

By the end, the banking agent from Part 9 will have a new skill, Lost or Stolen Card, that freezes a card in four fixed steps. You’ll see the block drawn as a flow chart in the Rasa Inspector, and see that Rasa, not Claude, runs the freeze.

This is Part 10 of the Rasa Tutorial. The parts in Module C, Progressive Control:

All parts of the Rasa Tutorial

Module A: Start Here

Module B: Building Skills

Module C: Progressive Control

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 six calls to Claude: about $0.04. 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 messages the block sends cost nothing: Rasa sends them without calling Claude.

Prerequisites

Step 1: Create the Skill’s Memory

Open Terminal, go to your project folder and turn on its virtual environment:

TerminalBash
cd my-rasa-agent
source .venv/bin/activate

Every skill has its own folder under skills. Create one for the new skill:

TerminalBash
mkdir skills/lost_card

The block needs three memory fields: the card the customer means, their yes or no, and the reference the freeze returns. Create skills/lost_card/memory.yml:

skills/lost_card/memory.ymlYAML
schema:
  public:
    card_last_four:
      type: text
      llm_settable: true
      description: The last four digits of the card number, such as 4821.
    freeze_confirmed:
      type: bool
      llm_settable: true
      description: >-
        Whether to freeze the card now: true when the customer agrees, false
        when they say no or want to look for the card first.
    freeze_reference:
      type: text
  • card_last_four holds the last four digits of the card. It’s llm_settable, so Claude can save it from the customer’s answer, as in Part 5.
  • freeze_confirmed is a bool: true or false. Its description tells Claude what counts as each. Describe the no as well as the yes: with only the yes described, a hesitant “No, wait…” can leave the field empty, and the customer gets the same question again (Fixed: Rasa Mantle Asks the Same Question Again After the Customer Says No).
  • freeze_reference has no llm_settable, because only the freeze tool writes it.

Step 2: Write the Block’s Messages

An ordered block speaks through responses, the exact wording from Part 7. Create skills/lost_card/responses.yml with a question for each answer the block needs, and a message for each way it can end:

skills/lost_card/responses.ymlYAML
responses:
  utter_ask_card_last_four:
    - text: >-
        I'm sorry to hear that. Which card is it? Please tell me the last four
        digits of the card number.

  utter_ask_freeze_confirmation:
    - text: >-
        Shall I freeze the card ending {card_last_four} now? Nobody will be
        able to use it.

  utter_card_frozen:
    - text: >-
        Your card ending {card_last_four} is frozen. Your reference is
        {freeze_reference}.

  utter_card_not_frozen:
    - text: >-
        No problem. I haven't frozen your card. If you can't find it, just
        tell me and I'll freeze it straight away.

Rasa fills {card_last_four} and {freeze_reference} from memory when it sends the message.

Step 3: Add the Freeze Tool

Create skills/lost_card/tools.py with the tool that freezes the card:

skills/lost_card/tools.pyPython
"""Freeze a lost or stolen debit card for the lost_card skill."""

import random

from rasa.mantle.tools.decorator import ToolContext, tool
from rasa.mantle.tools.result import ToolResult


@tool(description="Lost or stolen card - freeze the card the customer confirmed")
async def freeze_card(context: ToolContext = None) -> ToolResult:
    last_four = context.memory.get("card_last_four")
    if not last_four:
        return ToolResult(llm_response={"frozen": False, "missing": ["card_last_four"]})
    reference = f"FRZ-{random.randint(1000, 9999)}"
    context.memory.set("freeze_reference", reference)
    return ToolResult(llm_response={"frozen": True, "reference": reference})

Like the booking tool from Part 5, it reads memory, saves a reference with context.memory.set and returns the result. This demo has no real card system: a real agent would call the bank’s card service here.

Step 4: Write the Ordered Block

Now the steps themselves. Create skills/lost_card/skill.md:

skills/lost_card/skill.mdPlain text
---
name: Lost or Stolen Card
description: Lost or stolen debit card - freeze it straight away

tool_constraints:
  - freeze_card:
      requires: "session.lost_card.freeze_confirmed == True"
---

:::ordered_block id=freeze_card
steps:
  - id: ask_card
    collect: card_last_four
    utterance: utter_ask_card_last_four

  - id: ask_confirmation
    collect: freeze_confirmed
    utterance: utter_ask_freeze_confirmation
    next:
      - if: "session.lost_card.freeze_confirmed == True"
        then: freeze
      - else: not_frozen

  - id: freeze
    execute_tool: freeze_card
    next: frozen

  - id: frozen
    utter: utter_card_frozen
    next: END

  - id: not_frozen
    utter: utter_card_not_frozen

  - id: END
:::

The block sits between the :::ordered_block id=freeze_card line and the closing :::. Inside is a steps: list, which Rasa runs from the top. Each step has an id, and its other key says what kind of step it is:

KeyWhat Rasa does
collect: with utterance:Sends the question from responses.yml and waits until Claude saves the answer to that memory field. If the field already has a value, it skips the question.
execute_tool:Runs the tool itself, without Claude.
utter:Sends a response word for word.
next:Names the step that comes next. A list of if: and then: branches takes the first condition that’s true, and else: catches the rest. A step without next: goes on to the step below it.
id: ENDEnds the block.

So the block asks for the card, then asks whether to freeze it. A yes leads to freeze, which runs freeze_card, then to the frozen message. Anything else leads to not_frozen. The next: END on frozen stops the frozen path from running on into not_frozen.

This skill has no instructions, only the block. Rasa’s Ordered Blocks (opens in a new tab) guide calls this a fully controlled skill: Rasa starts the block as soon as it starts the skill, and the skill ends when the block reaches END. That suits a short procedure that must run whole every time.

The tool_constraints section at the top is the gate from Part 8. Rasa offers a skill’s tools to Claude while the skill runs, even while a block waits for an answer. requires keeps freeze_card away from Claude until the customer has said yes, so the only freeze is the block’s own. Without it, Claude may call the tool itself as it saves the yes, and the card is frozen twice (Fixed: Rasa Mantle Ordered Block Runs the Same Tool Twice).

Step 5: Train Your Agent

TerminalBash
rasa train

Rasa checks the block while it trains: a step that points to a step that doesn’t exist stops the training with an error that names both. When it finishes, the last line names your new agent package:

Output (the line that matters)Plain text
2026-11-24 21:53:39 INFO     rasa.mantle.model_archive.snapshot  - [info     ] Mantle agent package saved at 'models/20261124-215338-mild-sphere.tar.gz'.

Two new INFO notes say that the new llm_settable fields have no validation tool. Like the others from Part 5, they aren’t errors.

Advertisement

Step 6: Freeze a Lost Card

TerminalBash
rasa inspect

When the Rasa Inspector opens in your browser, send I've lost my debit card., then It ends in 4821., and answer the question with Yes, please.

A conversation in the Rasa Inspector: the customer says they’ve lost their debit card, the agent asks for the last four digits of the card number, the customer says it ends in 4821, the agent asks “Shall I freeze the card ending 4821 now? Nobody will be able to use it.”, the customer says “Yes, please.”, and the agent replies that the card ending 4821 is frozen with reference FRZ-4347, then asks whether it can help with anything else.
The block’s steps in order: the card, the yes, the freeze, the reference.

Every message from the agent is one of your responses, word for word, in the order the block sets. Your reference will differ. The last question is Part 7’s wrap-up, sent after the skill ends.

Step 7: Watch the Block in Inspect Mode

Click the Inspector mode button at the top of the chat and choose Inspect. Click the LLM call just above the question “Shall I freeze the card ending 4821 now?”, then click the green ordered_block · freeze_card bar in the middle panel to open the block:

The middle panel of the Rasa Inspector showing the ordered block freeze_card as a flow chart: Start, then the questions card_last_four and freeze_confirmed, then a branch: if session.lost_card.freeze_confirmed is true, the freeze_card tool and then utter_card_frozen; otherwise utter_card_not_frozen.
The Inspector draws the block as a flow chart, with both branches.

Back in the left panel, the events under Yes, please. show who did what:

The Rasa Inspector event list after the customer says “Yes, please.”: an LLM call to claude-sonnet-5-5, freeze_reference set to FRZ-4347, a tool call to freeze_card, the message “Your card ending 4821 is frozen. Your reference is FRZ-4347.” marked as the utter_card_frozen template, then the freeze_card block and the Lost or Stolen Card skill completed.
Claude saved the yes. The block ran the freeze and sent the message.
  • The LLM call is Claude reading Yes, please. and saving freeze_confirmed as true. Click it: its Response is only set_memory, and freeze_card is greyed out under Tools, because the gate kept it from Claude.
  • Tool call: freeze_card is the block’s freeze step. Rasa ran the tool itself, with no LLM call of its own.
  • The frozen message is marked utter_card_frozen template: Rasa sent it word for word.

Step 8: Say No Instead

Choose Preview from the Inspector mode menu, click the circular arrow (Restart conversation) at the top of the chat, and send I think I've lost my debit card., then It's the one ending 7305., then No, thanks.

A conversation in the Rasa Inspector: the customer thinks they’ve lost their debit card, gives the card ending 7305 and answers the freeze question with “No, thanks.”, and the agent replies “No problem. I haven’t frozen your card. If you can’t find it, just tell me and I’ll freeze it straight away.”, then asks whether it can help with anything else.
A no takes the else branch: no freeze, and a different ending.

This time Claude saved freeze_confirmed as false, so the block took the else branch: no freeze, and the not-frozen message instead.

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 11 builds on it.

Common Mistakes

MistakeDo this instead
Leaving next: END off the last step of a branchA step without next: goes on to the step below it, so the frozen path would also send the not-frozen message. End a branch with next: END unless the next step down is END.
Putting the else: branch firstRasa checks branches in order and takes the first match, so else: goes last.
Naming a collect: step’s question with utter:A collect: step names its question with utterance:. An utter: step only sends a message.
Leaving the block’s tool open to ClaudeGate it with requires on the answer that allows it, so only the block runs it. See Fixed: Rasa Mantle Ordered Block Runs the Same Tool Twice.
Describing only the yes in a yes-or-no fieldSay what counts as false too. See Fixed: Rasa Mantle Asks the Same Question Again After the Customer Says No.
Giving the block its own descriptionTraining fails: Rasa routes to the skill by the skill’s description, so describe the skill instead.

Troubleshooting

ProblemFix
rasa train stops with “Step ‘ask_confirmation’ of flow ‘lost_card__freeze_card’ (skill ‘lost_card’, flow ‘lost_card__freeze_card’) routes to ‘freez’, which is not a step in the flow. Point ‘next’ at an existing step id or ‘END’.”A next: or then: names a step that doesn’t exist. Correct it to a step’s id, or to END.
Two Tool call: freeze_card rows after one yesClaude called the tool as well as the block. See Fixed: Rasa Mantle Ordered Block Runs the Same Tool Twice.
The agent asks “Shall I freeze the card…?” again after the customer says noClaude didn’t save the answer. See Fixed: Rasa Mantle Asks the Same Question Again After the Customer Says No.

FAQ

How is an ordered block different from a skill’s instructions?

Claude reads instructions and decides what to do, and in what order. Rasa keeps a block’s order itself: each step runs only after the one before it, and the tool and message steps run without Claude. Rasa’s Ordered Blocks (opens in a new tab) guide keeps blocks for steps where the order itself is the requirement, usually two to five of them, and leaves the rest of a skill as instructions.

Can a skill have instructions and a block?

Yes. Write the instructions as usual and start the block from them with @block.freeze_card. When the block ends, the conversation goes back to the instructions. Claude decides when to start the block, though, so Rasa’s When Prose Is Not Enough (opens in a new tab) guide recommends a skill that is only the block when the steps must run every time, as here.

What if the customer asks something else in the middle?

The block keeps its place. Claude answers the question, and Rasa asks the step’s question again. If the customer switches to another task, the block pauses, and the agent offers to carry on from the same step afterwards.

Why does the block sometimes skip the freeze question?

A collect: step asks only while its field is empty. If the first message already says “please freeze it”, Claude may save the yes straight away, and the block goes on to the freeze. To ask every time, add ask_before_filling: true to the step (Rasa’s Ordered block steps (opens in a new tab) reference).

Does Claude write any of the block’s messages?

No. Every message in this block is a response from responses.yml, sent word for word. Claude only reads the customer’s answers and saves them to memory.

Conclusion

You built a skill that is one ordered block: two questions, a branch, a tool step and two endings. Rasa ran them in order, ran freeze_card itself and sent every message word for word, while Claude only turned the customer’s answers into memory. The requires gate kept the freeze in the block’s hands.

← Previous: Part 9: Scoped Instructions: Show Claude Only the Rules That Apply

Next → Part 11: Sub-skills: Reuse One Skill Inside Another

Additional Resources

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