Give an agent memory
Give an agent persistent memory by creating a memory store and attaching it to a project. Memory stores survive across sessions. The agent can write facts, preferences, and context that carry over from one run to the next.
Small stores are loaded into the agent’s context at session start; larger ones are exposed as a retrieval tool the agent queries on demand.
In the UI
In the UI
-
Navigate to your project’s Settings tab.
-
Under Memory stores, click Add memory store.
-
Choose an existing store or create a new one by entering a name.
-
The store is now attached. The next session on this project will have access to it.
Programmatically
Create a memory store, then attach it to a project. Each project can have multiple memory stores, and each store can be shared across projects.
-
Create a memory store:
Terminal window ren memory-stores create --name "project-context"The response includes the store
id(e.g.mst_abc123). -
Attach it to a project:
Terminal window ren projects memory-stores add prj_def456 \--memory-store-id mst_abc123 -
Upload a file to the store (optional: the agent can also write to it at runtime):
Terminal window ren memory-stores files upload mst_abc123 \--path "context.md" \--file ./context.md
List stores and their files:
ren memory-stores listren memory-stores files list mst_abc123Detach a store from a project:
ren projects memory-stores remove prj_def456 mst_abc123-
Create a memory store with
POST /api/memory-stores:Terminal window curl -X POST https://api.renai.build/api/memory-stores \-H "Authorization: Bearer $REN_PAT_TOKEN" \-H "Content-Type: application/json" \-d '{"name": "project-context"}'The response includes the store
id. -
Attach it to a project with
POST /api/projects/{id}/memory-stores:Terminal window curl -X POST https://api.renai.build/api/projects/prj_def456/memory-stores \-H "Authorization: Bearer $REN_PAT_TOKEN" \-H "Content-Type: application/json" \-d '{"memoryStoreId": "mst_abc123"}' -
Upload a file to the store (two-step: presign, then PUT):
Terminal window # Start the uploadcurl -X POST https://api.renai.build/api/memory-stores/mst_abc123/files/uploads \-H "Authorization: Bearer $REN_PAT_TOKEN" \-H "Content-Type: application/json" \-d '{"path": "context.md", "contentType": "text/markdown"}'# PUT the file to the presigned URL returned above, then finalize:curl -X POST https://api.renai.build/api/memory-stores/mst_abc123/files/finalize \-H "Authorization: Bearer $REN_PAT_TOKEN" \-H "Content-Type: application/json" \-d '{"path": "context.md"}'
Create a memory store and attach it to a project:
import { createRenClient, pat } from "@renai-labs/sdk"
const client = createRenClient({ baseUrl: "https://api.renai.build", auth: pat(process.env.REN_PAT_TOKEN!),})
const { data: store, error } = await client.memoryStore.create({ body: { name: "project-context" },})if (error) throw errorconsole.log(store.id) // "mst_abc123"
await client.project.memoryStore.add({ path: { id: "prj_def456" }, body: { memoryStoreId: store.id },})Upload files to a store with the CLI (ren memory-stores files upload). The
agent can also write to the store at runtime.
Memory stores are scoped to an owner (org or user). One store per owner can be marked isDefault. It’s automatically attached to new projects in that scope.