Skip to content

Commit 998bbc8

Browse files
committed
doc: Improve sync/async section
1 parent ca8438b commit 998bbc8

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

README.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -181,16 +181,12 @@ result = await tool.ainvoke({"param1": "value1", "param2": "value2"})
181181
182182
### Synchronous vs. Asynchronous Usage
183183
184-
* **Asynchronous (Recommended for I/O):** Most SDKs prioritize asynchronous
185-
operations (`async`/`await`) for better performance in I/O-bound tasks like
186-
network calls to the Toolbox service. This requires running your code within
187-
an async event loop (e.g., using `asyncio.run()`). The default
188-
`toolbox-core` `ToolboxClient` is async. The `toolbox-langchain` package
189-
provides async methods like `aload_tool`, `aload_toolset`, `ainvoke`.
190-
* **Synchronous:** For simpler scripts or applications not built around
191-
asyncio, synchronous alternatives are provided. `toolbox-core` offers
192-
`ToolboxSyncClient` and `ToolboxSyncTool`. `toolbox-langchain` provides
193-
synchronous methods like `load_tool`, `load_toolset`, and `invoke`.
184+
| Package | Loading Tools | Invoking Tools | Docs |
185+
| :---------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------- |
186+
| **`toolbox-core`** | **Async:**<br/>* &nbsp;**Class:** `ToolboxClient`<br/>* &nbsp;**Methods:**<br/>&nbsp;&nbsp;&nbsp;* &nbsp;`await client.load_tool()`<br/>&nbsp;&nbsp;&nbsp;* &nbsp;`await client.load_toolset()`<br/><br/>**Sync:**<br/>* &nbsp;**Class:** `ToolboxSyncClient`<br/>* &nbsp;**Methods:**<br/>&nbsp;&nbsp;&nbsp;* &nbsp;`client.load_tool()`<br/>&nbsp;&nbsp;&nbsp;* &nbsp;`client.load_toolset()` | **Async:**<br/>* &nbsp;**Class:** `ToolboxTool`<br/>* &nbsp;**Invocation:** `await tool(...)`<br/><br/>**Sync:**<br/>* &nbsp;**Class:** `ToolboxSyncTool`<br/>* &nbsp;**Invocation:** `tool(...)` | [`toolbox-core` README](./packages/toolbox-core/README.md) |
187+
| **`toolbox-langchain`** | **Unified Class:** `ToolboxClient`<br/><br/>* &nbsp;**Async Methods:**<br/>&nbsp;&nbsp;&nbsp;* &nbsp;`await client.aload_tool()`<br/>&nbsp;&nbsp;&nbsp;* &nbsp;`await client.aload_toolset()`<br/><br/>* &nbsp;**Sync Methods:**<br/>&nbsp;&nbsp;&nbsp;* &nbsp;`client.load_tool()`<br/>&nbsp;&nbsp;&nbsp;* &nbsp;`client.load_toolset()` | **Unified Class:** `ToolboxTool`<br/><br/>* &nbsp;**Async Method:** `await tool.ainvoke()`<br/><br/>* &nbsp;**Sync Method:** `tool.invoke()` | [`toolbox-langchain` README](./packages/toolbox-langchain/README.md#synchronous-and-asynchronous-usage) |
188+
189+
The `ToolboxSyncClient` handles communication with the Toolbox service *synchronously* and produces `ToolboxSyncTool` instances when you load tools. You do not use the `await` keyword when interacting with these synchronous versions.
194190
195191
```py
196192
from toolbox_core import ToolboxSyncClient
@@ -272,7 +268,7 @@ result = auth_tool(input="some input")
272268
### Binding Parameter Values
273269
274270
Pre-set specific parameter values for a tool *before* it's invoked or passed to
275-
an LLM. Bound values are fixed and won't be requested from the LLM.
271+
an LLM. Bound parameter values are fixed and won't be requested from the LLM.
276272
277273
#### Why Bind Parameters?
278274

0 commit comments

Comments
 (0)