> ## Documentation Index
> Fetch the complete documentation index at: https://rasa.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Conversation Patterns

> Learn more about how to use the conversation lifecycle to ensure seamless conversations.

export const Conversation = ({caption, messages}) => {
  const speakers = {
    user: "User",
    assistant: "Assistant"
  };
  return <figure className="rasa-chat">
      <div className="rasa-chat__log" role="log" aria-label={caption || "Example conversation"}>
        {messages.map((message, index) => {
    if (message.role === "event") {
      return <p key={index} className="rasa-chat__event">
                <code>{message.text}</code>
              </p>;
    }
    if (message.role === "note") {
      return <p key={index} className="rasa-chat__note">
                {message.text}
              </p>;
    }
    const role = message.role === "user" ? "user" : "assistant";
    return <div key={index} className={`rasa-chat__turn rasa-chat__turn--${role}`}>
              <span className="rasa-chat__speaker">{speakers[role]}</span>
              <p className="rasa-chat__text">{message.text}</p>
            </div>;
  })}
      </div>
      {caption ? <figcaption className="rasa-chat__caption">{caption}</figcaption> : null}
    </figure>;
};

Real conversations are rarely linear—users switch topics, correct themselves, and ask follow-up questions.
**Conversation patterns** are reusable system flows that are **provided by CALM** and enable your AI assistant to handle these non-linear interactions cooperatively,
and repair the conversation when customers don’t follow the path you expect them to.

## Use conversation patterns for smarter AI assistants

You can’t predict everything a user will say—and with **conversation patterns**, you don’t have to.
Conversation patterns make your assistant more flexible and effective by:

* **Keeping conversations on track:** Handle unexpected inputs seamlessly, leading to more successful outcomes and a better user experience.
* **Simplifying design and development:** Helps the team focus on crafting great user journeys and business logic instead of accounting for every possible detour.

## How Conversation Patterns work

**Here’s an overview of the different types of conversation patterns:**

| **Category** | **Conversation Patterns** |
| - | - |
| **Conversation Repair** | Correct mistakes and misunderstandings with **correction**, **clarification**, and **interruption** patterns. |
| **Conversation Navigation** | Navigate conversations helping users to **cancel** , **restart**, or **complete** a process. |
| **External Support** | Provide external support with **search**, **human handoff**, or **chitchat** patterns. |
| **Voice** | Prepare to **repeat** something and handle scenarios where the user remains **silent**. |
| **System Error** | Inform the user of unexpected system issues, like an **internal error** or **code change**. Activate **cannot handle** (fallback) pattern if no flow or relevant documents apply. |

## Conversation Patterns in Action

Here is an example of a conversation pattern in each category listed above:

1. **Correction (repair pattern)**: Update and correct previously stored conversational information.

<Conversation
  caption="Example showcasing corrections"
  messages={[
{ role: "user", text: "My name is Jonathan, not John." },
{ role: "event", text: "correction triggered" },
{ role: "assistant", text: "Thanks for letting me know! It’s important to get things right. Should I update your name to Jonathan in my records?" },
{ role: "user", text: "Yes, please." },
{ role: "event", text: "updated first name to Jonathan" },
{ role: "assistant", text: "Great! I’ve updated your name to Jonathan. Let me know if there’s anything else I can assist with." },
]}
/>

2. **Cancellation (navigation pattern)**: Allows a user to stop a task in the middle of one topic or task.

<Conversation
  caption="Example showcasing error handling"
  messages={[
{ role: "user", text: "I want to send some money to Dimitri" },
{ role: "assistant", text: "How much money do you want to send?" },
{ role: "user", text: "Ah, never mind. I see I have already sent it earlier." },
{ role: "event", text: "cancellation triggered" },
{ role: "assistant", text: "Okay, I am canceling the transfer." },
]}
/>

3. **Start a conversation (navigation pattern)**: Conversations can be initiated by either your assistant or the user.

<Conversation
  caption="Example showcasing a simple assistant greeting"
  messages={[
{ role: "event", text: "session started" },
{ role: "assistant", text: "Hi there! How can I assist you today?" },
]}
/>

4. **Search (external support pattern)**:
   Enables your assistant to query data from your knowledge base with Rasa's enterprise search feature and provide helpful answers.

<Conversation
  caption="Example showcasing enterprise search"
  messages={[
{ role: "user", text: "What is your policy on returns?" },
{ role: "event", text: "pattern search started" },
{ role: "assistant", text: "We accept returns within 30 days of purchase if they are returned in new condition and original packaging. Would you like to start a return process?" },
]}
/>

5. **Repeat (voice pattern)**:
   Enables your assistant to repeat a previous message.

<Conversation
  caption="Example showcasing a user asking the assistant to repeat the last message"
  messages={[
{ role: "assistant", text: "Your order #1377 is on it's way. Would you like to track it?" },
{ role: "user", text: "Can you repeat that?" },
{ role: "event", text: "repeat triggered" },
{ role: "assistant", text: "Of course, your order #1377 is on its way. Would you like to track it?" },
]}
/>

6. **Errors (system pattern)**:
   Invalid responses or technical issues might require apologies or alternative actions. In these scenarios, you might need to re-ask questions,
   confirm intent, or escalate to a human agent.

<Conversation
  caption="Example showcasing error handling"
  messages={[
{ role: "user", text: "Update my order details." },
{ role: "event", text: "internal error: request timed out" },
{ role: "assistant", text: "Oops! It looks like something went wrong while processing your request. Let me try that again or escalate this issue." },
]}
/>

## Customizing Conversation Patterns

Rasa provides a default structure for each pattern, but you are free to [customize](/docs/pro/customize/patterns) them to fit your use case.
Since patterns are system flows, you can edit them like any other flow in Rasa Pro or Rasa Studio.
We recommend keeping the [contextual response rephraser](/docs/reference/primitives/contextual-response-rephraser) enabled for pattern flows
as it helps your assistant sound more natural, especially when repairing dynamic interactions.

## Learn more about Patterns

* Read the complete [pattern reference documentation](/docs/reference/primitives/patterns)
* Use Rasa Studio to [edit conversation patterns](/docs/studio/build/flow-building/system-flows)


## Related topics

- [Customizing Patterns](/docs/pro/customize/patterns.md)
- [Assistant Tone](/docs/pro/customize/assistant-tone.md)
- [Writing Flows](/docs/pro/build/writing-flows.md)
- [How to Edit System Flows](/docs/studio/build/flow-building/system-flows.md)
- [Conversational AI with Language Models](/docs/learn/concepts/calm.md)
