Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
docs: clarify session use wording
Abir Taheer committed
May 7, 2026 at 02:24 UTC
a0242d7b3a8441281b6925dbe898b35a22ea388a
2 files changed
+9
-10
.changeset/v31-customs-use-attach.md
+1
-1
@@ -4,6 +4,6 @@
4
5
Add custom tools support to `composio.use()`.
6
7
-- **`composio.use(id, { customTools, customToolkits })`**: Attach to an existing session through the v3.1 attach endpoint. When custom tools are provided, binds local tools for search and execution; when called without custom tools, it still uses attach with an empty body so session reuse has one backend path.
7
+- **`composio.use(id, { customTools, customToolkits })`**: Reuse an existing session and optionally bind SDK-local custom tools for search and execution.
8
- **Inline custom tools payload**: `use()` now correctly passes `inlineCustomToolsPayload` and `preloadedCustomToolSlugs` to the session, enabling custom tool execution and preloading on rehydrated sessions.
9
- **`CustomToolsMap.tools`**: The map now caches the raw `CustomTool[]` array for future inline re-injection on v3.1 search/execute requests.
python/composio/core/models/tool_router.py
+8
-9
@@ -998,15 +998,14 @@ class ToolRouter(Resource, t.Generic[TTool, TToolCollection]):
998
custom_toolkits: t.Optional[t.List[ExperimentalToolkit]] = None,
999
) -> ToolRouterSession[TTool, TToolCollection]:
1000
"""
1001
- Retrieve and use an existing tool router session, optionally attaching custom tools.
1001
+ Use an existing tool router session.
1002
1003
- The SDK always attaches to the session endpoint. When ``custom_tools``
1004
- or ``custom_toolkits`` are provided, they are included so they are
1005
- available for search and execution.
1003
+ Provide ``custom_tools`` or ``custom_toolkits`` to bind SDK-local tools
1004
+ to the session for search and execution.
1005
1007
- :param session_id: The session ID to retrieve
1008
- :param custom_tools: Optional custom tools to attach to the session.
1009
- :param custom_toolkits: Optional custom toolkits to attach to the session.
1006
+ :param session_id: The session ID to use.
1007
+ :param custom_tools: Optional custom tools to bind to the session.
1008
+ :param custom_toolkits: Optional custom toolkits to bind to the session.
1009
:return: Tool router session object
1010
1011
Example:
@@ -1015,10 +1014,10 @@ class ToolRouter(Resource, t.Generic[TTool, TToolCollection]):
1014
1015
composio = Composio()
1016
1018
- # Simple rehydration
1017
+ # Use an existing session
1018
session = composio.use('session_123')
1019
1021
- # Rehydration with custom tools
1020
+ # Use an existing session with custom tools
1021
session = composio.use(
1022
'session_123',
1023
custom_tools=[my_tool],