# Build an AI Chat Agent in Autom8 AI

In this hands-on guide, you’ll build your first AI-powered **chat agent** using Autom8 AI. Whether you're new or experienced, this tutorial introduces the building blocks of AI workflows, step-by-step.

***

#### 🔧 What You’ll Need

* **Autom8 AI Account**\
  We recommend using the cloud version (free trial available). Self-hosted users can follow along too.
* **Chat Model Credentials**\
  We’ll use **OpenAI** in this example, but you can also use Gemini, Groq, DeepSeek, Azure, and others.

***

#### 📚 What You’ll Learn

* How to use the **AI Agent** node
* How to connect a **Chat Model**
* How to handle user input and memory
* How to customize the system prompt
* How to persist conversations

***

### ✅ Step-by-Step Guide

***

#### **Step 1: Create a New Workflow**

1. Log in to Autom8 AI
2. From the dashboard, click **Create Workflow**
3. Start with a blank canvas

***

#### **Step 2: Add a Chat Trigger**

1. Click **Add First Step** or press **Tab**
2. Search for **Chat Trigger**
3. Add it to the canvas
4. This node will handle incoming chat messages

***

#### **Step 3: Add an AI Agent Node**

1. Click the connector on the Chat Trigger node
2. Search for **AI Agent** and select it
3. The agent node will process incoming chat messages with AI

***

#### **Step 4: Connect a Chat Model**

1. On the AI Agent node, click **Add Chat Model**
2. Select **OpenAI Chat Model**
3. In the node editor, choose a model (e.g., `gpt-4o-mini`)
4. If prompted, **add your API key** under **Credentials**

> You can get your OpenAI API key from <https://platform.openai.com>

***

#### **Step 5: Test the Chat**

1. Click the **Chat** button on the canvas
2. Send a message
3. The AI should respond in real time
4. The logs on the right show the inputs and outputs

***

#### **Step 6: Customize the Prompt**

1. Open the **AI Agent** node
2. Under **Options**, add **System Message**
3. Change the prompt—for example:\
   \&#xNAN;*“You are a witty assistant who always replies in haiku.”*
4. Save and test again—you’ll see the AI’s tone change!

***

#### **Step 7: Add Memory for Context**

By default, the AI doesn’t remember past messages. Let’s fix that:

1. On the AI Agent node, click **Add Memory**
2. Choose **Simple Memory**
3. Set it to store up to **5 interactions**
4. Now, test again—say “My name is Sam”
5. Then ask “What’s my name?” The AI will remember it

***

#### **Step 8: Save Your Workflow**

Don’t lose your progress!

* Click **Save** in the top right
* Your chat agent is now ready for future improvements

***

#### 🎉 Congratulations!

You've built your first AI chatbot workflow with:

* A **chat trigger** to receive input
* An **AI agent** to process and respond
* A **chat model** like OpenAI for intelligent replies
* **Custom prompts** to shape behavior
* **Memory** for context retention

***

#### 🔍 What’s Next?

* Add a webhook to deploy your chat externally
* Connect it to Slack, Telegram, or Discord
* Enhance it with file uploads or multimodal input
* Use workflows to turn the AI into a personal assistant, support bot, or creative companion
