# A.I. Agents - Responding to the Message That Opened the Conversation

## Prerequisites

To allow the agent to start by responding to the lead's message, some conditions must be met. They are:

1. The option "**Greet the lead?**" must be active, causing the A.I. to send a message as soon as it is triggered;
2. The agent must have been initialized via a Chatbot, with the trigger "**The lead opens a new conversation**";
3. The block "**AI Agent**" being the first in the Chatbot.

<figure><img src="/files/03e82a4087f01f2f1a1818fd6fcff3955dd69471" alt=""><figcaption><p><em>1 - Enabling "Greet the lead?".</em></p></figcaption></figure>

<figure><img src="/files/7a8813758eaea4029902e47e60912bce6940088e" alt=""><figcaption><p><em>2 - Configuring the trigger.</em></p></figcaption></figure>

<figure><img src="/files/bc681bc695296d25064350c92d2fe5d5cee83ccc" alt=""><figcaption><p><em>2 - Configuring the trigger.</em></p></figcaption></figure>

<figure><img src="/files/207145fedaa2718c89f90be344c2492fce084fec" alt=""><figcaption><p><em>3 - Adding the block in the Builder.</em></p></figcaption></figure>

## Testing the Agent

This trigger will activate the Chatbot and, consequently, the A.I. agent, as soon as the lead contacts through the channel and account defined in the trigger, provided there is no active conversation.

An important consideration about initializing the agent is that, with the option **"Use previous messages"** enabled, it will also take into account messages sent in past conversations, which provides greater accuracy in responses.

<figure><img src="/files/f2d32effa9986a91c32de610a15213a7b4d981b7" alt=""><figcaption><p><em>Testing agent.</em></p></figcaption></figure>


---

# 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.sprinthub.com/en/topics/artificial-intelligence/ai-agents/ai-agents-responding-to-the-message-that-opened-the-conversation.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.
