Skip to content

Rasa - Conversational AI Framework Cheatsheet

Rasa - Conversational AI Framework Cheatsheet

Rasa is an open-source framework for building contextual conversational assistants. Unlike prompt-only chatbots, Rasa gives you explicit control over dialogue: you define intents, entities, and flows, and the assistant follows business logic you specify rather than whatever the model improvises. Everything runs on your own infrastructure, which matters for regulated domains. Modern Rasa (CALM) blends LLM-based understanding with deterministic flow execution — the model interprets, your flows decide.

Installation

MethodCommand
pippip install rasa
New projectrasa init
RequirementsPython 3.9–3.11 (check current support)
Verifyrasa --version

Project Structure

PathContains
domain.ymlIntents, entities, slots, responses, actions
data/nlu.ymlTraining examples per intent
data/stories.ymlExample conversation paths
data/rules.ymlDeterministic rules
data/flows.ymlCALM business-logic flows
config.ymlNLU/policy pipeline
actions/actions.pyCustom Python actions

Core CLI

CommandDescription
rasa initScaffold a new assistant
rasa trainTrain the model
rasa shellChat with it in the terminal
rasa runStart the server
rasa run actionsStart the custom action server
rasa testRun tests against test stories
rasa interactiveInteractive training/correction
rasa data validateCheck data consistency

Defining Intents & Responses

# domain.yml
intents:
  - greet
  - check_balance

responses:
  utter_greet:
    - text: "Hi! How can I help?"

slots:
  account_id:
    type: text
    mappings:
      - type: from_entity
        entity: account_id

actions:
  - action_fetch_balance
# data/nlu.yml
nlu:
  - intent: check_balance
    examples: |
      - what's my balance
      - how much money do I have
      - show account [12345](account_id)

Flows (CALM)

# data/flows.yml
flows:
  check_balance:
    description: Look up the user's account balance
    steps:
      - collect: account_id
      - action: action_fetch_balance
      - action: utter_balance
Step typeDoes
collectAsk for and fill a slot
actionRun a custom or utter action
linkJump to another flow
set_slotsAssign slot values
next with ifConditional branching

Flows are deterministic: the LLM decides which flow the user wants, but the flow itself executes exactly as written.

Custom Actions

from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher

class ActionFetchBalance(Action):
    def name(self) -> str:
        return "action_fetch_balance"

    def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain):
        account = tracker.get_slot("account_id")
        balance = lookup_balance(account)
        dispatcher.utter_message(text=f"Your balance is ${balance}")
        return []

Run with rasa run actions (default port 5055).

Testing

rasa test                 # end-to-end tests
rasa test nlu --cross-validation
rasa data validate        # catch domain/data mismatches
Test typeChecks
NLU testsIntent/entity accuracy
Story testsFull conversation paths
Cross-validationGeneralization of NLU

Channels & Deployment

ChannelNote
RESTDefault HTTP endpoint
Web widgetEmbeddable chat
Slack / Teams / TelegramBuilt-in connectors
VoiceVia telephony integrations
DeploymentDocker, Kubernetes/Helm, self-hosted

Rasa vs LLM-Only Chatbots

AspectRasaPrompt-only LLM bot
ControlExplicit flows/business logicEmergent, hard to constrain
PredictabilityHighVariable
ComplianceAuditable pathsDifficult
HostingFully self-hostedUsually API-dependent
Best forRegulated, task-oriented assistantsOpen-ended conversation

For open-ended agents see LangGraph or Mastra; Rasa’s strength is deterministic, auditable task flows.

Resources