# Setting up an Agent

When creating your AI, the most important step is the agent itself. This is essentially the brain of the AI, where it's told who it is, what it's job is, and knowledge sources it can access. To get started with creating your agent, first navigate to the "Agents" tab in the portal, then click "Add new". You will then be prompted to name the agent so that you can keep track of it easier, and potentially import the settings for it from a different, pre-existing agent.

<figure><img src="/files/dyUJPe75nsGw7WqGUSFl" alt=""><figcaption></figcaption></figure>

After naming the agent, you'll see a screen where you can add functionality to it, such as calendars for it to use, the prompt for the bot to listen to, and more!

<figure><img src="/files/qnxbXTrT5NEU5x4RXp56" alt=""><figcaption></figcaption></figure>

The first thing to do here is add the AI provider. Click the "Edit" button to the right, and then under "Model", choose the OpenAI model that you'd like your bot to use!

<figure><img src="/files/coEjAajNQKkQgAzQXckV" alt=""><figcaption></figcaption></figure>

After that, select the OpenAI key/account that you'd like to use. If you haven't already set this up, you'll be prompted to add a new key here!

<figure><img src="/files/R8TqVYPdnrRkzWOZPCWp" alt=""><figcaption></figcaption></figure>

Next, it's time to add a prompt to your agent. This is essentially the brain of the bot, where you tell it exactly what you want it to do, when it should do it, who it is, etc. For more information on how you can design your prompt, you can check out our [prompt design section](/prompt-design/creating-prompts.md) of this help doc!

<figure><img src="/files/fOWLYaEOL5UOJn7T1MS8" alt=""><figcaption></figcaption></figure>

Finally, the last thing to do is to set up any actions you want the bot to have the capacity to do! This can be things like access a calendar, read from a website or spreadsheet, or add custom tags to a contact under certain conditions! First, you have to choose the "Provider" for the action. This is where you'll choose "GHL Channel", for things like adding tags, "GHL Calendar" for accessing said calendars, "Google Sheets" for any information spreadsheets you have set up, or "Website" for any websites that you have integrated with!&#x20;

For each action, you will be able to describe to the AI when you'd like it to perform that action, such as checking a specific spreadsheet whenever a contact asks for certain information, or to check a calendar whenever the contact asks to book an appointment. You can also, under "Advanced settings" specify if you'd like an action to use a different AI model or OpenAI key than the default one for the agent!

<figure><img src="/files/Wky2uDFRRXdo2OTsNvGf" alt=""><figcaption></figcaption></figure>

Once you've gotten the agent set up and you've tested it in the emulator to confirm it works the way you'd like, remember to change the agent to "Active" in the top right!

<figure><img src="/files/gSStvC8xYWeqODucYudg" alt=""><figcaption></figcaption></figure>

After the agent is active and you're ready to use it, next you need to get the agent ID from the URL at the top of the screen. This will be a series of numbers at the end!

<figure><img src="/files/ZNOuMsHE1kr4wTbILCTw" alt=""><figcaption></figcaption></figure>

This will be the value that you use inside of the webhook that you have set up in GHL!


---

# 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://help.capriai.us/capri-portal/setting-up-an-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.
