You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add subagent documentation to deploy page (#3615)
## Description
Adds comprehensive subagent documentation to the "Deploy with the CLI"
page based on the implementation in langchain-ai/deepagents#2786.
Subagents are auto-discovered from a `subagents/` directory and let the
main agent delegate specialized tasks to isolated child agents with
their own system prompts, skills, and MCP tools. By default, subagents
inherit model and tools from the main agent but not skills.
## Test Plan
- [ ] Test in preview deployment
_Opened collaboratively by Sydney Runkle and open-swe._
---------
Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
Co-authored-by: Sydney Runkle <54324534+sydney-runkle@users.noreply.github.com>
Co-authored-by: Naomi Pentrel <5212232+npentrel@users.noreply.github.com>
Copy file name to clipboardExpand all lines: src/oss/deepagents/deploy.mdx
+139-7Lines changed: 139 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,7 @@ Deep Agents Deploy takes your agent configuration and deploys it as a [LangSmith
40
40
|**`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
41
|**``user/``**| Per-user writable memory. If a `AGENTS.md` template is present in the `user` folder, the agents seeds the template per user (if the folder is empty the agents creates an empty `AGENTS.md`). Writable at runtime. Preloaded into the agent's context via the memory middleware. |
42
42
|**`mcp.json`**| MCP tools (HTTP/SSE). See [MCP docs](/oss/langchain/mcp). |
43
+
|**`subagents/`**| Specialized [subagents](/oss/deepagents/subagents) the main agent can delegate to. Each subdirectory contains its own `deepagents.toml`, `AGENTS.md`, and optionally a `skills` folder. See [subagents](#subagents). |
43
44
|**`sandbox`**| Optional execution environment. 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. See [sandbox providers](#sandbox-providers). |
44
45
45
46
## Install
@@ -107,6 +108,10 @@ my-agent/
107
108
│ │ └── SKILL.md
108
109
│ └── data-analysis/
109
110
│ └── SKILL.md
111
+
├── subagents/
112
+
│ └── researcher/
113
+
│ ├── deepagents.toml
114
+
│ └── AGENTS.md
110
115
└── user/
111
116
└── AGENTS.md
112
117
```
@@ -116,6 +121,7 @@ my-agent/
116
121
|`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 |
117
122
|`skills/`| Directory of [skill](/oss/deepagents/skills) definitions. Each subdirectory should contain a `SKILL.md` file. Read-only at runtime. | No |
118
123
|`user/`| Per-user writable memory. If a `AGENTS.md` template is present in the `user` folder, the agents seeds the template per user (if the folder is empty the agents creates an empty `AGENTS.md`). Writable at runtime. Preloaded into the agent's context via the memory middleware. | No |
124
+
|`subagents/`|[Subagents](#subagents) the main agent can delegate to. Each subdirectory must contain a `deepagents.toml`, `AGENTS.md`, and optionally a `skills` folder. Auto-discovered at bundle time. | No |
119
125
|`mcp.json`|[MCP](https://modelcontextprotocol.io/) server configuration. Only `http` and `sse` transports are supported in deployed contexts. | No |
120
126
|`.env`| Environment variables (API keys, secrets). Placed alongside `deepagents.toml` at the project root. | No |
121
127
@@ -153,12 +159,13 @@ model = "google_genai:gemini-3.1-pro-preview"
153
159
The `name` field is the only required value in the entire configuration file. Everything else has defaults.
154
160
</Note>
155
161
156
-
Skills, user memories, MCP servers, and model dependencies are auto-detected from the project layout — you don't declare them in `deepagents.toml`:
162
+
Skills, user memories, subagents, MCP servers, and model dependencies are auto-detected from the project layout:
157
163
158
164
-**Skills**: the bundler recursively scans `skills/`, skipping hidden dotfiles, and bundles the rest.
159
165
-**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 from and write to this file.
166
+
-**Subagents**: if `subagents/` exists, the bundler scans for valid subdirectories (each must contain `deepagents.toml` and `AGENTS.md`). The main agent receives a `task` tool to delegate work to each subagent by name. See [subagents](#subagents).
160
167
-**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).
161
-
-**Model dependencies**: the `provider:` prefix in the `model` field determines the required `langchain-*` package (e.g., `google_genai` -> `langchain-google-genai`).
168
+
-**Model dependencies**: the `provider:` prefix in the `model` field determines the required `langchain-*` package (e.g., `google_genai` -> `langchain-google-genai`). This includes models specified in subagent configs.
162
169
-**Sandbox dependencies**: the `[sandbox].provider` value maps to its partner package (e.g., `daytona` -> `langchain-daytona`).
163
170
164
171
### `[sandbox]`
@@ -256,6 +263,24 @@ template = "coding-agent"
256
263
image = "python:3.12"
257
264
```
258
265
266
+
A GTM strategy agent that delegates research to a subagent:
267
+
268
+
```txt
269
+
my-gtm-agent/
270
+
├── deepagents.toml
271
+
├── AGENTS.md
272
+
├── skills/
273
+
│ └── competitor-analysis/
274
+
│ └── SKILL.md
275
+
└── subagents/
276
+
└── market-researcher/
277
+
├── deepagents.toml
278
+
├── AGENTS.md
279
+
└── skills/
280
+
└── analyze-market/
281
+
└── SKILL.md
282
+
```
283
+
259
284
## User Memory
260
285
261
286
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:
@@ -283,17 +308,124 @@ At runtime, user memory is scoped per user via custom auth (`runtime.server_info
283
308
|`/memories/AGENTS.md`| No | Shared (assistant-scoped) |
284
309
|`/memories/skills/**`| No | Shared (assistant-scoped) |
|`/memories/subagents/<name>/**`| By subagent only | Per-subagent (isolated) |
286
312
287
313
### User identity
288
314
289
315
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.
290
316
291
-
## Gotchas
317
+
## Subagents
318
+
319
+
Subagents let the main agent delegate specialized tasks to isolated child agents. Each subagent has its own system prompt, optional skills, and optional MCP tools. The main agent receives a `task` tool that dispatches work to subagents by name.
320
+
321
+
For background on why subagents are useful and how they work at the SDK level, see [Subagents](/oss/deepagents/subagents).
322
+
323
+
### Directory structure
324
+
325
+
Create a `subagents/` directory at your project root. Each subdirectory is a subagent:
326
+
327
+
```txt
328
+
my-agent/
329
+
├── deepagents.toml
330
+
├── AGENTS.md
331
+
└── subagents/
332
+
├── researcher/
333
+
│ ├── deepagents.toml # name, description, optional model override
What this subagent does. The main agent uses this to decide when to delegate. Must be non-empty.
366
+
</ResponseField>
367
+
368
+
<ResponseFieldname="model"type="string">
369
+
Model override in `provider:model` format. Omit to inherit the main agent's model.
370
+
</ResponseField>
371
+
372
+
```toml subagents/researcher/deepagents.toml
373
+
[agent]
374
+
name = "researcher"
375
+
description = "Researches market trends, competitors, and target audiences"
376
+
model = "anthropic:claude-haiku-4-5-20251001"
377
+
```
378
+
379
+
### Inheritance
380
+
381
+
Subagents inherit some properties from the main agent by default:
382
+
383
+
| Property | Inherited | Notes |
384
+
| --- | --- | --- |
385
+
| Model | Yes | Override with `model` in the subagent's `deepagents.toml`|
386
+
| Tools | Yes | Override by adding `mcp.json` to the subagent directory |
387
+
| Skills | No | Declare explicitly in the subagent's own `skills/` directory |
388
+
389
+
### Memory isolation
390
+
391
+
Each subagent gets a dedicated, isolated memory namespace at `/memories/subagents/<name>/`. The subagent's `AGENTS.md` and skills are seeded into this namespace at deploy time.
-**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.
294
-
-**Full rebuild on deploy:**`deepagents deploy` creates a new revision on every invocation. Use `deepagents dev` for local iteration.
295
-
-**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.
296
-
-**MCP: HTTP/SSE only.** Stdio transports are rejected at bundle time.
297
429
## Limitations
298
430
299
431
-**MCP: HTTP/SSE only.** Stdio transports are rejected at bundle time.
Copy file name to clipboardExpand all lines: src/oss/deepagents/subagents.mdx
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -84,6 +84,8 @@ For most use cases, define subagents as dictionaries matching the @[`SubAgent`]
84
84
85
85
<Tip>
86
86
**CLI users:** You can also define subagents as `AGENTS.md` files on disk instead of in code. The `name`, `description`, and `model` fields map to YAML frontmatter, and the markdown body becomes the `system_prompt`. See [Custom subagents](/oss/deepagents/cli/overview#subagents) for the file format.
87
+
88
+
**Deploy users:** Define subagents as directories under `subagents/` with their own `deepagents.toml` and `AGENTS.md`. The bundler auto-discovers them. See [Deploy subagents](/oss/deepagents/deploy#subagents) for the full configuration reference.
0 commit comments