> For the complete documentation index, see [llms.txt](https://docs.sprinthub.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sprinthub.com/en/topics/artificial-intelligence/ai-agents/ai-agents-execute-automations.md).

# AI Agents - Execute Automations

Using the AI agent to execute automations intelligently.

## Activating the capability and creating an automation

To use AI automations, it is necessary to enable it and create a new one on the automations overview screen. Once enabled, the 'Agent Conditions' will be checked with every lead message.

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2FYry7zcn0L7FuLDQjUxue%2F1.png?alt=media&amp;token=ba54c36c-a3cc-49c0-9438-cd9b4799348f" alt=""><figcaption><p><em>Run Automations capability.</em></p></figcaption></figure>

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2Ft0DdnUWYGQw3tkolWqYc%2F2.png?alt=media&amp;token=5c51c7ac-81e6-4a9e-b431-ef3c96a2f193" alt=""><figcaption><p><em>Automations screen.</em></p></figcaption></figure>

## Configuring - Initial Data

The initial data filled in will be visible on the automations screen and are fundamental to the process working properly. Both the 'Name' field and the 'Automation Description' — especially the latter — should clearly indicate the purpose of the automation so that the agent understands exactly what will be executed.

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2Fn1zHZnShcDRN4VWmhz3M%2F3.png?alt=media&amp;token=f3fbe875-0678-435b-97d7-a54c979240f1" alt=""><figcaption><p><em>Initial Data.</em></p></figcaption></figure>

## Configuring - Conditions and Actions

1. Agent Condition: Checks when the lead sends a message that matches the defined condition, considering both the context of the current conversation and the lead fields accessible by the AI. If the check is considered true, it will proceed to 'Automation Conditions', if any exist.
2. Automation Conditions: These are additional checks. If the combination of conditions is true, the actions will be executed.
3. Automation Actions: The actions within Sprinthub that will be executed.

In this example, it will be checked whether the lead showed interest in joining the Offers Club of a bookstore. If they express interest and have a registered email, an opportunity will be created for them in the 'Offers Club' pipeline.

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2Fp1NV6oip3PKUYObNqskV%2F4.png?alt=media&amp;token=d2ed8404-6a67-4b22-9821-9c206dddb5cf" alt=""><figcaption><p><em>Conditions and Actions.</em></p></figcaption></figure>

## Configuring - Action Repetition

For this automation, the option 'Only one trigger per conversation?' was enabled, ensuring that the action is not repeated during the same interaction. The option 'Keep checking conditions until they are met?' ensures that, even if the lead does not meet the 'Automation Conditions' on the first attempt, the AI can perform new checks as soon as they go through the 'Agent Conditions' again.

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2FPfPOcFTvF3cTKWpbyz9t%2F5.png?alt=media&amp;token=4189bc6e-0fef-41cd-b125-229de705deb5" alt=""><figcaption><p><em>Action Repetitions.</em></p></figcaption></figure>

## Adapting the training and rules for the automation

It is important that the AI agent is aware that the company works with an Offers Club system, so that it correctly understands the automation and knows how to tell the lead whether or not this club exists.

It is also recommended, in the additional rules, to configure a notice to the lead informing them that they have been registered, if they request enrollment. In this way, in addition to the automation creating the opportunity, we ensure that the lead has been properly notified about their registration.

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2FX8JvTn2awGafH6Tw0UUr%2Fimage.png?alt=media&amp;token=f660d315-2e5a-4a24-8f9b-0247a178e6a7" alt=""><figcaption><p><em>Contextualization.</em></p></figcaption></figure>

## Testing the automation

Finally, during the conversation with the lead, the agent informed them about the possibility of enrollment. When the lead showed interest, they received a confirmation message. The execution of the 'Create Opportunity' action can be verified in the history.

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2F7oSS1023nHtKVEYGC0X6%2F6.png?alt=media&amp;token=d939bfb4-39f2-4fdc-9b10-b60389177a38" alt=""><figcaption><p><em>Customer service with the lead.</em></p></figcaption></figure>

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2FEeAAyGygmPMjE5NPbDA1%2F7.png?alt=media&amp;token=b6ff99b2-4bff-41a2-9f95-4ac0dc89e476" alt=""><figcaption><p><em>Lead history.</em></p></figcaption></figure>
