Skip to content

tutorial

Chapter 3 of 5

Chapter 3 — Guarantee the order, then personalize

by Rod Rivera Published

An ordered block makes the lookup run before the greeting, and the response template decides exactly what gets said.

Now wire the lookup in front of the greeting.

---
name: Session Start
description: 'Conversation opener: look up the customer, then greet them by name.'
routing:
  engine_managed: true
---

:::ordered_block id=main
steps:

- id: identify
  execute_tool: get_customer_profile
- id: greet
  action: utter_greet
  :::

The ordered block is the control lever. Order is a guarantee here, not a preference: the profile is loaded, then the greeting is delivered.

Write the same thing as prose — “look up the customer, then greet them” — and it works most of the time. The failure is quiet and occasional: the model greets first, the template interpolates nothing, and the customer gets Good , !. Ordered blocks remove the “most of the time”.

routing: engine_managed: true marks this as a skill the engine runs itself, rather than one the model chooses to activate.

The greeting

# skills/default_session_start/responses.yml
responses:
  utter_greet:
    - text: >-
        Good {session.project.time_of_day}, {session.project.customer_name}!
        Always great to see a {session.project.customer_tier} member who's been
        with us since {session.project.member_since}. How can I help you today?
      metadata:
        rephrase: true

Two separate things are happening, and keeping them apart is the point.

The placeholders are facts. They resolve from memory at delivery. The model does not pick them and cannot change them.

rephrase: true lets the model smooth the wording into the agent’s persona:

template   Good afternoon, Jordan! Always great to see a Premier member who's
           been with us since 2019. How can I help you today?

delivered  Good afternoon, Jordan! It's wonderful to have you back — thanks for
           being a Premier member since 2019. How can I assist you today?

Warmer, same facts.

“How much of this is the model making up?”

This question came up at office hours, and the answer is worth being precise about: the phrasing, and nothing else.

The template is the contract. Delete a placeholder and it disappears from the output — not “usually”, but always, because the model never had the value in the first place. If the tier should never be said aloud, remove {session.project.customer_tier}:

Good {session.project.time_of_day}, {session.project.customer_name}!
How can I help you today?

Gone. No instruction, no prompt engineering, no hoping.

That makes the response template the last gate on anything sensitive, and it composes with the private-memory boundary from Chapter 2: private memory controls what the model can see, the template controls what the customer can hear.

Try it

rasa train
rasa inspect
bot  Good afternoon, Jordan! It's wonderful to have you back — thanks for being
     a Premier member since 2019. How can I assist you today?