AI Agents

Build an intelligent agent that learns from conversations and executes tasks

8 nodes 338 196 Automatic trigger
Download

Workflow Description

An automation that creates a smart agent receiving user commands via chat trigger, retaining context with sliding-window memory, using OpenAI to understand intent, executing designated tools through the agent, and storing results in MongoDB for continuous learning and task tracking.

How it works

  1. 1.Receive user message through chat trigger endpoint
  2. 2.Store conversation context in sliding-window memory for continuity
  3. 3.Send interaction to OpenAI model for intent analysis and reasoning
  4. 4.Identify and execute the appropriate tool via the AI agent
  5. 5.Persist task outcome and response in MongoDB database

Use cases

  • Customer support agent that learns from historical interaction patterns
  • Project assistant receiving voice commands and creating automated tasks
  • Interactive data analyst answering complex questions with full context

Requirements

  • Valid OpenAI API key with sufficient usage quota
  • MongoDB database with read and write permissions configured
  • Chat trigger enabled and properly authenticated in n8n instance

Service Value

Ideal as a smart automation service combining integrations and AI to produce ready-to-use results.

Apps Used

OpenAI MongoDB Memory Chat Trigger Tool AI Agent

Details

Trigger Automatic trigger
Nodes 8
Apps 6
Views 338
Downloads 196

How to Use

  1. 1.Click "Download Template"
  2. 2.Open your n8n dashboard
  3. 3.Go to Workflows > Import from File
  4. 4.Select downloaded file and configure credentials

Nodes Used (8)

OpenAI Chat Model

OpenAI

#1

MongoDBAggregate

Mongo Db Tool

#2

Window Buffer Memory

Memory Buffer Window

#3

When chat message received

Chat Trigger

#4

insertFavorite

Tool Workflow

#5

AI Agent - Movie Recommendation

Agent

#6

Sticky Note

Sticky Note

#7

Sticky Note1

Sticky Note

#8