MongoDB Agent

AI Agent powered by OpenAI and MongoDB This flow is designed to work as an AI autonomous agent that can get chat messages, query data from MongoDB using the aggregation framework. Following by augmenting the results from the sample movies collection and allowing storing my favorite movies back to the database using an "insert" flow.

Workflow Structure (6 nodes)
100%
Langchain.chat Trigger
When chat message received
Langchain.agent
AI Agent - Movie Recommendation
Langchain.lm Chat Open Ai
OpenAI Chat Model
Langchain.memory Buffer Window
Window Buffer Memory
Mongo Db Tool
MongoDBAggregate
Langchain.tool Workflow
insertFavorite
Node Types:
default
action
trigger
Requires credentials

Prerequisites

Required Credentials (2)

Mongo Db

Used by: MongoDBAggregate

Docs

OpenAI

Used by: OpenAI Chat Model

Docs

Complexity

Moderate

Some experience helpful. Multiple integrations or logic.

Setup time: ~25 min
Score: 22/100

When to Use This Workflow

Real-time Response

React instantly when events happen - new orders, form submissions, or API calls.

Zero delay between trigger and action for time-sensitive workflows.

Time Savings

Replace repetitive manual tasks with reliable automation.

Reclaim hours every week for higher-value work.

Error Reduction

Eliminate human error from routine processes with consistent automation.

Improve accuracy and reliability across your workflows.

workflow.json
{
  "id": "22PddLUgcjSJbT1w",
  "meta": {
    "instanceId": "fa7d5e2425ec76075df7100dbafffed91cc6f71f12fe92614bf78af63c54a61d",
    "templateCredsSetupCompleted": true
  },
  "name": "MongoDB Agent",
  "tags": [],
  "nodes": [
    {
      "id": "d8c07efe-eca0-48cb-80e6-ea8117073c5f",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1300,
        560
      ],
      "parameters": {
        "options": {}
      },
...

Workflow Details

Nodes
8
Trigger
Event
Source
awesome
Added
Dec 4, 2025

Need Help?

Check out the official n8n documentation for detailed guides.

Related Workflows

Chat with Postgresql Database

👨‍🎤 Setup 1. Add your postgresql and OpenAI credentials. 2. Click Chat button and start asking questions to your datab...

Chat
Agent
Lmchatopenai
Postgrestool
11 nodesEvent
Curated

Generate SQL queries from schema only - AI-powered

Run this part only once This section: loads a list of all tables from the database hosted on [db4free](https://db4free....

Lmchatopenai
Memorybufferwindow
Mysql
Readwritefile
29 nodesEvent
Curated

SQL agent with memory

Run this part only once This section: downloads the example zip file from https://www.sqlitetutorial.net/sqlite-sample-...

Memorybufferwindow
Lmchatopenai
Http-request
Compression
13 nodesEvent
Curated

Build a Tax Code Assistant with Qdrant, Mistral.ai and OpenAI

Step 1. Download the Tax Code PDF [Read more about handling Zip Files](https://docs.n8n.io/integrations/builtin/core-nod...

Embeddingsmistralcloud
Documentdefaultdataloader
Textsplitterrecursivecharactertextsplitter
Http-request
38 nodesEvent
Curated

Building RAG Chatbot for Movie Recommendations with Qdrant and Open AI

Tool, calling Qdrant's recommendation API based on user's request, transformed by AI agent

Github
Embeddingsopenai
Documentdefaultdataloader
Textsplittertokensplitter
27 nodesEvent
Curated

AI Agent to chat with Airtable and analyze data

Replace Mapbox public key - <yourpublickey> in code

Lmchatopenai
Agent
Memorybufferwindow
Chat
41 nodesEvent
Curated