Skip to content
AnswerWell geo Documentation

Research · 7 min read · Answerwell

Persistent Agent Memory, Profiles, Namespaces, and Recall

How managed agent memory stores facts across conversations: profiles, ingest, remember, recall, APIs, limits, and safe usage patterns.

This page summarizes Cloudflare Agent Memory documentation: a managed service for persistent, scoped memory so agents can remember users, organizations, and domain context across conversations without building your own extraction, storage, search, and summarization pipeline.

Persistent, scoped memory for agents that need to remember users, organizations, and domain-specific context across conversations.

— Cloudflare, Agent Memory

Agent Memory: what it is and when to use it

Section titled “Agent Memory: what it is and when to use it”

Agent Memory gives agents durable memory across conversations. You can ingest conversations so the service extracts memories automatically, or remember information explicitly when your application already knows what to store. Typical uses include user preferences, company operating rules, support history, project state, or the state of a specific object (Agent Memory).

The service provides:

  • Isolated profiles for users, agents, tenants, teams, or application entities
  • Namespaces to separate applications, environments, or memory layers
  • Automatic extraction of facts, events, instructions, and tasks from conversations
  • APIs to add, list, recall, and delete memories
  • Profile summaries to inspect what is stored (Features)

Workers access Agent Memory through an agent_memory binding; external services use the HTTP API. For agent apps on Cloudflare, see also Agents and Get started.

How this differs from conversation state alone

Section titled “How this differs from conversation state alone”

For Cloudflare agents, a memory system maintains context and tracks task progress alongside the decision engine and tools (What are agents?). Agent Memory is the managed layer for long-term knowledge extracted from past sessions—not a substitute for the current prompt or in-session state (Harnesses: Sessions stores conversation context across turns; Agent Memory persists structured knowledge beyond that).

Memory types: facts, events, instructions, and tasks

Section titled “Memory types: facts, events, instructions, and tasks”

Agent Memory classifies every extracted memory into one of four types (How Agent Memory works):

Type Role Behavior over time
Facts Stable knowledge (preferences, identities, goals) Evolve via supersession: newer facts on the same topic replace older ones in recall; history is kept
Events Completed actions at a point in time (deployments, decisions) Accumulate; they do not conflict
Instructions Reusable procedures and conventions Like facts, support supersession when updated
Tasks Short-lived, session-scoped follow-ups Deprioritized after the session ends

Agent Memory classifies every extracted memory into one of four types: Facts — Stable knowledge… Events — Completed actions… Instructions — Reusable procedures… Tasks — Short-lived, session-scoped items…

— Cloudflare, How Agent Memory works

Namespaces and profiles: how to isolate memory per user or tenant

Section titled “Namespaces and profiles: how to isolate memory per user or tenant”

Agent Memory uses a two-level isolation model: namespaces define memory domains; profiles are isolated stores per entity (Namespaces and profiles).

Agent Memory uses a two-level isolation model: namespaces define memory domains, and profiles provide isolated memory stores for individual users, agents, teams, tenants, or application objects.

— Cloudflare, Namespaces and profiles

Namespace — top-level container for an application or environment (e.g. prod vs staging, or separate apps). Profile — one isolated memory store (e.g. per user). Scoping is strictly namespace → profile → memory; a recall() on one profile never returns another profile’s data.

Namespace: my-assistant-prod
Profile: alice → Memories, Messages
Profile: bob → Memories, Messages

Create a namespace with Wrangler (name up to 32 characters; used in bindings and API calls):

npx wrangler agent-memory namespace create my-agent

See Get started: Create a namespace and HTTP API: Create a namespace.

Profiles are created automatically on first write (HTTP API: Profiles). In Workers, getProfile(profileName) also creates a profile if missing (profile name max 100 characters) (Workers API: getProfile).

ingest(), remember(), and recall(): when to call each API

Section titled “ingest(), remember(), and recall(): when to call each API”

Three operations cover most applications (Get started, Workers API):

Method Use when
ingest() You have conversation messages and want automatic extraction of durable memories
remember() Your agent or app already knows the exact text to store
recall() The LLM needs relevant memory not present in the current prompt or session

Use recall() when the model needs relevant memory to answer or act. Use ingest() when you have conversation messages and want Agent Memory to extract durable memories automatically. Use remember() when your agent already knows the exact memory to store.

— Cloudflare, Get started

Automatic ingestion is enough for most apps. Explicit remember() via an LLM-callable write tool is optional; if you add one, define in the system prompt what is worth remembering and when to confirm—automatic ingestion is often simpler and safer (Get started: Store explicit memories).

