Memory
Goal: Store a durable preference and verify that later chats can use it.
Prerequisites: Quickstart completed and the platform running.
Time: About 5 minutes.
1. State a Durable Preference
Open a chat and say something the assistant should keep beyond the current conversation:
For code examples, prefer TypeScript unless I ask for another language.
The agent may call memory_store when it determines the statement is a durable
preference or correction. The runtime also prefetches relevant memories before
constructing future turns, so memory use is not always visible as an explicit
tool call in the UI.
2. Verify Through the API
List the current user's memories:
curl "http://localhost:8080/v1/memory?tenant_id=default&user_id=admin"
If auth is enabled, include the bearer token you obtained through the normal browser or operator-approved OAuth flow.
3. Store a Test Memory Directly
For deterministic testing, write a memory directly:
curl http://localhost:8080/v1/memory \
-H "Content-Type: application/json" \
-d '{
"content": "User prefers TypeScript examples.",
"memory_type": "user",
"scope": {
"tenant_id": "default",
"user_id": "admin"
}
}'
Search for it:
curl http://localhost:8080/v1/memory/search \
-H "Content-Type: application/json" \
-d '{
"query": "preferred coding language",
"scope": {"tenant_id": "default", "user_id": "admin"},
"limit": 5
}'
4. Start a New Chat
Open a new session and ask:
Write a small JSON parser example.
If the stored memory is relevant, the chat handler can inject it as recent
context before the model responds. The agent can also call memory_recall for a
more explicit lookup when the injected context is not enough.
5. Correct the Preference
Send a correction:
Actually, prefer Python examples for data work.
Corrections are stored as feedback memories when the agent saves them. They
do not automatically delete older memories; the model and consolidation process
resolve conflicts over time.
What You Learned
- Memory is scoped by tenant and user, with optional agent/session narrowing.
- The four memory types are
user,feedback,project, andreference. - Memory may appear as injected context or explicit tool calls.
- Direct API calls are useful for deterministic testing.
See the Memory Reference for the full API and operational details.