Skip to main content
0 reactions

Rasa Tutorial — Part 12: The Runtime Loop: How Mantle Handles a Turn

Card titled The Runtime Loop: How Mantle Handles a Turn, with the subtitle Follow one message round Mantle’s loop: the framework acts first, Claude decides the rest. Beside it, the chat question Is there a branch in Riverton? leads into three numbered passes, Pick a skill, find_branches and Reply, each marked Claude, with the facts One message, three passes and The framework acts first.
One message, three passes through Mantle’s loop.

Every message you send to a Rasa agent goes through the same loop. Rasa’s framework acts first, Claude decides only what needs judgment, and one message can go round the loop several times. In this part of the Rasa Tutorial, you follow messages through the runtime loop of Rasa Pro’s Mantle engine, pass by pass, in the Rasa Inspector.

By the end, you’ll be able to read any turn of your agent: how many times Claude was called, what it was allowed to do each time, and what the framework did on its own. You don’t change any files in this part.

This is Part 12 of the Rasa Tutorial. The parts in Module D, Orchestration:

  • Part 12: The Runtime Loop: How Mantle Handles a Turn (you are here)
  • Part 13: Guarantees and Guardrails
  • Part 14: Skills and Routing
  • Part 15: Context Management
All parts of the Rasa Tutorial

Module A: Start Here

Module B: Building Skills

Module C: Progressive Control

Module D: Orchestration

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 four 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.

Prerequisites

How the Runtime Loop Works

Rasa’s Runtime Loop (opens in a new tab) page describes what Mantle does each time a message arrives. The framework is Rasa’s own code, and Claude is the LLM your agent calls:

  1. The framework acts first. It runs everything that’s already decided, such as the next steps of an ordered block, without calling Claude. It also decides what Claude may do next: which skills it can start and which tools it can call.
  2. It builds a focused prompt from the active skill’s instructions, the tools allowed right now and the memory that matters.
  3. It calls Claude. Claude replies, calls a tool or starts a skill, but only from what the framework allowed.
  4. A tool call goes back through the framework. Rasa checks the tool’s constraints, runs it, and goes round the loop again from step 1.

One message can go round the loop several times: call a tool, read its result, then reply. In this part, each time round the loop is a pass.

Step 1: Start Your Agent

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

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

Start your agent with the Rasa Inspector:

TerminalBash
rasa inspect

When it’s ready, the Inspector opens in your browser with an empty chat. Keep Terminal open: you’ll come back to it in Step 4.

Step 2: Ask a Question That Needs a Tool

In the Inspector, type Is there a branch in Riverton? and press Enter. The agent lists both Riverton branches:

The Rasa Inspector chat with the question Is there a branch in Riverton? and the agent’s reply listing two branches, Riverton High Street at 14 High Street and Riverton Station at 2 Station Road, then asking whether to book an appointment or check their opening hours.
The agent lists both Riverton branches.

To answer, the agent had to start the Find a Branch skill and run its find_branches tool. Next, see how many passes that took.

Step 3: Follow the Turn in Inspect Mode

Click the Inspector mode button at the top of the chat, the one with three sliders, and choose Inspect. Under your message, the Inspector lists everything that happened in that turn:

Inspect mode event list for the Riverton question: an LLM call, Find a Branch skill activated, a second LLM call, Tool call find_branches, a third LLM call, then the reply marked LLM generated and Agent turn ended.
One message, three passes, each with an LLM call.

Each LLM call is one pass that called Claude. Your one message took three:

  1. Pass 1: no skill was running, so Claude started one. Find a Branch skill activated shows its choice.
  2. Pass 2: with Find a Branch running, Claude asked for the skill’s tool. Tool call: find_branches is Rasa running it. Then the loop went round again.
  3. Pass 3: Claude read the tool’s result and replied in text, so the turn ended: Agent turn ended.

Click the first LLM call. Its Tools list is everything the framework let Claude do in that pass, and the highlighted one is what Claude chose:

LLM call panel for the first pass: model claude-sonnet-5-5, 2.0 s, and three tools, activate, highlighted because Claude called it, search_knowledge and listen.
First pass: Claude can only pick a skill, search or wait.

With no skill running, Claude could only start a skill (activate), search your documents from Part 6 (search_knowledge) or wait without replying (listen). Now click the second LLM call:

LLM call panel for the second pass: model claude-sonnet-5-5, 1.4 s, and seven tools, activate, search_knowledge, listen, complete, cancel, set_memory and find_branches, highlighted because Claude called it.
Second pass: Find a Branch’s tools are offered too.

Find a Branch was running, so the framework added its tools: complete and cancel to end the skill, set_memory, and find_branches, which Claude called. Scroll down to its Prompt: it now holds Find a Branch’s instructions too. That’s step 2 of the loop: each pass gets a prompt built for what’s running at that moment.

Advertisement

Step 4: Read the Turn in Terminal

Go back to Terminal. Among its log lines, Rasa writes one line when a turn starts and one when it ends:

Output (the lines that matter)Plain text
2026-11-27 11:49:32 INFO     rasa.mantle.orchestration.orchestrator  - [info     ] mantle.turn.started            active_flow=None conversation_id=00000000-0000-0000-0000-000000000000 stack_depth=0
2026-11-27 11:49:37 INFO     rasa.mantle.orchestration.orchestrator  - [info     ] mantle.turn.completed          conversation_id=00000000-0000-0000-0000-000000000000 error=None iteration_count=3 source=llm_text
  • active_flow=None: no skill was running when your message arrived.
  • source=llm_text: the turn ended on a text reply from Claude.
  • iteration_count is Rasa’s own loop counter for the turn. Rasa stops a turn when it reaches 20, so a turn can’t loop forever.

