Memory

Updated at:

Large language models are limited by their context window and cannot retain memories across sessions, so every conversation starts from scratch. Memory automatically extracts key information from conversations and stores it persistently, allowing agents to continuously reference user preferences and historical information across sessions for a personalized, coherent conversational experience.

Overview

Memory is a service that provides cross-session long-term memory for large language models. It automatically extracts key information from conversations and stores it persistently as factual memories and user profiles. In subsequent conversations, relevant memories are retrieved based on semantic search and injected into the context, so the agent continuously understands user preferences and historical information.

  • Factual memory: Key events and information automatically extracted from conversations, such as "The user needs a hydration reminder at 9 AM every day." Suitable for dynamic event information.
  • User profile: Structured attributes extracted based on a custom template, such as age, occupation, and hobbies. Suitable for fixed user attributes.

Memory provides open APIs that can be integrated into any application, and multiple applications can share the same memory. For product concepts and how it works, see Core concepts.

WarningMemory begins commercial billing at 10:00 (UTC+8) on August 20, 2026. Add and Search calls are available in Pro and Lite plan versions. For more information, see Billing.

Quick start

Write, view, and search memories through the API in just 3 steps. See Quickstart. To confirm written memories, go to the Memory details tab of the default memory in the Bailian console, enter the memory entity ID (user_id), and click View.

Create a memory

Each account comes with a default memory that is ready to use without creation. The default memory cannot be deleted, but you can edit its name and description and add custom memory rules. It comes with a preset "default project" factual memory rule with a default validity of 180 days, which you can click to edit and adjust.

To customize memory rules or manage memories separately for different business scenarios, create a new memory:

  1. Open the create entry: On the Memory page, click Create memory in the top right corner.
  2. Fill in basics: Enter the memory name and memory description (may be used to guide agent invocation), then click OK.
  3. Configure memory rules: After creation, the system asks whether to create memory rules immediately. We recommend clicking Create now to go to the memory rules configuration page. You can also click Later and enter configuration later via View details on the memory card.

To delete a memory: click the ... icon on the memory card, or click the ... icon in the top right corner of the memory details page, then click Delete. All memories in the memory will be cleared and cannot be recovered. The default memory cannot be deleted.

For more information, see Create and delete a memory.

Configure memory rules

Memory rules define how to extract, store, and retrieve memories from conversations, including factual memory rules and profile rules. Each memory supports up to 50 factual memory rules and 50 profile rules. Click View details on the memory card to go to the Memory rules tab on the memory details page.

  • Factual memory rules: Extract key events and information from conversations. You can configure the rule instruction, auto update, expiry, and the extraction plan version (Pro/Lite).
  • Profile rules: Persistently store user attribute information. Define each profile field's name, description, initial value, and extraction plan version.

For full parameter descriptions, see Configure memory rules.

View memories and debug retrieval

On the Memory details tab of the memory details page, you can view basic memory information, statistics, and the memory entity list, and filter by memory entity ID (user_id) to view memory details.

You can debug retrieval on the Memory search tab. To test through the API, call /memory_nodes/search, provide the conversation in messages, and use top_k to control the maximum number of results. min_score is the minimum score threshold for the Pro plan and defaults to 0.3.

To manage memories through the API (list, update, delete), see Manage memories.

Use user profiles

After creating a profile schema through the API, pass the profile schema ID (profile_schema) when calling AddMemory. The system automatically extracts structured attributes from conversations, which you can then retrieve with GetUserProfile. For the complete workflow, see Use user profiles.