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

# Conversation Stage

> AI-powered dialogue handling for natural conversations

The **Conversation** stage is the primary node for AI-powered dialogue. It processes user input, generates contextual responses, and routes the conversation based on conditions you define.

## Overview

Conversation nodes handle the back-and-forth dialogue between your agent and the caller. They can:

* Generate dynamic AI responses based on a prompt
* Deliver static pre-written messages
* Use knowledge base content for accurate answers
* Route to other stages based on conversation context

<Info>
  Conversation nodes are colored **blue** on the canvas.
</Info>

## Configuration

### Mode

Choose how the node generates responses:

<Tabs>
  <Tab title="Prompt Mode">
    The AI generates responses dynamically based on your instructions.

    **Best for:**

    * Open-ended conversations
    * Q\&A interactions
    * Complex decision-making
    * Personalized responses

    ```
    You are a helpful product specialist for Acme Corp.
    - Answer questions about our products
    - Recommend products based on customer needs
    - If asked about pricing, provide current prices
    - Stay friendly and professional
    ```
  </Tab>

  <Tab title="Static Mode">
    The agent reads a pre-written message exactly as written.

    **Best for:**

    * Legal disclaimers
    * Fixed announcements
    * Compliance statements
    * Menu options

    ```
    Your call may be recorded for quality assurance purposes.
    Please say 'I agree' to continue.
    ```
  </Tab>
</Tabs>

### Prompt

When using **Prompt Mode**, the prompt tells the AI how to behave in this stage.

**Writing effective prompts:**

<AccordionGroup>
  <Accordion title="Be Specific">
    Tell the AI exactly what it should and shouldn't do.

    ```
    You are a returns specialist.
    - Help customers with return requests
    - Ask for order number if not provided
    - Explain our 30-day return policy
    - DO NOT process refunds directly
    - DO NOT discuss products outside returns
    ```
  </Accordion>

  <Accordion title="Set Boundaries">
    Define what's out of scope to prevent unwanted responses.

    ```
    You can help with:
    - Account questions
    - Billing inquiries
    - Technical support

    You cannot help with:
    - Medical advice
    - Legal matters
    - Competitor products
    ```
  </Accordion>

  <Accordion title="Include Context">
    Give the AI background information it needs.

    ```
    You are Alex from Acme Corp's premium support team.
    The customer has been verified as a Premium member.
    They have priority support and a dedicated account manager.
    ```
  </Accordion>
</AccordionGroup>

### Static Message

When using **Static Mode**, enter the exact message the agent should speak.

### Skip Response

Toggle to skip AI response generation. Useful when:

* You only need to evaluate transitions
* The response comes from a previous node
* You're using the node purely for routing

## Transitions

Transitions define when and where to route the conversation. Each transition has:

* **Condition**: When this transition should trigger
* **Target**: Which node to go to

### Adding Transitions

1. Scroll to the **Transitions** section in the node config
2. Click **Add Transition**
3. Enter a condition in natural language
4. Select the target node

### Condition Examples

| Condition                                | Use Case                |
| ---------------------------------------- | ----------------------- |
| "The customer wants to speak to a human" | Route to Human Transfer |
| "The customer is asking about pricing"   | Route to Pricing node   |
| "The customer confirms they're done"     | Route to End Call       |
| "The customer mentions an order number"  | Route to Order Lookup   |

<Note>
  Conditions are evaluated by the AI using natural language understanding. Write them as clear descriptions of when the transition should trigger.
</Note>

## Knowledge Base

Attach a knowledge base folder to enable RAG (Retrieval-Augmented Generation):

| Setting       | Description                                |
| ------------- | ------------------------------------------ |
| **Folder**    | Select which KB folder to use              |
| **Top-K**     | Number of results to retrieve (default: 5) |
| **Reranking** | Enable for better accuracy (default: on)   |

When a caller asks a question, the AI searches the knowledge base and includes relevant content in its response.

## Training Examples

Improve AI performance with examples:

### Free-form Examples

Add industry-specific patterns or edge cases:

```
When customers ask about "the thing that beeps",
they usually mean the smoke detector model SD-100.

Our warranty is 2 years for electronics,
5 years for appliances.
```

### Conversation Examples

Structured agent/caller exchanges to guide behavior:

```json theme={null}
[
  {
    "caller": "I want to return something",
    "agent": "I'd be happy to help with your return. Could you provide your order number?"
  },
  {
    "caller": "It's order 12345",
    "agent": "Thank you. I found your order. What item would you like to return?"
  }
]
```

## Example Configurations

<AccordionGroup>
  <Accordion title="General Support Handler">
    ```yaml theme={null}
    Mode: Prompt
    Prompt: |
      You are a customer support agent for Acme Corp.
      - Answer general questions
      - Look up information in the knowledge base
      - If you can't help, offer to transfer to a specialist

    Knowledge Base: /General-FAQ

    Transitions:
      - "Customer wants to speak to human" → Human Transfer
      - "Customer says goodbye or is done" → End Call
      - "Customer has billing question" → Billing Support
    ```
  </Accordion>

  <Accordion title="Product Recommendation">
    ```yaml theme={null}
    Mode: Prompt
    Prompt: |
      Help customers find the right product.
      Ask about their needs, budget, and preferences.
      Recommend up to 3 products from our catalog.

    Knowledge Base: /Products

    Transitions:
      - "Customer is ready to purchase" → Order Process
      - "Customer wants more options" → (loop back)
      - "Customer is not interested" → End Call
    ```
  </Accordion>

  <Accordion title="Legal Disclaimer">
    ```yaml theme={null}
    Mode: Static
    Message: |
      Before we proceed, I need to inform you that
      this call may be recorded for training and
      quality purposes. Do you consent to continue?

    Transitions:
      - "Customer agrees or says yes" → Main Conversation
      - "Customer disagrees or says no" → End Call
    ```
  </Accordion>
</AccordionGroup>

## Best Practices

<CardGroup cols={2}>
  <Card title="Single Responsibility" icon="bullseye">
    Each conversation node should handle one topic or task. Split complex flows into multiple nodes.
  </Card>

  <Card title="Clear Transitions" icon="signs-post">
    Write unambiguous conditions. "Customer wants help" is vague; "Customer asks about returns" is specific.
  </Card>

  <Card title="Test Thoroughly" icon="vial">
    Test each path through the node. Try edge cases and unexpected inputs.
  </Card>

  <Card title="Use Knowledge Base" icon="book">
    For factual information, use the knowledge base rather than hardcoding in prompts.
  </Card>
</CardGroup>

## Related

<CardGroup cols={2}>
  <Card title="Transitions" icon="arrow-right" href="/agent-builder/transitions">
    Deep dive into transition configuration
  </Card>

  <Card title="Knowledge Base" icon="database" href="/agent-config/knowledge-base">
    Set up your knowledge base
  </Card>

  <Card title="Data Extraction" icon="clipboard-list" href="/agent-builder/stages/data-extraction">
    Collect structured information
  </Card>

  <Card title="System Prompt" icon="terminal" href="/agent-config/system-prompt">
    Configure global AI behavior
  </Card>
</CardGroup>
