Memory and files
Built.
Memory stores
A memory store is a set of files that outlives sessions. Use it for preferences, notes and reference material an agent should carry from one run to the next.
const store = await client.beta.memoryStores.create({ name: "notes" });
await client.beta.memoryStores.memories.create(store.id, { path: "prefs.md", content: "Use UK English." });
const session = await client.beta.sessions.create({
agent: agent.id,
environment_id: environment.id,
resources: [{ type: "memory_store", memory_store_id: store.id }],
});
- The store is mounted in the sandbox at
/mnt/memory/<name>/. - What the agent writes there is saved back as new versions.
- Creating a memory at a path that exists is a 409. Updates can carry a
content_sha256precondition so two writers do not overwrite each other. POST …/memory_versions/{vid}/redactremoves the content of one version and keeps the record that it existed.- Deleting a session does not delete its memory stores. They are persistent by design. Delete the store yourself when it should go.
Files
Upload a file once and mount it in sessions:
resources: [{ type: "file", file_id: file.id }]
/v1/files supports upload, list, get, content and delete.
Session outputs
Anything the agent writes to /mnt/session/outputs/ becomes a file you can list and download. Those files carry scope_id equal to the session id.
GitHub repositories
A session can mount a repository with a github_repository resource. Its token is used for the clone and the remote is then reset to the plain URL; the token is never returned by the API. Use a token with the narrowest scope the task needs.
Endpoints
/v1/memory_stores · /v1/memory_stores/{id}/memories · /v1/memory_stores/{id}/memory_versions (+ /redact) · /v1/files · /v1/sessions/{id}/resources