How to integrate the memory store into Agent applications and workflow applications.
Overview
There are two ways to use memory in applications:
- Via the built-in Memory node in Workflow: Configure a workflow that connects Start → SearchMemory (API) → LLM → AddMemory (API) → End.
- Via the built-in Memory capability in Agent applications: The application platform automatically manages memory injection.
Using Memory in Workflow Applications
Creating the Workflow
Build the workflow as follows:
Key Configuration
- SearchMemory node: Set
user_idto identify the user,top_k(3-10 recommended). - LLM node: In the prompt, use a variable to reference the retrieved memory context.
- AddMemory node: Write the user message and assistant reply.
Prompt Injection
Using Memory in Agent Applications
Agent applications support two memory modes:
Short-term Memory
Also known as conversation history or multi-turn context. When session_id is passed, the platform automatically maintains the conversation history.
- Carried context rounds: The number of historical turns passed to the model (0-30). More rounds increase relevance but also input length.
Long-term Memory
For cross-session memory, integrate the memory store API:
- Call SearchMemory to retrieve relevant memories.
- Inject the results into the system prompt.
- After the conversation, call AddMemory to write new memories.
Currently, memory in applications is primarily used via API calls. For the complete API reference, see the Long-term Memory API.