Site icon JD Bots

Fixed: Rasa Mantle Ordered Block Runs the Same Tool Twice

Featured card for the fix Rasa Mantle Ordered Block Runs the Same Tool Twice: after the customer says “Yes, please.”, the tool call freeze_card runs twice, Claude’s call then the block’s, and after the fix it runs once; notes “Seen on Rasa Pro 3.22” and “Fix: requires: on the tool”.

Fixed: Rasa Mantle Ordered Block Runs the Same Tool Twice

A Rasa Mantle skill built as an ordered block ran its tool twice after the customer said yes once: Claude called the tool while it saved the answer, and then the block’s own step ran it again. Here’s how it showed up in the Rasa Inspector, why Claude could call the block’s tool at all, and the gate that leaves the call to the block.

Seen on Rasa Pro 3.22.0 with the Mantle engine and Claude Sonnet 5.5.

What I Was Doing

I was writing Rasa Tutorial — Part 10: Ordered Blocks: Run Steps in a Fixed Order. Its new Lost or Stolen Card skill is one ordered block: it asks for the last four digits of the card, asks whether to freeze it, runs the freeze_card tool with an execute_tool: step, and sends a message with the reference. This was the skill:

skills/lost_card/skill.md (before the fix)

---
name: Lost or Stolen Card
description: Lost or stolen debit card - freeze it straight away
---

:::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
:::

What I Expected

Rasa’s Ordered block steps reference says an execute_tool: step runs its tool directly, without the LLM. So after the customer’s yes, Claude would save the answer, and the block would run freeze_card once.

What I Got

The chat looked right: one message with one reference. In Inspect mode, though, the events under Yes, please. showed two tool calls:

One yes, two Tool call: freeze_card rows.

Against a real card system, that’s two freeze requests for one yes.

What I Checked

I clicked the LLM call under Yes, please. to see what Claude had been offered and what it answered:

Claude was offered freeze_card, and called it along with set_memory.

freeze_card was in Claude’s Tools, and the Response was set_memory, freeze_card: Claude saved the yes and froze the card in the same answer. Then the block reached its freeze step and ran the tool again, as it’s meant to.

Rasa’s Tools reference explains both halves. A skill’s own tools come from its tools.py and are offered to the LLM, and “the same function can be run directly by an ordered-block execute_tool: step.”

Why It Happens

The Fix

Hide the tool from Claude with a requires condition in tool_constraints, the gate from Part 8. Rasa takes a tool off Claude’s list while its condition is false, and an execute_tool: step checks the same condition before it runs the tool. Add this to the frontmatter of skills/lost_card/skill.md, under description:

skills/lost_card/skill.md (excerpt)

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

Train again and restart the agent:

Terminal

rasa train
rasa inspect

After the Fix

The same conversation after training again. The LLM call under Yes, please. now looks like this:

freeze_card is greyed out, and Claude only saves the yes.

freeze_card is greyed out under Tools, and Claude’s response is only set_memory. Under the yes, the event list now shows one Tool call: freeze_card: the block’s.

Common Mistakes

MistakeDo this instead
Relying on execute_tool: alone to decide when a tool runsGate every tool a block runs with requires, or Claude may call it too.
Gating on a condition the block’s path never makes trueAn execute_tool: step waits until its tool’s condition holds. Gate on the answer the step before it collects.
Removing the block’s tool step once the gate is inKeep it: the gate only decides when the tool may run, and the block’s step is what runs it.

Troubleshooting

ProblemFix
Two Tool call rows for the same tool after one answerAdd a requires gate to the tool, as above.
The block stops at the tool stepThe tool’s requires condition isn’t true yet. Check the saved value in the Memory panel in Inspect mode: a bool must equal True.

FAQ

Why doesn’t Rasa hide a block’s tool from Claude by itself?

Rasa offers a skill’s tools to Claude whatever else runs them. Only a requires condition takes one off Claude’s list (Rasa’s Tool Constraints guide).

Does the gate stop the block from running the tool?

No. The block’s step checks the same condition, and by then the yes is saved, so the tool runs.

Does the customer notice the double call?

Not in the chat: they get one message. The extra call shows only in Inspect mode, or in the system the tool talks to.

Conclusion

The tool ran twice because Claude could see it while the block waited for the yes. A requires gate on the answer hides it from Claude until the block needs it, so the block runs it, once.

Additional Resources

Related

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.

Exit mobile version