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

# Pre-call and Post-call Flows

> Run logic before the agent connects and after the caller hangs up

Every agent has two special built-in flows that run outside the conversation itself: a **Start** flow that runs before the agent begins talking to the caller, and an **End** flow that runs after the call is over. These flows let you prepare context before the conversation and handle follow-up tasks after it ends.

You can find both flows in the flow picker at the top of the editor, labeled **Start** and **End**, alongside your Main Flow and any logic flows you have created. You do not need to create them; they already exist by default on every agent.

![Flow menu with Main Flow, Start, and End](https://mintcdn.com/devpro-38b0cd42/hdbCFLBnzC5gA6Ir/images/configure/editor-flows.jpg?fit=max\&auto=format\&n=hdbCFLBnzC5gA6Ir\&q=85\&s=d5ecad1be635714564739b58d914f2e6)

Flow picker on the agent editor. Main Flow, Start, and End.

## Pre-call: the Start flow

The Start flow runs before the caller and the agent begin their conversation. Use it to look up information ahead of time so the agent already knows who it is talking to when the first message is spoken.

Common uses include:

* **Caller identification.** Use a Webhook node to perform a DID (phone number) lookup on `{{caller}}`. If the lookup returns the caller's name, the agent can greet them personally in its opening message.
* **Account pre-loading.** Call your CRM or billing API to fetch the caller's account details (policy status, balance, open tickets). The agent can then reference this information throughout the call without asking the caller to repeat it.

### Leaf nodes become context

A key concept in the Start flow is the **leaf node**. A leaf node is any node that has no outgoing edge, meaning nothing is connected after it. When the Start flow finishes, the platform automatically takes the output of every leaf node and adds it to the agent's context. This means the agent can read and reference that data during the conversation.

For example, if you place a Webhook node that calls your CRM and that node is a leaf (nothing connected after it), the entire JSON response body becomes part of the agent's context. You could then write in the agent's prompt: "Check whether the caller's policy is current," and the agent would be reading the actual CRM data rather than guessing.

**Important:** If you connect another node after a Webhook or Integration, that node is no longer a leaf, and its response will not be included in the agent's context. If you need the response data but also need the flow to continue past that node, write the specific fields you need into variables using a Set Variables or Transform node instead. Variables are always available to the agent regardless of leaf status.

![Start flow canvas with the logic node list including Dispatch, DTMF, SIP message, and Enhance transcription](https://mintcdn.com/devpro-38b0cd42/hdbCFLBnzC5gA6Ir/images/configure/editor-start-nodes.jpg?fit=max\&auto=format\&n=hdbCFLBnzC5gA6Ir\&q=85\&s=fde8a84f9baff4456d3b6ccd17854075)

Start flow node list. Dispatch, DTMF, SIP message, and Enhance transcription sit with the other logic nodes.

> [!WARNING]
>
> Only leaf nodes are copied into context. If a lookup continues into a Condition or Transform, it is no longer a leaf and its raw response is not exposed as context. To preserve specific fields when the graph continues past that node, write them into variables using a Set Variables or Transform node instead.

## Post-call: the End flow

The End flow runs after the call is over, either because the caller hung up or because the agent ended the call. It does not run while the caller is still on the line. This makes it the right place for follow-up tasks that should happen after the conversation, such as sending a confirmation email, inserting a record into your CRM, updating a support ticket, or running transcript enhancement.

> [!NOTE]
>
> Start and End flows do not run for the web widget. Because a widget chat session can stay open indefinitely, there is no "call started" or "hangup" event to trigger them.

### Post-call variables

By the time the End flow runs, the platform makes two special variables available that contain information about the completed call.

| Variable | What it contains | When it is available |
| - | - | - |
| `{{transcript_json}}` | The full text transcript of the call. If you have an [Enhance transcription](https://docs.vatel.ai/configure/editor/transcript-enhancement.md) node earlier in the End flow, this value reflects the corrected version of the transcript rather than the raw one. | Always available in the End flow. |
| `{{call_summary}}` | An automatically generated summary of the call. If Enhance transcription ran first, the summary is based on the corrected transcript. | Only populated when you have enabled the summary feature in the **Analysis** tab of agent settings. The summary text matches what you see when you open the call in the analytics panel. If the summary is not enabled, this variable will be empty. |

You can use these variables in any node within the End flow. For example, you might pass `{{transcript_json}}` to a Webhook that stores call records in your data warehouse, or include `{{call_summary}}` in an email notification to a manager.

### Building the End flow

The End flow uses the same graph editor as the Start flow. Open it from the flow picker by selecting **End**. Nodes like Enhance transcription, email integrations, CRM integrations, and Webhooks are especially well suited here, since they run after the caller is gone and will not introduce any delay into the live conversation.

## How Start and End flows differ from logic flows

Logic flows that you create yourself are tools the agent can choose to invoke during a live conversation. The agent decides when to call them based on the dialogue.

Start and End flows are different. They run automatically at fixed points in the call lifecycle: Start runs before the conversation begins, and End runs after the call is over. The agent does not choose to invoke them, and they cannot be called manually.

Because there is no live call during the Start or End flow, some nodes behave differently. For example, the Dispatch node is limited to **Dial** only in these flows. Attended transfer (where the agent stays on the line during a handoff) requires an active call, which does not exist yet in the Start flow or any longer in the End flow.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.