- Well-defined prescriptive business logic.
- Dynamic business logic run by ReAct sub agents inside Rasa.
- Externalized business logic by invoking sub agents outside Rasa.
- Clarity: Each flow focuses on a single job or outcome (e.g., “Block Credit Card”).
- Reusability: Flow logic can be called from other flows or triggered on its own.
- Maintainability: You can refine or change the flow logic without affecting the entire conversation design.
Conversation Patterns (System Flows)
In addition to the flows you write for your domain-specific tasks, Rasa provides patterns—pre-defined, reusable flows that handle “meta” conversational situations or repairs. For instance, if a user cancels a flow midway or wants to clarify a previously collected piece of information, a pattern steps in to handle this detour. These patterns work like templates: they can be triggered whenever relevant, so your assistant can handle common conversational patterns consistently. Read more about customizing patterns under Customizing PatternsHow Do Flows Work?
Triggering Flows
CALM uses an LLM “command generator” prompt that contains the conversation history, the relevant flows, slots, and conversation patterns. Essentially, CALM leverages the LLM to parse the user’s request into structured commands, referencing all pertinent context—including conversation history, current state, and flow definitions. This approach ensures that when the user’s goal matches the description of a given flow, that flow will be triggered. Flows can also be:- Started by a direct NLU trigger (e.g., when a recognized intent maps to a flow).
- Linked or called from inside another flow (for subflows or follow-up tasks).
Dialogue Stack
When a flow (or pattern) is activated, it’s placed on top of a dialogue stack (like stacking plates). The topmost flow is always active. Once that flow finishes or is canceled, the system returns to the next flow on the stack. This structure ensures that your assistant’s logic remains organized, even when users interrupt or pivot to new tasks.How to Write Flows
Flows support three approaches: prescriptive steps, autonomous steps, and hybrid flows that combine both. Use prescriptive steps for critical business logic that must be enforced consistently. Use autonomous steps when business logic is undefined, highly variable, or too complex to script manually. Writing a flow in CALM involves capturing the essential steps to fulfill a user request without hardcoding every possible conversation path. You define flows as YAML in yourflows.yml (or multiple YAML files), focusing on the business logic:
- Give the flow an ID and a clear description
flows.yml
- The
descriptionis critical for the LLM to understand when to pick this flow.
-
Add the steps
Each step specifies what your assistant should do:
- Collect user information:
flows.yml
- Take an action (e.g., a custom action or a response):
flows.yml
- Set or reset slots:
flows.yml
- Call or link other flows for subflows or follow-ups:
flows.yml
flows.yml
- Include LLM driven autonomous steps for dynamic logic:
flows.yml
research_stocks can be either a ReAct style autonomous sub agent interacting with tools from an MCP server
or an external agent connected via A2A.
More information on different step types can be found on the reference page.
3. Include branching if needed
You can add simple conditional logic (like checking if a slot is filled or if a user is already authenticated):
flows.yml
- Force slot collection (suppress interruptions) in collect steps if needed
force_slot_filling property to true if you want the assistant to ignore any other commands and only focus on filling text type slots. This is especially useful when you want to collect feedback or longer text input from the user in collect steps.
flows.yml
- Leverage conversation patterns You don’t need to write custom branching logic for every possible user detour. Flows represent the business logic your assistant is supposed to drive throughout conversation. Instead, rely on patterns (built-in flows) to accommodate user detours.
Importance of Clear Descriptions
Each flow has a description that briefly explains what the flow accomplishes. The LLM reads these descriptions to decide which flow to start. A concise, specific description reduces errors in flow selection. For example:Good: “Block a user’s credit card if they suspect fraud or want to freeze it”
Less useful: “Card blocking request”
Key Takeaways
- Flows define business logic: They can use prescriptive steps for guaranteed processes, autonomous steps for dynamic logic, or combine both approaches as needed.
- LLMs + flows: The LLM remains flexible in interpreting user input and context, while flows make sure the assistant sticks to rules and processes.
- Choose the right approach: Use prescriptive steps for critical business rules, autonomous steps for undefined or complex logic, and hybrid flows to get the best of both worlds.
- Write clear and detailed descriptions: They help the LLM reliably select the right flow at the right time.
- Use patterns for conversation repair: Don’t clutter your flow with every possible detour. Let patterns handle cancellations, clarifications, or other unexpected conversation turns.