How ingestion extracts and stores memories

Section titled “How ingestion extracts and stores memories”

When you call ingest(), processing runs through extraction, classification, deduplication, and storage (How Agent Memory works):

  1. Extraction — identifies discrete memorable items with summaries and supporting content
  2. Classification — assigns type, topic key, keywords, and search queries
  3. Deduplication — facts and instructions with the same topic key supersede older versions
  4. Storage — durable storage with full-text indexes; non-task memories also get vector embeddings

Raw conversation messages are stored verbatim alongside extracted memories.

ingest() is idempotent: messages are content-addressed; duplicate sends do not duplicate memories; sessions are deterministic from content if you omit sessionId (Idempotency, Workers API: ingest).

recall(query, options?) runs query analysis, parallel retrieval (keywords, topic keys, vectors, raw messages), scoring, ranking, and synthesis into a natural-language answer grounded in stored content (How recall works).

If no memories match the query, recall() returns an empty answer rather than hallucinating a response.

— Cloudflare, How recall works

Workers options include thinkingLevel (low | medium | high) for retrieval breadth and responseLength (short | medium | long) for answer verbosity (Workers API: recall). Query size is limited to 1 KB UTF-8 (Limits).

Workers binding vs HTTP API: how to connect your app

Section titled “Workers binding vs HTTP API: how to connect your app”
Access path Best for
Workers API via agent_memory binding Agents and Workers on Cloudflare
HTTP API Services that call the Cloudflare API directly

Overview: API. Profile operations include ingest, remember, recall, list, get, and getSummary on both surfaces.

Inspect stored knowledge with getSummary(), which returns structured Markdown for the profile (Workers API: getSummary, HTTP API: Get a summary). list() returns paginated entries without full content; use get(memoryId) for content (Workers API: list).

recall() as an LLM tool: wiring Agent Memory to the LLM

Section titled “recall() as an LLM tool: wiring Agent Memory to the LLM”

The LLM does not use memory automatically because a binding exists. Expose recall through a tool and instruct the LLM when to call it (Get started: Add memory recall as a tool).

With the Agents SDK Session API, a searchable context provider’s search() becomes a search_context tool. The system prompt should state when to search (prior sessions, preferences, project state), to phrase searches as concise topics—not questions—and to treat recalled content as helpful context, not guaranteed truth for irreversible actions (Get started).

Conceptual flow:

  1. Create namespace and bind MEMORY in the Worker (Workers API)
  2. getProfile() for the end-user or entity profile name
  3. Batch ingest() at checkpoints; optional remember() for explicit facts
  4. Tool handler calls profile.recall(query, { responseLength: "short" })
  5. Periodically or for debugging, call getSummary()

See the full pattern in Get started and Concepts.

Platform limits and validation constraints

Section titled “Platform limits and validation constraints”
Feature Limit
Messages per ingest() call 500
Message content size 32 KB (32,768 bytes UTF-8)
Recall query size 1 KB (1,024 bytes UTF-8)
Session ID length 64 characters
Profile name length 100 characters
Namespace name length 32 characters
List API page size 1 to 1,000 (default: 20)

Source: Limits. Workers list() default limit is 20, max 500 per page (Workers API: list).

  • Ingesting every turn — increases cost and noise; batch at idle or compaction instead (Get started).
  • No recall tool or policy — binding alone does not give the model long-term context (Get started).
  • Wrong profile — cross-user leakage is prevented only if each user maps to the correct profile in a consistent namespace (Namespaces and profiles).
  • Treating empty recall() as fabrication license — empty answers mean no match; do not invent memories (How recall works).
  • Re-ingesting without understanding idempotency — safe for duplicates, but supersession can update facts when topic keys collide (Idempotency).
  • Giving the LLM unrestricted remember() — prefer ingestion or guarded write tools with confirmation (Get started).
  1. Create or confirm an Agent Memory namespace with Wrangler or the HTTP API Create a namespace flow, and verify the name matches your Worker agent_memory binding (Get started).

  2. Send a test conversation through ingest() (Workers or HTTP ingest), staying within Limits (≤500 messages, ≤32 KB per message).

  3. Call getSummary() on the same profile and confirm extracted facts, events, instructions, or tasks appear as expected (HTTP API: Get a summary).

  4. Run recall() with a query that should hit stored preferences or events; confirm a non-empty answer when matches exist and an empty answer when none do (HTTP API: Recall memories, How recall works).

  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about, and we will correct or clarify it.