Process Chat Messages with Intelligent Agent and Batch Splitting
Workflow Description
A workflow that captures incoming chat messages, routes them to an AI agent powered by an advanced language model, splits responses into manageable batches, and maintains conversation context using memory buffers for continuous interaction.
How it works
- 1.Receive incoming message from the chat interface trigger
- 2.Route message to the AI agent backed by OpenRouter language model
- 3.Split the agent response into separate processing batches
- 4.Store conversation context in memory buffer for recall
- 5.Apply conditional logic to direct workflow based on response type
Use cases
- Build a context-aware chatbot that remembers conversation history
- Handle high-volume customer queries by processing them in parallel batches
- Automate responses to frequently asked questions with continuous learning
Requirements
- Valid OpenRouter API key configured
- Chat interface compatible with n8n
- Sufficient memory allocation for storing conversation history
Service Value
Ready-made workflow template for automation delivery and service execution.
Apps Used
Details
How to Use
- 1.Click "Download Template"
- 2.Open your n8n dashboard
- 3.Go to Workflows > Import from File
- 4.Select downloaded file and configure credentials
Nodes Used (18)
When chat message received
Chat Trigger
AI Agent
Agent
Loop Over Items
Split In Batches
Extract mentions
Code
Simple Memory
Memory Buffer Window
Set last Assistant message as input
Set
Set user message as input
Set
First loop?
If
Set lastAssistantMessage
Set
Combine and format responses
Code
Define Global Settings
Code
Define Agent Settings
Code
Sticky Note
Sticky Note
Sticky Note1
Sticky Note
Sticky Note2
Sticky Note
Sticky Note3
Sticky Note
Sticky Note4
Sticky Note
OpenRouter Chat Model
Lm Chat Open Router