# Chat as a Trigger

Chat as a Trigger enables you to start workflows through natural conversation, creating interactive AI agents that respond to your messages in real-time. Instead of manually running workflows or waiting for scheduled triggers, you can interact with your automations through simple chat messages.

When you deploy a workflow with Chat as a Trigger, a **Chat History** panel appears in your workflow builder. You send a message, your workflow executes using that message as input, and results from the final function appear as the chat response. This makes complex automation as simple as having a conversation.

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

***

### Setting Up Chat as a Trigger

Setting up conversational workflows is straightforward. First, add a Trigger function to your workflow and select **"Chat Trigger"** from the options. Then build your workflow by connecting any functions you want after the Chat Trigger - AI Agents, Read functions, Transform functions, or any other automation steps.

The key is ensuring your chat message data flows to functions that need it. For AI Agents, connect the chat trigger output to the "Chat" field in your AI Agent's prompt. For other functions, reference the chat trigger output as a variable wherever you need the user's message content.

Once you deploy your workflow, you can start chatting immediately using the Chat History panel that appears on the right side of your builder.

***

### Memory Configuration

Memory allows AI Agents to remember previous conversations rather than treating each message as completely new. This creates much more natural, contextual interactions where the AI can reference earlier parts of your conversation.

Memory is configured within your **AI Agent** function, not the Chat Trigger itself. Simply toggle "Enable Memory" to ON and set how many previous messages to retain (starting with 5 is usually good). The AI will remember both your messages and its own responses, plus any data it retrieved from tools or other functions.

Remember that memory resets when you redeploy your workflow, and higher message counts use more processing power per conversation.

***

### Example Use Cases

#### AI Research Assistant

Create an AI agent with access to market data through MCP tools like CoinGecko or The Graph. Users can ask questions like "What's Bitcoin's performance this week?" and get real-time analysis with current market information.

**Workflow Structure:**

1. **Chat Trigger** - Receives your messages or requests
2. **AI Agent** - Understands the message and replies to you or uses any tools connected to it

#### Wallet Balance Reporting Tool

Build a personal wallet analyzer where users send messages like "Check my wallet balance on Ethereum: 0x123..." The workflow parses this message to extract the wallet address and blockchain, fetches current balance data, then returns a formatted summary of holdings and values.

**Workflow Structure:**

1. **Chat Trigger** - Receives user message with wallet address and chain
2. **AI Agent** - Parses message and extracts wallet address + blockchain
3. **Read Wallet Balance** - Fetches current wallet balance data
4. **AI Agent** - Summarizes wallet data into a readable response


---

# 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.k3-labs.com/introduction/automate/trigger-set-up/chat-as-a-trigger.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.
