AI Agents

Deploy an AI Agent with Conversational Memory and Database Integration

8 nodes 320 140 Automatic trigger
Download

Workflow Description

An intelligent workflow that activates an AI agent powered by OpenAI's language model, maintains conversation history through a sliding memory window, and dynamically reads from and writes to MongoDB to retrieve and store relevant data during interactions.

How it works

  1. 1.Capture user request through the chat trigger interface
  2. 2.Load previous conversation context from the memory buffer window
  3. 3.Process the request using the OpenAI-powered intelligent agent with tool execution capability
  4. 4.Execute required operations against the MongoDB database
  5. 5.Update the conversation memory with the agent's response and new data
  6. 6.Deliver the final response back to the user

Use cases

  • Build a contextual AI assistant that remembers conversation history and adapts responses accordingly
  • Automate complex database queries by converting natural language into MongoDB operations
  • Create a multi-tool agent that combines advanced language understanding with data persistence

Requirements

  • Valid OpenAI API key with appropriate model access
  • Active MongoDB connection with proper database credentials
  • Configured chat trigger to receive and process user messages

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 320
Downloads 140

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