Skip to main content

Introduction

Memory lets you store variables that persist between conversations, workflows, and nodes. Unlike Context (which is only available during the current conversation), Memory keeps data available for future interactions with the user.
One memory per user, four ways to reach it. Memory is a single per-user store you access from different surfaces depending on where you are working:Any write from one surface is immediately visible from the others. There are no parallel copies to sync.

Key features

Data types

TTL (Time To Live): Lifetime in seconds of each variable. Once the TTL elapses, the variable is automatically deleted. For example, 3600 = 1 hour, 86400 = 1 day.

How long Memory lasts overall

Memory has two independent clocks running at the same time: Mental rule: if the user writes anything to Memory at least once every 30 days, their memory lives indefinitely. If 30 full days pass without a write, all their memory is wiped. Each variable may still expire earlier due to its own TTL without affecting the rest.
Only writing (set, setJson, setFile) renews the hashTTL. Reading (get, getJson, getFile) does not count.

Saving variables

Using the Variable node

To save variables without code, use the Variable node inside the Logic section. In Variable enter the name and in Value what you want to save; it can be plain text, another variable, or a context value.
The Variable node is ideal for saving primitives (string, number, boolean) quickly and visually.
Each Variable node allows a maximum of 20 variables. If you need more, use multiple nodes or save the values from a code node.

Using code nodes

For greater control over TTL and complex data types, use the $memory methods in code nodes:

Reading variables

In any node

Inside any node you can access Memory with the syntax {{$memory.variableName}}. For example, if the variables in memory are:
Then:
  • {{$memory.name}} shows John
  • {{$memory.lastOrder.status}} shows on the way

In code nodes

Use the specific methods according to the data type:

Working with files

When saving a file in Memory, you must provide the content in base64, the TTL, and the MIME type:
When reading a file with $memory.getFile() you get a FileHandle with three methods to access the content:

Allowed MIME types

The methods $memory.setFile(), $memory.getFile().toBase64(), and $memory.getFile().toRaw() are asynchronous. You must use await when calling them.

Deleting variables

You can delete variables before their TTL expires:

Security

Do not store sensitive data in Memory:
  • Passwords or credit card numbers
  • Long-lived authentication tokens
  • Highly sensitive personally identifiable information (PII)
For long-term persistence, use Datum.