How namespaces work
Each memory file lives in exactly one namespace. The identity of a file is the pair(namespace, path). The same path can exist in two namespaces, and a
write in one does not touch the other.
Here tone.md exists twice. ("support-bot", "tone.md") and
("sales-bot", "tone.md") are two different files.
- Namespaces are shared across your organization for your API key. They are
visible to every
user_idthat key acts for. user_idplays no role in scoping memory. Two clients with the same key and differentuser_idvalues see the same files.- There is no call to create or delete a namespace. The first file you create in a new name brings it into existence. It disappears when its last file is deleted.
Manage memory files
A memory file has apath, a purpose, and a content.
- Python SDK
- HTTP
content.
Without a namespace filter, the same path can appear several times, so always
key a file by (namespace, path). There is no pagination or sort option.
Update and delete
- Updates are partial. Send at least one of
contentorpurpose. Omitted fields stay as they are. - You cannot clear a field. Sending
nullhas no effect. Omit the field to keep it. versionprotects against concurrent writes. A staleversionis rejected with a conflict (HTTP 409). Read the file again and retry. A malformedversionreturns 422.- Delete is not idempotent. Deleting a file that is already gone returns 404.
- Python SDK
- HTTP
Attach a thread to a namespace
A thread only uses memory if it is attached to a namespace when it starts. Memory is a capability: pass amemory entry in the
thread’s capabilities on the start request. The value is frozen for the whole
life of the thread. Follow-up messages do not accept it.
- Python SDK
- HTTP
- To switch namespaces, start a new thread.
- Thread responses do not echo the namespace. Keep the name you sent.
namespaceis required withactivation="always", and it is 1 to 128 characters.- If you send no
memoryentry and the agent has no namespace configured on the platform, the thread runs normally with no memory tools. Nothing tells you that memory is off. Pass it on every start where you expect memory. - To run a thread with no memory, even if the agent has a namespace, pass
MemoryCapability(activation="never"). In HTTP, send"memory": {"activation": "never"}. - Other capabilities you pass in the same call do not remove the agent’s
namespace. Only the
memoryentry changes memory. - A namespace you send at start wins over the agent’s.
options.memory_namespacestill works on the HTTP API, but it is deprecated. It cannot be sent together withoptions.capabilities.
Isolate your users
A namespace is shared by everyone in the organization who uses it. To keep end users apart, put an identifier in the name yourself.Limits
namespaceis a string of at most 128 characters. It is not trimmed.- Omitting
namespaceon create, get, update, or delete returns 400Missing namespaceon the platform. - Listing without a filter returns every file in your organization.
Files written before namespaces existed
Memory used to be scoped to eachuser_id. Those files are kept. They now sit
in a namespace named {user_id}::default, one per former user. Pass that exact
string as namespace to read them, or copy them to a namespace you choose.
Threads that were already running keep reading that namespace. A new thread has
no memory until you pass a memory capability.
Next steps
API reference
Memory endpoints, with a live playground.
Python SDK reference
Signatures and local validation rules for
client.memory.