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

# Hand over between an agent and a flow

> Let an agent hand a conversation over to a flow for a scripted task, and let the flow hand the conversation back to the agent, using the Route to Flow tool and the Agents node.

> [!NOTE]
>
> **Intermediate** · 25 minutes · Cognigy

Let the agent Klara hand a conversation over to a flow, and let the flow hand the conversation back to Klara.

## What you will build

In this tutorial, you extend Klara, the customer service agent for the fictional company ACME Express. When a customer wants to change a delivery date, Klara hands the conversation over to a flow. The flow asks for the new date and confirms it. Then the flow hands the conversation back to Klara.

A handover in both directions has two parts:

| Direction | What you use | What it does |
| - | - | - |
| Agent to flow | **Route to Flow** tool | Lets the agent decide when to pass the conversation to a flow. You set which flow it goes to, the start message and how much history the flow receives. The agent can't change these. From then on, the flow handles every message from the customer until it hands the conversation back. |
| Flow to agent | **Agents** node | Passes the conversation from the flow back to an agent, with instructions for how the agent continues and the part of the conversation the agent sees. |

Use a flow for a scripted step that must run the same way every time, such as collecting a date, completing a form, or verifying an identity.

## Before you start

Before you start, make sure you have the following:

* The project **Klara Tutorial** with the agent Klara. To create them, follow [Build Klara, a customer service agent](https://docs.cognigy.com/tutorials/cognigy-ai/build-klara-customer-service-agent.md).
* The **Route to Flow** tool and the **Agents** node are turned on for the project. To turn them on, go to **Manage > Settings > Agent Settings** and turn on **Enable Route to Flow tool** and **Enable Agents node**. Both are off by default.

## Steps

**1. Create the flow**

1. In the left-side menu of the project, go to **Design > Flows**.
2. In the upper-right corner, click **New Flow**.
3. In the **Name** field, enter `Reschedule Delivery`.
4. Click **Create**. The flow chart opens with a **Start** node and an **End** node.

**2. Ask for the new date**

1. Click the plus icon below the **Start** node. In the search field, enter `Question` and select **Question**.

2. Click the **Question** node. The **Edit Node** panel opens.

3. From the **Question Type** list, select **Text**.

4. In the **Text** field, replace `Yes or No?` with the following text:

   ```text theme={null}
   Sure, I can help you reschedule. On which date would you like your delivery?
   ```

5. Click **Save Node**.

![The Edit Node panel of the Question node with the question type Text and the text asking for the delivery date.](https://mintcdn.com/cognigy-15abf2ba/E7J_TZl63DS6FFRh/_assets/tutorials/bidirectional-handover/question-node.webp?fit=max\&auto=format\&n=E7J_TZl63DS6FFRh\&q=85\&s=4853c6739ac0fc87252c2746fc7a73d3)

The **Question** node stores the answer from the customer in `input.result`.

**3. Confirm the date**

1. Click the plus icon below the **Question** node. In the search field, enter `Say` and select **Say**.

2. Click the **Say** node.

3. In the **Text** field, enter the following text:

   ```text theme={null}
   Done. Your delivery is rescheduled for {{input.result}}.
   ```

4. Click **Save Node**.

![The Edit Node panel of the Say node with the confirmation text that includes the input.result token.](https://mintcdn.com/cognigy-15abf2ba/E7J_TZl63DS6FFRh/_assets/tutorials/bidirectional-handover/say-node.webp?fit=max\&auto=format\&n=E7J_TZl63DS6FFRh\&q=85\&s=c0f149749bf8890a2ea67c6b3bc6137d)

In this tutorial, the flow doesn't change a real booking. In your own project, add a node here that calls your delivery system, such as an **HTTP Request** node.

**4. Hand the conversation back to the agent**

The flow ends after the **Say** node, but it still owns the conversation. Without a further step, the next message from the customer goes to the flow and starts it again from **Start**. To return the conversation to Klara, add an **Agents** node. The **Agents** node must be the last node in the flow. No node can follow it.

1. Click the plus icon below the **Say** node. Open the **AI** category and select **Agents**. On the flow chart, the node shows **Route to Agent**.

2. Click the node. In the **Agent** list, select **Klara**.

3. Turn on **Handoff Configurations**. The toggle is off by default. When you turn it on, the **Opening Instruction** and **Share Conversation History** fields appear.

4. In the **Opening Instruction** field, replace the default text, "Greet the user and briefly explain how you can help.", with the following text. Klara follows this instruction when the conversation returns to her.

   ```text theme={null}
   Confirm that the delivery date was changed, then ask if the customer needs anything else.
   ```

5. Keep **Share Conversation History** set to **Last exchange only**. Klara then sees everything from the customer's last message onward: the date and the flow's confirmation. This lets her confirm the date without asking again.

6. Click **Save Node**.

![The flow Reschedule Delivery with the nodes Question, Say, and Route to Agent, and the Edit Node panel with Klara selected and the opening instruction filled in.](https://mintcdn.com/cognigy-15abf2ba/E7J_TZl63DS6FFRh/_assets/tutorials/bidirectional-handover/route-to-agent-node.webp?fit=max\&auto=format\&n=E7J_TZl63DS6FFRh\&q=85\&s=ef3a038b838c871fdfbb494c6da08d2a)

**5. Add the route to flow tool**

Add the tool that lets Klara start the flow.

1. Go to **Design > Agent** and open **Klara**.

2. Go to the **Tools** tab and click **Add tool**.

3. On the **System tools** tab, select **Route to Flow**.

4. In the **Name** field, enter `Reschedule Delivery`.

5. In the **Description** field, replace the text with the following text. Klara reads the description to decide when to call the tool.

   ```text theme={null}
   Hands the conversation to the Reschedule Delivery flow. Call this when the customer wants to change the delivery date. The flow collects the new date and then returns the conversation to the agent.
   ```

6. From the **Select flow** list, select **Reschedule Delivery**.

**6. Configure the handover**

Continue on the same page:

1. Under **Handoff message**, keep **AI filled**. Klara then writes the sentence that she says before the handover.
2. In the **Flow start message** field, enter `Reschedule my delivery`. Cognigy sends this text to the flow as its first input, so the flow responds right away instead of waiting for the customer to type.
3. Under **History mode**, keep **None**. The flow then receives none of the earlier conversation. It doesn't need any, because it asks for the date itself. The other options are **Last turn**, **AI-generated summary**, and **Full conversation**.
4. Click **Save**. The tool appears on the **Tools** tab as a direct tool.

![The Edit tool page for the Route to Flow tool with the flow Reschedule Delivery selected, the handoff message set to AI filled, the flow start message, and the history mode None.](https://mintcdn.com/cognigy-15abf2ba/E7J_TZl63DS6FFRh/_assets/tutorials/bidirectional-handover/route-to-flow-tool.webp?fit=max\&auto=format\&n=E7J_TZl63DS6FFRh\&q=85\&s=49b3eb375f412627c2c0e28edff15a58)

**7. Test the round trip**

1. In the upper-right corner, click the chat icon to open the Interaction Panel.
2. Select **Chat**.
3. Enter `Hi, I need to change the delivery date of my parcel.` Klara says a short transition line that she writes herself, for example, "Sure, let me take you to our rescheduling process." Then the flow asks "Sure, I can help you reschedule. On which date would you like your delivery?"
4. Enter `2026-11-13`. The flow answers "Done. Your delivery is rescheduled for 2026-11-13."
5. Klara takes the conversation back right away, in the same turn, and follows the opening instruction, for example, "Your delivery date has been changed to November 13, 2026. Is there anything else I can help you with?"

![An animation of the Interaction Panel. The customer asks to change the delivery date, the flow asks for a date, the customer enters 2026-11-13, the flow confirms it, and Klara confirms the change and asks if the customer needs anything else.](https://mintcdn.com/cognigy-15abf2ba/E7J_TZl63DS6FFRh/_assets/tutorials/bidirectional-handover/handover-round-trip.webp?fit=max\&auto=format\&n=E7J_TZl63DS6FFRh\&q=85\&s=4d0d85e85f8295ba744ddce312015782)

## What you built

You created a flow that collects a delivery date and a **Route to Flow** tool that lets Klara hand a conversation over to it. You added an **Agents** node at the end of the flow that hands the conversation back to Klara with an opening instruction. You tested the round trip in the Interaction Panel.

From the moment the agent calls **Route to Flow** until the flow reaches the **Agents** node, the flow owns the conversation. You can use the same pattern for any scripted step, such as verifying an identity or completing a form.

## More information

* [Build Klara, a customer service agent](https://docs.cognigy.com/tutorials/cognigy-ai/build-klara-customer-service-agent.md)
* [Add tools with Functions](https://docs.cognigy.com/tutorials/cognigy-ai/add-tools-with-functions.md)
