> ## 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.

# Stage Builder

> AI-assisted flow building with natural language

The Stage Builder is an AI-powered assistant that helps you create and modify flows using natural language. Describe what you want, and the AI suggests nodes, connections, and configurations.

## Overview

Instead of manually dragging nodes and configuring settings, you can:

* Describe your flow in plain language
* Get AI-generated node suggestions
* Receive configuration recommendations
* Iterate quickly with conversational feedback

## Accessing Stage Builder

In the Flow Builder:

1. Click the **AI Chat** icon in the left sidebar
2. The Stage Builder panel opens
3. Type your request in the chat input

## Using Stage Builder

### Starting a New Flow

Describe what you want your agent to do:

```
User: I need an agent that handles appointment scheduling.
      It should greet the caller, collect their name and
      preferred date, check availability, and book the appointment.

AI: I'll help you create an appointment booking flow. Here's what I suggest:

    1. Start Node - Greeting the caller
    2. Data Extraction - Collect name and preferred date
    3. Calendar Booking - Check availability and book
    4. End Call - Confirm the booking

    Should I create these nodes for you?
```

### Modifying Existing Flows

Ask for changes to your current flow:

```
User: Add a human transfer option if the customer asks to
      speak with a person.

AI: I'll add a Human Transfer node. Where should the transition
    from? The main Conversation node?
```

### Getting Suggestions

Ask for advice on flow design:

```
User: What's the best way to handle customers who don't
      have their order number?

AI: You could:
    1. Offer to look up by email address
    2. Ask for phone number used for the order
    3. Transfer to a human agent

    Want me to add an alternative lookup path?
```

## Example Conversations

<AccordionGroup>
  <Accordion title="Building a Support Flow">
    ```
    User: Create a customer support agent for a software company.

    AI: I'll create a support flow. Here's the structure:

        Start → Greeting
        ↓
        Conversation → Main Support Handler
        (with transitions for):
        - Technical issues → Tech Support node
        - Billing questions → Billing node
        - Human transfer → Transfer node
        - End conversation → End Call

        I'll also suggest:
        - Knowledge base for product docs
        - Data extraction for ticket number
        - Sentiment-based escalation

        Should I build this?
    ```
  </Accordion>

  <Accordion title="Adding Branching Logic">
    ```
    User: After collecting the issue type, I want to route
          technical issues differently from billing issues.

    AI: I'll add an If/Else node after your Data Extraction:

        Data Extraction
        ↓
        If/Else
        ├── issue_type == "technical" → Tech Support
        ├── issue_type == "billing" → Billing Support
        └── Default → General Support

        Creating these nodes now...
    ```
  </Accordion>

  <Accordion title="Optimizing Prompts">
    ```
    User: Can you improve the prompt for my main conversation node?

    AI: Looking at your current prompt, I suggest:

        Current:
        "Help customers with questions"

        Improved:
        "You are a customer support specialist for Acme Software.

        - Answer questions about our products
        - Help troubleshoot common issues
        - Look up information in the knowledge base
        - If you can't resolve the issue, offer to transfer

        Stay friendly, concise, and solution-focused."

        Should I apply this update?
    ```
  </Accordion>
</AccordionGroup>

## Capabilities

The Stage Builder can:

| Action                   | Description                         |
| ------------------------ | ----------------------------------- |
| **Create nodes**         | Add new stages to your flow         |
| **Configure nodes**      | Set prompts, variables, transitions |
| **Connect nodes**        | Create edges between stages         |
| **Suggest improvements** | Recommend better configurations     |
| **Explain concepts**     | Clarify how features work           |
| **Debug flows**          | Help identify issues                |

## Tips for Effective Use

<CardGroup cols={2}>
  <Card title="Be Specific" icon="bullseye">
    "Add a node that collects the customer's order number and validates it's in format XX-123456"
  </Card>

  <Card title="Provide Context" icon="info">
    "This is for a restaurant reservation system where we need table size and time preference"
  </Card>

  <Card title="Iterate" icon="arrows-rotate">
    "That's good, but also add a fallback if they don't have a reservation"
  </Card>

  <Card title="Ask Questions" icon="circle-question">
    "What's the best way to handle callers who are upset?"
  </Card>
</CardGroup>

## Starting Fresh

Click **New Chat** to reset the conversation. This:

* Clears previous context
* Starts a fresh assistant session
* Does not affect your flow (unsaved suggestions are lost)

## Best Practices

<AccordionGroup>
  <Accordion title="Start with an outline">
    Describe the overall flow before diving into details. This gives the AI context for better suggestions.
  </Accordion>

  <Accordion title="Review suggestions carefully">
    The AI provides good starting points, but always review and adjust to match your exact needs.
  </Accordion>

  <Accordion title="Use it for iteration">
    Stage Builder is great for rapid prototyping. Build quickly, then refine manually.
  </Accordion>

  <Accordion title="Combine with manual editing">
    Use AI for the initial structure, then fine-tune with direct node editing.
  </Accordion>
</AccordionGroup>

## Related

<CardGroup cols={2}>
  <Card title="Flow Canvas" icon="diagram-project" href="/agent-builder/flow-canvas">
    Manual flow building
  </Card>

  <Card title="Conversation Stage" icon="comments" href="/agent-builder/stages/conversation">
    Configure conversation nodes
  </Card>

  <Card title="Quick Start" icon="rocket" href="/quickstart">
    Build your first agent
  </Card>
</CardGroup>
