Language models keep nothing between requests. n8n's October 2026 guide to stateful and stateless design says previous messages have to be supplied in the model's input or retrieved from somewhere else, and that an agent remembers only because it stores information outside the model and adds the relevant parts to the next request.
That gives you three layers to choose from. A scratchpad holds intermediate results while the agent works on a single request, and the guide notes it is not stored state. Session memory keeps recent messages for one conversation. Durable, shared state holds what must outlive the conversation or carry across runs, kept in a database, a data table or a cache. n8n workflow runs are independent by default, and the guide's advice is to build without state first and add it only where the workflow needs continuity.
Memory is not the same as document search. A companion post on the n8n blog, a guest post by Veljko Kovac of Cognee, which sells an agent memory platform, puts the difference this way: retrieval from your documents reads existing knowledge but does not write back, so it won't remember what a user asked last week or which fix already failed. Agent memory writes new facts, preferences and outcomes as the agent works. Its example is a sales assistant that pulls this quarter's numbers from reports but also remembers that one user wants EU figures in euros, broken down by country.
How memory is stored changes what it gets right. The post lists the trade offs: vector databases are simple, but entries such as Q3 sales and Q4 sales look almost identical and there is no notion of which fact is current; plain files are transparent and versioned but don't scale or share well; knowledge graphs connect related facts but take more work to build. Whatever you choose, memory has to be managed. The post recommends consolidating raw entries, keeping dates on facts so updates don't erase history, and making forgetting a deliberate step, for example when someone asks for their data to be deleted.
Watch the bill and test the payoff. The stateful design guide warns that a sliding window memory, such as the last 20 messages, invalidates the model provider's prompt cache in long conversations, which raises cost, and suggests a larger window or summarizing older messages. The memory post's benchmark results are Cognee's own, so treat them as vendor claims. Its best advice is to run the same workflow with memory on and off and measure the outcome you care about: tickets resolved, fewer repeated questions, correct follow ups.