AI Agent Workflow
Create an intelligent AI agent that remembers conversation history and can use tools.What You’ll Build
A chatbot that:- Maintains conversation context across messages
- Uses an AI model (OpenAI, Claude, or Gemini)
- Responds via webhook
Prerequisites
- MachinaOs running locally
- An AI provider API key (OpenAI, Anthropic, or Google)
Step 1: Add the AI Agent
- Drag AI Agent from the AI Agents category
- This is the core of your intelligent assistant
- Main Input (left) - Receives the user prompt
- Memory Input (bottom-left diamond) - Connects to memory nodes
- Model Input (top) - Optional model override
Step 2: Connect a Chat Model
- Drag OpenAI Chat Model (or Claude/Gemini) onto the canvas
- Connect it to the AI Agent’s model input (top handle)
- Configure the model:
Step 3: Add Conversation Memory
- Drag Simple Memory from AI Agents
- Connect it to the AI Agent’s memory input (bottom-left diamond handle)
- Configure:
Memory Types
| Type | Description |
|---|---|
| Buffer | Keeps all messages in the session |
| Window | Keeps only the last N messages |
Memory is stored in SQLite and persists across server restarts.
Step 4: Add a Webhook Trigger
- Drag Webhook Trigger from Utilities
- Connect its output to the AI Agent’s main input
- Configure:
Step 5: Add a Webhook Response
- Drag Webhook Response from Utilities
- Connect the AI Agent’s output to Webhook Response
- Configure:
Complete Workflow
Step 6: Configure the Agent Prompt
Click on the AI Agent and set the system prompt:Step 7: Deploy and Test
- Click Deploy
- Test with curl:
Advanced: Multiple Sessions
Use different session IDs for different conversations:Advanced: Window Memory
For long conversations, use Window mode to limit memory:Troubleshooting
Agent doesn't remember previous messages
Agent doesn't remember previous messages
- Ensure Simple Memory is connected to the memory input (diamond handle)
- Check that Session ID is consistent between requests
- Memory is saved after each exchange automatically
API key not found
API key not found
- Click the key icon in the toolbar
- Add your API key for the provider you’re using
- Keys are stored securely and encrypted