Skip to content

Commit 6daba93

Browse files
sydney-runklehntrl
andauthored
feat: update docs w/ new runtime attributes and utils (#3420)
see langchain-ai/langgraph#7363 for impl details --------- Co-authored-by: Hunter Lovell <40191806+hntrl@users.noreply.github.com>
1 parent 0dfbb46 commit 6daba93

File tree

8 files changed

+596
-128
lines changed

8 files changed

+596
-128
lines changed

src/oss/deepagents/async-subagents.mdx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,15 @@ Async subagents let a supervisor agent launch background tasks that return immed
77

88
This builds on [subagents](/oss/deepagents/subagents), which run synchronously and block the supervisor until completion. Use async subagents when tasks are long-running, parallelizable, or need mid-flight steering.
99

10-
<Warning>
10+
<Note>
1111
:::python
12-
Async subagents are a preview feature targeted for `deepagents` 0.5.0. You can try them now by installing a prerelease version. Preview features are under active development and are not recommended for production use.
13-
14-
For Python, install the `0.5.0a1` prerelease with `--pre` or `--allow-prereleases`.
12+
Async subagents are a preview feature available in `deepagents` 0.5.0. Preview features are under active development and APIs may change.
1513
:::
1614

1715
:::js
18-
Async subagents are a preview feature targeted for `deepagents` 1.9.0. You can try them now by installing a prerelease version. Preview features are under active development and are not recommended for production use.
19-
20-
For JavaScript, install the prerelease version explicitly, for example `deepagents@1.9.0-alpha.0`.
16+
Async subagents are a preview feature available in `deepagents` 1.9.0. Preview features are under active development and APIs may change.
2117
:::
22-
</Warning>
18+
</Note>
2319

2420
```mermaid
2521
graph TB

src/oss/deepagents/backends.mdx

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -220,62 +220,72 @@ NamespaceFactory = Callable[[BackendContext], tuple[str, ...]]
220220

221221
The `BackendContext` provides:
222222
- `ctx.runtime.context` — User-supplied context passed via LangGraph's [context schema](https://langchain-ai.github.io/langgraph/concepts/runtime/) (for example, `user_id`)
223+
:::python
224+
- `ctx.runtime.server_info` — Server-specific metadata when running on LangGraph Server (assistant ID, graph ID, authenticated user)
225+
- `ctx.runtime.execution_info` — Execution identity information (thread ID, run ID, checkpoint ID)
226+
:::
227+
:::js
228+
- `ctx.runtime.serverInfo` — Server-specific metadata when running on LangGraph Server (assistant ID, graph ID, authenticated user)
229+
- `ctx.runtime.executionInfo` — Execution identity information (thread ID, run ID, checkpoint ID)
230+
:::
223231
- `ctx.state` — Current agent state
224232

225-
For `assistant_id` and `thread_id`, use `langgraph.config.get_config()` inside the factory — these are available in LangGraph config metadata but not on the context schema.
233+
:::python
234+
<Note>
235+
`ctx.runtime.server_info` and `ctx.runtime.execution_info` require `deepagents>=0.5.0`.
236+
</Note>
237+
:::
238+
239+
:::js
240+
<Note>
241+
`ctx.runtime.serverInfo` and `ctx.runtime.executionInfo` require `deepagents>=1.9.0`.
242+
</Note>
243+
:::
226244

227245
**Common namespace patterns:**
228246

229247
:::python
230248
```python
231-
from langgraph.config import get_config
232249
from deepagents.backends import StoreBackend
233250

234251
# Per-user: each user gets their own isolated storage
235252
backend = StoreBackend(
236-
namespace=lambda ctx: (ctx.runtime.context.user_id,),
253+
namespace=lambda ctx: (ctx.runtime.server_info.user.identity,), # [!code highlight]
237254
)
238255

239256
# Per-assistant: all users of the same assistant share storage
240257
backend = StoreBackend(
241258
namespace=lambda ctx: (
242-
get_config()["metadata"]["assistant_id"],
259+
ctx.runtime.server_info.assistant_id, # [!code highlight]
243260
),
244261
)
245262

246263
# Per-thread: storage scoped to a single conversation
247264
backend = StoreBackend(
248265
namespace=lambda ctx: (
249-
get_config()["configurable"]["thread_id"],
266+
ctx.runtime.execution_info.thread_id, # [!code highlight]
250267
),
251268
)
252269
```
253270
:::
254271

255272
:::js
256273
```typescript
257-
import { getConfig } from "@langchain/langgraph";
258274
import { StoreBackend } from "deepagents";
259275

260276
// Per-user: each user gets their own isolated storage
261277
const backend = new StoreBackend({
262-
namespace: (ctx) => [ctx.runtime.context.userId],
278+
namespace: (ctx) => [ctx.runtime.serverInfo.user.identity], // [!code highlight]
263279
});
264280

265281
// Per-assistant: all users of the same assistant share storage
266282
const backend = new StoreBackend({
267-
namespace: (ctx) => {
268-
const config = getConfig();
269-
return [config.metadata.assistantId];
270-
},
283+
namespace: (ctx) => [ctx.runtime.serverInfo.assistantId], // [!code highlight]
271284
});
272285

273286
// Per-thread: storage scoped to a single conversation
274287
const backend = new StoreBackend({
275-
namespace: (ctx) => {
276-
const config = getConfig();
277-
return [config.configurable.threadId];
278-
},
288+
namespace: (ctx) => [ctx.runtime.executionInfo.threadId], // [!code highlight]
279289
});
280290
```
281291
:::

0 commit comments

Comments
 (0)