Skip to content

Documentation: Agent Memory MongoDB Node

Overview

The Agent Memory MongoDB Node is a node in the AI Models family that provides persistent MongoDB-based memory for an Agent. It allows the agent to remember the conversation history across executions by storing messages in a MongoDB collection identified by the session.

In IoT and industrial environments, this is key for building conversational assistants with memory: for example, a plant support agent that maintains the context of a conversation over time.


When to use this node?

Use this node when you need to:

  • Give persistent memory to an Agent so it can remember previous conversations.
  • Maintain the context of a dialogue across multiple flow executions.
  • Store interaction history in an existing MongoDB infrastructure.

Architecture: connecting to the Agent

This node connects to the Memory connector of an Agent node. On its own it provides the memory backend; its effect materializes when the Agent uses it to read and write the conversation history (using the agent's session_id).


Node Configuration

Empty configuration of the Agent Memory MongoDB node

Form View

1. Connection String

Select the MongoDB credential that contains the database connection string (managed centrally and securely).

2. Database

The name of the MongoDB database where memory will be stored (e.g., plant_agent).

3. Collection

The name of the collection where messages/history will be saved (e.g., conversations).

Configured Agent Memory MongoDB node form


JSON Structure (Input Parameters)

{
  "connection_string": "<referencia a credencial MongoDB>",
  "database": "plant_agent",
  "collection": "conversations"
}

JSON Fields

Field Type Description
connection_string string Reference to the MongoDB credential (managed securely).
database string MongoDB database name.
collection string Collection name where memory is stored.

Output: Where the node's data comes from

This node provides the memory backend; it does not produce a payload on its own. Its effect is observed in the Agent's behavior, which remembers the conversation context thanks to persistence in MongoDB.


Usage Examples

Example 1: Plant assistant with memory

Use case: Connect this node to an Agent so that the plant support assistant remembers the previous interactions of each operator (by session_id).

  • Database: plant_agent
  • Collection: conversations

(see JSON structure above)


Validation and Errors

Condition Common cause / fix
The agent does not remember context Verify that this node is connected to the Agent's Memory connector and that the session_id is consistent.
Cannot connect to MongoDB Check the credential (connection string) and that the MongoDB server is accessible.
Mixed data Use a dedicated database/collection for the agent's memory.

Best Practices

  • Use centralized credentials: Do not write the connection string directly in the node; select a securely managed MongoDB credential.
  • Consistent sessions: Maintain a stable session_id in the Agent so that memory is correctly associated with each conversation.
  • Dedicated collections: Reserve a collection for the agent's memory, separate from other data.
  • Connect to the Agent: Remember that this node only takes effect when connected to the Memory connector of an Agent.