# Deploy an AI Agent

Once you have set up an AI Agent, you can deploy it using Flows. This will allow your customers to interact with your AI Agent.

### Step one: Set up a flow with a trigger

1. Click your name in the bottom left-hand corner of your screen, then click **Manage integrations**.
2. Click **Flows** in the top right-hand corner of your screen.
3. Click **New flow** > **Create from scratch**.
4. Give your flow a name.
5. Under 'Trigger', select **Conversation**.
6. Select the channel that you want your AI Agent to run on.
7. Under 'Select a trigger event', select **Conversation created** from the drop-down.
8. The 'Participant type' should be **Contact**.
9. **Save** the trigger configuration.
10. Send a test message to the channel, and click **Update test data** to pull it in.
11. Click **Save**.

### Step two: Set up the flow action

1. Click **Add new action**.
2. Under 'Select an action', click **LLM Bot**.
3. Select **Create a new conversation to process with an LLM bot**.
4. In the 'Agent Id' field, click and select the name of your AI Agent.
5. Click **Next**.
6. Click **Run test**.
7. In the top right-hand corner of your flow, click **Save draft**.

### Step three: Check the conversation and send a new test message

1. Return to the **Settings** page by clicking the your name in the bottom left-hand corner, then clicking **Settings**.
2. Go to **AI** > **Actions** > **AI Agents**.
3. Click the three dots on the right-hand side of your AI Agent, then click **Chats**.
4. You'll be able to see a list of the chats that you AI Agent has had, including it's response to the test message you sent earlier.
5. Click the three dots on the right-hand side of the latest chat, then click **View**.
6. Here you will be able to see how the AI Agent handled your message.
7. Send another message to your channel, this time asking the AI Agent to connect you to a human agent. The AI Agent should handle this with a response, which will be visible in the 'chat' view, and on the back end will handover to a human agent.
8. Return to the flow that you saved as a draft.

### Step four: Configure 'handover' and 'resolved' branches

1. Under the **Create a new conversation to process with an LLM bot** action, check the test output. You should be able to see the following: `"status": "handover"`.
2. Click **Add new action**.
3. Under 'Select an action', click **Conditional**.
4. Give 'Branch A' the name 'Human handover'.
5. Click the curly brackets in the 'Variable' field, and find the correct variable by clicking **Steps** > **Create a new conversation to process with an LLM bot** > **event** > **llmBotChat** > **status**. The variable you are looking for will look something like `status: handover`.
6. From the 'Select operator' dropdown, `select (String) equals`.
7. Click the the 'Value' field, and enter the text `handover`.
8. Give 'Branch B' the name 'Resolved'.
9. Click the curly brackets in the 'Variable' field, and find the correct variable by clicking **Steps** > **Create a new conversation to process with an LLM bot** > **event** > **llmBotChat** > **status**. The variable you are looking for will look something like `status: handover`.
10. From the 'Select operator' dropdown, `select (String) equals`.
11. Click the the 'Value' field, and enter the text `resolved`.
12. Click **Next.**&#x20;
13. Click **Run test** and check the response.
14. Within the 'Human Handover' branch, click **Add new action**.
15. Select **Assign Agent to Inbox**.
16. Click **Next**.
17. Within the 'Resolved' branch, click **Add new action**.
18. Select **Terminate**.
19. Select **Success** as the operation.
20. In the 'Reason' field, enter 'No human needed'.

### Step five: Terminate the flow

1. Add a final action by clicking **Add new action**.
2. Select **Terminate**.
3. Select **Fail**.
4. In the 'Reason' field, click the curly brackets in the 'Variable' field, and find the correct variable by clicking **Steps** > **Create a new conversation to process with an LLM bot** > **event** > **llmBotChat** > **status**. The variable you are looking for will look something like `status: handover`.
5. **Save** the step.
6. &#x20;**Publish** your flow.&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bird.com/applications/ai-features/ai-agents/how-to/deploy-an-ai-agent.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
