Skip to content
Agentic Workflowdocs
v0.9.0Install free

concepts / ai

Memory and context

Design AI workflows that remember: what the model sees on each run, how Chat Memory keeps a conversation, and when to use a knowledge base instead.

A model has no memory of its own. Each time an AI node runs, the model sees only what the node sends it: the context. Memory is a way to add the earlier conversation to that context, so the next answer can build on the last one.

This page is about designing memory into workflows. For everything AWFlow remembers (chats, workflow conversations and facts) and how to view, export or clear it, see the Memory page.

On each run, an agent’s context is built from:

Part Where it comes from
Instructions The node’s System message
The request The prompt you map from earlier steps, for example {{ $json.chatInput }}
Earlier messages A connected Chat Memory
Passages from your documents A connected Local Knowledge base
Tool results Tools the agent called during this run

Everything must fit in the model’s context window. Small and on-device models have small windows, so give them less.

You don’t have to guess what was sent. After an AI step runs, its Output has a violet The model sees card for each model call (Call 1, Call 2…, an agent makes one per round of tool calls). It lists the parts in order (instructions, the message, chat memory, tools, knowledge passages, tool results), each with its token count and a meter against the model’s context window (3,210 of 8,192 tokens). Values that came from earlier steps are highlighted, and tool and page results are marked Untrusted data, not instructions. On later calls, New since call 1 shows what was added. Copy the full prompt copies the text.

The settings of a Tools Agent step, Summarise, after a run: above its Output, the violet The model sees card with a meter (63 of 8,192 tokens), the Instructions (8 tokens) and the Message (55 tokens: Summarise this article in 2 short bullets, with the article’s title highlighted as a value from an earlier step), and a copy button. The settings of a Tools Agent step, Summarise, after a run: above its Output, the violet The model sees card with a meter (63 of 8,192 tokens), the Instructions (8 tokens) and the Message (55 tokens: Summarise this article in 2 short bullets, with the article’s title highlighted as a value from an earlier step), and a copy button.

Numbered areas in the screenshot: 1. The model sees; 2. Copy the full prompt.

In Setup, The model will see previews the same parts from the last data, and warns in amber when the prompt won’t fit the connected model (Too long for Llama 3.2 1B: 1,200 tokens over. Chat memory is cut first; or pick a model with more room.), with Change model.

The full text of each part is kept for runs you start in the editor. Background runs keep a summary (the parts and their token counts), kept with the run’s step data: in Runs, an AI step lists its model calls with one card each.

Connect a Chat Memory node to the memory port of a RAG Agent or Tools Agent. Before calling the model, the agent reads the earlier messages; after answering, it saves the new message and its reply.

Pick a Storage for the conversation:

Storage Use it when
Conversation (default) One ongoing conversation, such as a single chatbot or an agent that runs on a schedule and should remember earlier runs.
Key One conversation per user, ticket or page. Set the key with an expression, for example {{ $json.userId }}.
This run only The agent only needs to remember within one run, for example across several tool calls. Nothing is saved.

When the conversation gets long, History sent to the model decides how much is sent: As much as fits (default) or the Last N messages. With Summarise older messages on, what no longer fits is summarized instead of dropped.

flowchart LR
  Chat["Chat Trigger"] --> Agent["Tools Agent"]
  Model["Chat model"] --> Agent
  Memory["Chat Memory"] --> Agent
  Memory --> Chat

  class Memory awf-data

Connect the same Chat Memory to the Chat Trigger and to the agent, and set the agent’s prompt to {{ $json.chatInput }}. The chat window then shows the conversation the agent saves.

You need the AI to… Use
Continue a conversation Chat Memory
Answer from documents, pages or notes A knowledge base with Local Knowledge. See RAG
Keep a single value between runs, such as a counter or the last item seen The Data Store node

Memory is not a good place for reference material: it grows with every message, and old messages get summarized. Put documents in a knowledge base.

  • Keep the context small. Map only the fields the model needs, not a whole page.
  • Use a key per person or thread. Without one, everyone who uses the workflow shares one conversation.
  • Use “This run only” for one-off tasks. A long-lived conversation for a one-off task only adds noise.
  • Check what was saved. Open the conversation on the Memory page to see exactly what the agent will read next time.
Ask Aria