Skip to content

Commit fe3f0f3

Browse files
authored
chore(oss/js): hide ToolRuntime from js tools docs (#1172)
1 parent 5c450d2 commit fe3f0f3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/oss/langchain/tools.mdx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ Define complex inputs with Pydantic models or JSON schemas:
146146
**Why this matters:** Tools are most powerful when they can access agent state, runtime context, and long-term memory. This enables tools to make context-aware decisions, personalize responses, and maintain information across conversations.
147147
</Info>
148148

149+
:::python
149150
Tools can access runtime information through the `ToolRuntime` parameter, which provides:
150151

151152
- **State** - Mutable data that flows through execution (messages, counters, custom fields)
@@ -163,7 +164,6 @@ Use `ToolRuntime` to access all runtime information in a single parameter. Simpl
163164
**`ToolRuntime`**: A unified parameter that provides tools access to state, context, store, streaming, config, and tool call ID. This replaces the older pattern of using separate @[`InjectedState`], @[`InjectedStore`], @[`get_runtime`], and @[`InjectedToolCallId`] annotations.
164165
</Info>
165166

166-
:::python
167167
**Accessing state:**
168168

169169
Tools can access the current graph state using `ToolRuntime`:
@@ -234,9 +234,9 @@ def update_user_name(
234234

235235
#### Context
236236

237+
:::python
237238
Access immutable configuration and contextual data like user IDs, session details, or application-specific configuration through `runtime.context`.
238239

239-
:::python
240240
Tools can access runtime context through `ToolRuntime`:
241241

242242
```python wrap
@@ -332,9 +332,9 @@ const result = await agent.invoke(
332332

333333
#### Memory (Store)
334334

335+
:::python
335336
Access persistent data across conversations using the store. The store is accessed via `runtime.store` and allows you to save and retrieve user-specific or application-specific data.
336337

337-
:::python
338338
Tools can access and update the store through `ToolRuntime`:
339339

340340
```python wrap expandable
@@ -384,6 +384,8 @@ agent.invoke({
384384
:::
385385

386386
:::js
387+
Access persistent data across conversations using the store. The store is accessed via `config.store` and allows you to save and retrieve user-specific or application-specific data.
388+
387389
```ts wrap expandable
388390
import * as z from "zod";
389391
import { createAgent, tool } from "langchain";
@@ -460,9 +462,9 @@ console.log(result);
460462

461463
#### Stream Writer
462464

465+
:::python
463466
Stream custom updates from tools as they execute using `runtime.stream_writer`. This is useful for providing real-time feedback to users about what a tool is doing.
464467

465-
:::python
466468
```python wrap
467469
from langchain.tools import tool, ToolRuntime
468470

@@ -484,6 +486,8 @@ If you use `runtime.stream_writer` inside your tool, the tool must be invoked wi
484486
:::
485487

486488
:::js
489+
Stream custom updates from tools as they execute using `config.streamWriter`. This is useful for providing real-time feedback to users about what a tool is doing.
490+
487491
```ts wrap
488492
import * as z from "zod";
489493
import { tool } from "langchain";
@@ -508,4 +512,3 @@ const getWeather = tool(
508512
);
509513
```
510514
:::
511-

0 commit comments

Comments
 (0)