Skip to content
RasaGet a free licence

tutorial

Chapter 7 of 10

How to make a Rasa agent follow steps in order

by Rod Rivera Published

Build a baggage-reporting skill that collects details in order and asks for confirmation before submitting.

Goal

Build a baggage-reporting skill. It plays a recording notice, collects details in order, asks for confirmation and announces a successful submission.

Teach

Reach for ordered blocks when order itself is the requirement. Most skills never need them. When they do, prose can invoke a block with @block.<id>.

Once they want to file a report, invoke @block.collect_baggage

:::ordered_block id=collect_baggage
steps:

- id: fetch_bookings
  execute_tool: list_bookings
- id: select_booking
  instructions: |
    Ask which trip the bag belongs to. Set booking_ref.
  complete_when: session.report_baggage.booking_ref

# ... more steps ...

:::

The block id goes on the fence line as id=collect_baggage. Putting it inside the body as id: is the most common mistake here, and the error you get back is “must declare an id attribute”. A step’s complete_when is the same condition expression used everywhere else, so a bare session.report_baggage.booking_ref means “this step is done once that field has a value”.

Step types:

TypePropertiesBehaviour
Execute toolexecute_tool:Framework calls the tool directly
Conversationalinstructions: + complete_when:LLM talks within the step
Collectcollect: + utter:Framework collects a value

tool_constraints, including requires and requires_confirmation, still apply when a block or the LLM attempts a tool call.

Paste

Copy the complete skill folder, including its instructions, memory and responses:

Source: tutorial/snippets/step-05-baggage/
Copy: skills/report_baggage/
Files: skill.md, memory.yml, responses.yml

Train and try

make train
make inspect

Try (voice if possible): “My bag did not arrive.”

Verify:

  1. Recording notice plays on activate
  2. Bookings are listed before details are collected
  3. Summary confirmation happens before submit
  4. A report id such as BAG1001 is returned

Talking point

This skill combines the controls introduced in earlier chapters. Instructions can guide the conversation around an ordered block that fixes a particular sequence. When the whole conversation needs a fixed order, the entire skill can be one ordered block.

Next

Chapter 8 — Compose skills