Skip to content

tutorial

Chapter 1 of 5

Chapter 1 — The session start hook

by Rod Rivera Published

Every Mantle conversation opens by running one skill. That is where anything the whole conversation needs should be loaded.

Start from a scaffolded project:

rasa init --engine mantle
rasa train
rasa inspect
bot  Hello! What can I assist you with today?

Where that greeting comes from

Every Mantle conversation opens by running a skill called default_session_start. It ships with the engine, and it does exactly one thing: greet.

That makes it the hook. It is the only place guaranteed to run before the customer has said anything, which makes it the right place to load whatever the rest of the conversation should already know.

Overriding it

You do not edit the bundled skill. You create a folder with the same skill id, and yours wins:

skills/default_session_start/
  skill.md        your version of the opener
  tools.py        the lookup it runs
  responses.yml   the greeting it delivers

That is the whole override mechanism — same id, your copy takes precedence. Nothing to register.

What we are about to put in it

Right now the skill greets. We want it to look the customer up and then greet, in that order, every time.

“In that order, every time” is the interesting part. Written as prose the model would usually do it and occasionally not — and when it greets first, the template interpolates empty values and the customer gets Good , !. Chapter 3 makes the order a guarantee instead.