Above these lines, your first message also printed warnings: a WARNING that Rasa doesn’t recognise the name claude-sonnet-5-5 (why) and several UserWarning lines about the ReadOnly qualifier (why, and what to do). Neither stops your agent.

Step 5: Watch the Framework Act Without Claude

Click Restart conversation, the circular arrow at the top of the chat, to start a new conversation. Then send these three messages to the Lost or Stolen Card skill from Part 10, one at a time, waiting for each reply:

  1. I lost my debit card
  2. 4821
  3. Yes, freeze it

Each message made one LLM call. In Inspect mode, click the small arrow next to the last LLM call to show the events under it:

Inspect mode events after Yes, freeze it: one LLM call that set freeze_confirmed to true, then freeze_reference set to FRZ-5093, Tool call freeze_card, the message Your card ending 4821 is frozen marked utter_card_frozen template, the block and the skill completed, the Completed skill activated, and the wrap-up question marked utter_ask_wants_to_continue template.
One LLM call, then the framework does the rest.
  • The LLM call is Claude’s only job in this turn: it saved the customer’s yes, freeze_confirmed set to true.
  • Everything below it is the framework, in the passes after it. The block’s freeze step ran the tool (Tool call: freeze_card, which saved the reference), and Rasa sent the fixed frozen message. Then it finished the block and the skill, started its built-in Completed skill and asked its fixed wrap-up question.

That’s step 1 of the loop at work: once Claude had saved the answer, every remaining step was already decided, so Rasa ran them all without calling Claude again. Terminal shows how this turn ended:

Output (the lines that matter)Plain text
2026-11-27 11:51:41 INFO     rasa.mantle.orchestration.orchestrator  - [info     ] mantle.turn.started            active_flow=lost_card__freeze_card conversation_id=00000000-0000-0000-0000-000000000000 stack_depth=2
2026-11-27 11:51:42 INFO     rasa.mantle.orchestration.orchestrator  - [info     ] mantle.turn.completed          conversation_id=00000000-0000-0000-0000-000000000000 error=None iteration_count=2 source=phase_response_wait

source=phase_response_wait means the turn ended on a message from the framework’s own steps, and the agent now waits for the customer. active_flow=lost_card__freeze_card is the Lost or Stolen Card skill’s freeze_card block, which was waiting for the yes when your message arrived.

Clean Up

Go back to Terminal and press Ctrl+C to stop the agent. Keep the my-rasa-agent folder: Part 13 builds on it.

Common Mistakes

MistakeDo this instead
Expecting one Claude call per messageCount the LLM calls in Inspect mode. The Riverton question took three, and the yes to the freeze took one.
Thinking Claude runs your toolsClaude only asks for a tool. Rasa checks the tool’s constraints and runs it, as Tool call: find_branches shows.
Looking for the passes in Preview modeChoose Inspect from the Inspector mode menu.
Taking the UserWarning lines for an errorThey don’t stop your agent: it still answers. Why they appear.

Troubleshooting

ProblemFix
The chat shows your messages but no LLM callsYou’re in Preview mode. Choose Inspect from the Inspector mode menu.
The agent replies I'm sorry, but something went wrong. Please try again.That’s Rasa’s reply when a turn can’t finish, for example after 20 passes or when the call to Claude fails. Look in Terminal for the error just above the turn’s last line.
You can’t find the turn lines in TerminalThey’re in the Terminal window that runs rasa inspect, among the other log lines. Press ⌘F and search for mantle.turn.completed.

FAQ

Does every message cost one Claude call?

No. Claude is called once for each pass that needs a decision. In this part, the Riverton question made three calls, and each Lost or Stolen Card message made one. Steps the framework settles on its own, such as an ordered block’s fixed messages, make no call.

Can a turn loop forever?

No. Rasa Pro 3.22 stops a turn after 20 passes and sends “I’m sorry, but something went wrong. Please try again.”

When does a turn end?

When there’s nothing left for the agent to do until the customer writes again: Claude replied in text, as in Step 3, or a step asked a question that needs the customer’s answer, as the Lost or Stolen Card block did after your first two messages. Claude can also call listen to wait without sending a message. Rasa’s Execution loop reference (opens in a new tab) lists every case.

What are the Session Start events at the top of the chat?

Rasa’s built-in Session Start skill sets up each new conversation without saying anything, so it makes no call to Claude. The Inspector starts it when a conversation begins (Start a conversation (opens in a new tab)).

Conclusion

Every message runs through the same loop. The framework settles what it can, Claude decides the rest from a focused prompt and a short list of tools, and every tool call comes back through Rasa. In Inspect mode, each LLM call is one pass, so you can see exactly what Claude decided and what the framework did on its own.

← Previous: Part 11: Sub-skills: Reuse One Skill Inside Another

Coming next: Part 13: Guarantees and Guardrails.

Additional Resources

Rasa, Claude and other names mentioned are trademarks of their respective owners. JD Bots isn’t affiliated with or endorsed by Rasa Technologies or Anthropic.

0 comments