Skip to content

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 Taheera0242d7b3a84
diff --git a/.changeset/v31-customs-use-attach.md b/.changeset/v31-customs-use-attach.md
index 5ebd92800..640c22545 100644
--- a/.changeset/v31-customs-use-attach.md
+++ b/.changeset/v31-customs-use-attach.md
@@ -4,6 +4,6 @@
Add custom tools support to `composio.use()`.
-- **`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.
+- **`composio.use(id, { customTools, customToolkits })`**: Reuse an existing session and optionally bind SDK-local custom tools for search and execution.
- **Inline custom tools payload**: `use()` now correctly passes `inlineCustomToolsPayload` and `preloadedCustomToolSlugs` to the session, enabling custom tool execution and preloading on rehydrated sessions.
- **`CustomToolsMap.tools`**: The map now caches the raw `CustomTool[]` array for future inline re-injection on v3.1 search/execute requests.
diff --git a/python/composio/core/models/tool_router.py b/python/composio/core/models/tool_router.py
index 975f5e18e..162d5ff8d 100644
--- a/python/composio/core/models/tool_router.py
+++ b/python/composio/core/models/tool_router.py
@@ -998,15 +998,14 @@ class ToolRouter(Resource, t.Generic[TTool, TToolCollection]):
custom_toolkits: t.Optional[t.List[ExperimentalToolkit]] = None,
) -> ToolRouterSession[TTool, TToolCollection]:
"""
- Retrieve and use an existing tool router session, optionally attaching custom tools.
+ Use an existing tool router session.
- The SDK always attaches to the session endpoint. When ``custom_tools``
- or ``custom_toolkits`` are provided, they are included so they are
- available for search and execution.
+ Provide ``custom_tools`` or ``custom_toolkits`` to bind SDK-local tools
+ to the session for search and execution.
- :param session_id: The session ID to retrieve
- :param custom_tools: Optional custom tools to attach to the session.
- :param custom_toolkits: Optional custom toolkits to attach to the session.
+ :param session_id: The session ID to use.
+ :param custom_tools: Optional custom tools to bind to the session.
+ :param custom_toolkits: Optional custom toolkits to bind to the session.
:return: Tool router session object
Example:
@@ -1015,10 +1014,10 @@ class ToolRouter(Resource, t.Generic[TTool, TToolCollection]):
composio = Composio()
- # Simple rehydration
+ # Use an existing session
session = composio.use('session_123')
- # Rehydration with custom tools
+ # Use an existing session with custom tools
session = composio.use(
'session_123',
custom_tools=[my_tool],