Skip to content

Commit 58ff187

Browse files
feat: add user-scoped memory docs to deepagents deploy page
Mirrors the user memory feature spec from langchain-ai/deepagents#2708 into the docs site, covering project layout, configuration, permissions, and runtime behavior. Co-authored-by: Sydney Runkle <54324534+sydney-runkle@users.noreply.github.com>
1 parent ec3b47e commit 58ff187

File tree

1 file changed

+68
-12
lines changed

1 file changed

+68
-12
lines changed

β€Žsrc/oss/deepagents/deploy.mdxβ€Ž

Lines changed: 68 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Deep Agents Deploy takes your agent configuration and deploys it as a [LangSmith
3838
| **`model`** | The LLM to use. Any provider works β€” see [supported models](/oss/deepagents/models#supported-models). |
3939
| **`AGENTS.md`** | The system prompt, loaded at the start of each session. |
4040
| **`skills`** | [Agent Skills](https://agentskills.io/) for specialized knowledge and actions. Skills are synced into the sandbox so the agent can execute them at runtime. See [skills docs](/oss/deepagents/skills). |
41+
| **`user/`** | Per-user writable memory. If present, a single `AGENTS.md` is seeded per user (from `user/AGENTS.md` if provided, otherwise empty). Writable at runtime. Preloaded into the agent's context via the memory middleware. |
4142
| **`mcp.json`** | MCP tools (HTTP/SSE). See [MCP docs](/oss/langchain/mcp). |
4243
| **`sandbox`** | Optional execution environment. See [sandbox providers](#sandbox-providers). |
4344

@@ -87,7 +88,7 @@ This creates the following files:
8788
| `mcp.json` | MCP server configuration (empty by default) |
8889
| `skills/` | Directory for [Agent Skills](https://agentskills.io/), with an example `review` skill |
8990

90-
After init, edit `AGENTS.md` with your agent's instructions and run `deepagents deploy`.
91+
After init, edit `AGENTS.md` with your agent's instructions and run `deepagents deploy`. Optionally add a `user/` directory with per-user memory templates β€” see [User Memory](#user-memory).
9192

9293
## Project layout
9394

@@ -99,17 +100,20 @@ my-agent/
99100
β”œβ”€β”€ AGENTS.md
100101
β”œβ”€β”€ .env
101102
β”œβ”€β”€ mcp.json
102-
└── skills/
103-
β”œβ”€β”€ code-review/
104-
β”‚ └── SKILL.md
105-
└── data-analysis/
106-
└── SKILL.md
103+
β”œβ”€β”€ skills/
104+
β”‚ β”œβ”€β”€ code-review/
105+
β”‚ β”‚ └── SKILL.md
106+
β”‚ └── data-analysis/
107+
β”‚ └── SKILL.md
108+
└── user/
109+
└── AGENTS.md
107110
```
108111

109112
| File/directory | Purpose | Required |
110113
| --- | --- | --- |
111-
| `AGENTS.md` | [Memory](/oss/deepagents/memory) for the agent. Provides persistent context (project conventions, instructions, preferences) that is always loaded at startup. | Yes |
112-
| `skills/` | Directory of [skill](/oss/deepagents/skills) definitions. Each subdirectory should contain a `SKILL.md` file. | No |
114+
| `AGENTS.md` | [Memory](/oss/deepagents/memory) for the agent. Provides persistent context (project conventions, instructions, preferences) that is always loaded at startup. Read-only at runtime. | Yes |
115+
| `skills/` | Directory of [skill](/oss/deepagents/skills) definitions. Each subdirectory should contain a `SKILL.md` file. Read-only at runtime. | No |
116+
| `user/` | Per-user writable memory. When present, a single `AGENTS.md` is seeded per user (from `user/AGENTS.md` if provided, otherwise empty). Writable at runtime β€” the agent can update this file as it learns about the user. Preloaded into the agent's context at the start of each session. | No |
113117
| `mcp.json` | [MCP](https://modelcontextprotocol.io/) server configuration. Only `http` and `sse` transports are supported in deployed contexts. | No |
114118
| `.env` | Environment variables (API keys, secrets). Placed alongside `deepagents.toml` at the project root. | No |
115119

@@ -147,9 +151,10 @@ model = "anthropic:claude-sonnet-4-6"
147151
The `name` field is the only required value in the entire configuration file. Everything else has defaults.
148152
</Note>
149153

150-
Skills, MCP servers, and model dependencies are auto-detected from the project layout β€” you don't declare them in `deepagents.toml`:
154+
Skills, user memories, MCP servers, and model dependencies are auto-detected from the project layout β€” you don't declare them in `deepagents.toml`:
151155

152156
- **Skills**: the bundler recursively scans `skills/`, skipping hidden dotfiles, and bundles the rest.
157+
- **User memory**: if `user/` exists, a single `AGENTS.md` is bundled as per-user memory (from `user/AGENTS.md` if present, otherwise empty). At runtime, each user gets their own copy (seeded on first access, never overwritten). The agent can read and write this file.
153158
- **MCP servers**: if `mcp.json` exists, it is included in the deployment and [`langchain-mcp-adapters`](https://pypi.org/project/langchain-mcp-adapters/) is added as a dependency. Only HTTP/SSE transports are supported (stdio is rejected at bundle time).
154159
- **Model dependencies**: the `provider:` prefix in the `model` field determines the required `langchain-*` package (e.g., `anthropic` -> `langchain-anthropic`).
155160
- **Sandbox dependencies**: the `[sandbox].provider` value maps to its partner package (e.g., `daytona` -> `langchain-daytona`).
@@ -217,23 +222,74 @@ The deployed server exposes:
217222

218223
## Examples
219224

220-
A content writing agent that only needs a model and system prompt, with no code execution:
225+
A content writing agent with per-user preferences that the agent can update:
221226

222227
```toml deepagents.toml
223228
[agent]
224229
name = "deepagents-deploy-content-writer"
225-
model = "anthropic:claude-sonnet-4-6"
230+
model = "openai:gpt-4.1"
231+
```
232+
233+
```txt
234+
my-content-writer/
235+
β”œβ”€β”€ deepagents.toml
236+
β”œβ”€β”€ AGENTS.md
237+
β”œβ”€β”€ skills/
238+
β”‚ β”œβ”€β”€ blog-post/SKILL.md
239+
β”‚ └── social-media/SKILL.md
240+
└── user/
241+
└── AGENTS.md # writable β€” agent learns user preferences
226242
```
227243

228244
A coding agent with a LangSmith sandbox for running code:
229245

230246
```toml deepagents.toml
231247
[agent]
232248
name = "deepagents-deploy-coding-agent"
233-
model = "anthropic:claude-sonnet-4-6"
249+
model = "anthropic:claude-sonnet-4-5"
234250

235251
[sandbox]
236252
provider = "langsmith"
237253
template = "coding-agent"
238254
image = "python:3.12"
239255
```
256+
257+
## User Memory
258+
259+
User memory gives each user their own writable `AGENTS.md` that persists across conversations. To enable it, create a `user/` directory at your project root:
260+
261+
```txt
262+
user/
263+
└── AGENTS.md # optional β€” seeded as empty if not provided
264+
```
265+
266+
If the `user/` directory exists (even if empty), every user gets their own `AGENTS.md` at `/memories/user/AGENTS.md`. If you provide `user/AGENTS.md`, its contents are used as the initial template; otherwise an empty file is seeded.
267+
268+
At runtime, user memory is scoped per user via custom auth (`runtime.server_info.user.identity`). The first time a user interacts with the agent, their namespace is seeded with the template. Subsequent interactions reuse the existing file β€” the agent's edits persist, and redeployments never overwrite user data.
269+
270+
### How it works
271+
272+
1. **Bundle time** β€” the bundler reads `user/AGENTS.md` (or uses an empty string) and includes it in the seed payload.
273+
2. **Runtime (first access)** β€” when a user\_id is seen for the first time, the `AGENTS.md` template is written to the store under that user's namespace. Existing entries are never overwritten.
274+
3. **Preloaded** β€” the user `AGENTS.md` is passed to the memory middleware, so the agent sees its contents in context at the start of every conversation.
275+
4. **Writable** β€” the agent can update it via `edit_file`. The shared `AGENTS.md` and skills are read-only.
276+
277+
### Permissions
278+
279+
| Path | Writable | Scope |
280+
| --- | --- | --- |
281+
| `/memories/AGENTS.md` | No | Shared (assistant-scoped) |
282+
| `/memories/skills/**` | No | Shared (assistant-scoped) |
283+
| `/memories/user/**` | Yes | Per-user (user\_id-scoped) |
284+
285+
### User identity
286+
287+
The `user_id` is resolved from custom auth via `runtime.user.identity`. The platform injects the authenticated user's identity automatically β€” no need to pass it through `configurable`. If no authenticated user is present, user memory features are gracefully skipped for that invocation.
288+
289+
## Gotchas
290+
291+
- **AGENTS.md and skills are read-only at runtime.** Edit source files and redeploy to update them. The per-user `AGENTS.md` at `/memories/user/AGENTS.md` is the exception β€” it is writable by the agent.
292+
- **Full rebuild on deploy:** `deepagents deploy` creates a new revision on every invocation. Use `deepagents dev` for local iteration.
293+
- **Sandbox lifecycle:** Thread-scoped sandboxes are provisioned per thread and will be re-created if the server restarts. Use `scope = "assistant"` if you need sandbox state that persists across threads.
294+
- **MCP: HTTP/SSE only.** Stdio transports are rejected at bundle time.
295+
- **No custom Python tools.** Use MCP servers to expose custom tool logic.

0 commit comments

Comments
Β (0)