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

# Main Flows

> The Main Flow is the entry point for every conversation. It defines the primary path your assistant follows from the moment a call connects until it ends.

## What is the Main Flow?

Every Script has exactly one Main Flow. When a call starts:

1. The Script is loaded
2. The Main Flow is identified via the Script's `main_flow_id`
3. The assistant begins execution at step 0 of the Main Flow
4. The conversation continues until an end condition is reached

***

## Main Flow Structure

A Main Flow contains an ordered sequence of steps, each step can branch to other steps or sub-flows based on conditions.

***

## Starting the Conversation

The first step of the Main Flow handles the opening message:

**Outbound Calls:**

* The assistant may wait briefly for the caller to speak
* Example: "Hi, this is Sarah from Voxworks."

**Inbound Calls:**

* The assistant speaks first with a greeting
* Example: "Thank you for calling Voxworks. How can I help you today?"

***

## Flow Navigation

From any voice step, conditions determine where to go next:

| Condition Type     | Description                                 | Example                             |
| ------------------ | ------------------------------------------- | ----------------------------------- |
| **Specific match** | User response matches a defined scenario    | "User wants to book" → Booking step |
| **Otherwise**      | Fallback when no specific condition matches | Clarification step                  |

***

## Knowledge Base and Guidelines

When a user asks a question or raises a topic during the conversation, the assistant checks the [Knowledge Base](/scripts/knowledge-base) and [Guidelines](/scripts/guidelines) for relevant information.

If the assistant has information to respond:

1. The assistant answers the question using available knowledge
2. The conversation **stays on the current step**
3. The assistant continues with the current step's objective

This allows the assistant to handle ad-hoc questions without derailing the flow. For example:

```text theme={null}
Step: "Would you like to schedule a demo?"

User: "How much does it cost?"

→ Assistant answers from Knowledge Base: "We offer flexible pricing
  on a cents per minute basis. Would you like to schedule a demo
  to discuss your specific needs?"

→ Conversation remains on the same step, waiting for demo response
```

If the assistant doesn't have relevant information, it follows the [Guidelines](/scripts/guidelines) for handling unknown questions (e.g., offering to follow up later).

***

## Ending the Conversation

The Main Flow ends when:

1. **End condition reached** — A step's condition has `end_flow: success or fail`
2. **User hangs up** — The participant disconnects
3. **Maximum duration** — The configured time limit is reached
4. **Assistant hangup** — The assistant determines the call should end

When the Main Flow ends, the call terminates.

***

## Main Flow vs Sub-Flows

| Aspect          | Main Flow               | Sub-Flow                     |
| --------------- | ----------------------- | ---------------------------- |
| **Entry**       | Automatic at call start | Invoked by a Flow step       |
| **Exit**        | Ends the call           | Returns to parent flow       |
| **Required**    | One per Script          | Optional, unlimited          |
| **Reusability** | Specific to Script      | Can be shared across Scripts |

### Maximising Reusability

While the Main Flow is specific to each Script, you can maximise reusability by keeping it minimal:

1. **Opening message** — Greet the caller
2. **Flow step** — Route immediately to a reusable sub-flow
3. **Closing messages** — Handle success and failure outcomes from the sub-flow

This pattern lets you reuse the core conversation logic across multiple Scripts, with only the opening and closing messages varying per Script.

***

## Interrupts

During a conversation, users may interrupt the assistant while it is speaking. How interrupts are handled depends on the step type:

| Step Type    | Interruptible | Behaviour                                                                   |
| ------------ | ------------- | --------------------------------------------------------------------------- |
| **Voice**    | Yes (default) | User can interrupt; assistant stops speaking and processes the interruption |
| **Tool**     | No            | User cannot interrupt while the tool executes                               |
| **Function** | No            | User cannot interrupt while the function executes                           |

Voice steps can be configured to disable interrupts using the `interruptible: false` setting when you need the assistant to complete critical information without being cut off.

For more on interrupt handling limitations, see [Assistant Behaviour](/conversation-dynamics/assistant-behaviour).

***

## Best Practices

1. **Start with a clear opening** — Set expectations immediately
2. **Keep the main path simple** — Use sub-flows for complex branches
3. **Handle common objections** — Include conditions for typical responses
4. **Plan your exit points** — Define clear end conditions
5. **Test the full journey** — Walk through every possible path

***

## Next Steps

* [Sub-Flows](/flows/flows-sub) — Create reusable conversation modules
* [Voice Steps](/flows/steps-voice) — Design interactive conversation turns
* [Steps Overview](/flows/steps) — Learn about all step types
