Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

next
mdx 134 lines 3.86 KB
Raw
1 ---
2 title: "Tool Router Improvements and New Features"
3 description: "Added waitForConnections property and other enhancements to Tool Router sessions"
4 date: "2026-01-12"
5 ---
6
7 ## Version Information
8
9 ### TypeScript/JavaScript
10 - Package: `@composio/core` and provider packages
11 - Version: `0.3.4` to `0.4.0`
12
13 ### Python
14 - Package: `composio-core` and provider packages
15 - Version: `0.10.4` to `0.10.5`
16
17 ## New Features
18
19 ### 1. Wait for Connections Property
20
21 Added `waitForConnections` (TypeScript) / `wait_for_connections` (Python) property to manage connections configuration. This allows tool router sessions to wait for users to complete authentication before proceeding to the next step.
22
23 **TypeScript:**
24 ```typescript
25 // @noErrors
26 const session = await composio.toolRouter.create(userId, {
27 manageConnections: {
28 enable: true,
29 callbackUrl: 'https://example.com/callback',
30 waitForConnections: true // NEW
31 }
32 });
33 ```
34
35 **Python:**
36 ```python
37 session = tool_router.create(
38 user_id="user_123",
39 manage_connections={
40 "enable": True,
41 "callback_url": "https://example.com/callback",
42 "wait_for_connections": True # NEW
43 }
44 )
45 ```
46
47 ### 2. Session-Specific Modifier Types
48
49 Introduced new modifier types for better session-based tool execution: `SessionExecuteMetaModifiers` and `SessionMetaToolOptions`.
50
51 **TypeScript:**
52 ```typescript
53 // @noErrors
54 const tools = await session.tools({
55 modifySchema: ({ toolSlug, toolkitSlug, schema }) => schema,
56 beforeExecute: ({ toolSlug, toolkitSlug, sessionId, params }) => params,
57 afterExecute: ({ toolSlug, toolkitSlug, sessionId, result }) => result
58 });
59 ```
60
61 **Python:**
62 ```python
63 from composio.core.models import before_execute_meta, after_execute_meta
64
65 @before_execute_meta
66 def before_modifier(tool, toolkit, session_id, params):
67 return params
68
69 @after_execute_meta
70 def after_modifier(tool, toolkit, session_id, response):
71 return response
72
73 tools = session.tools(modifiers=[before_modifier, after_modifier])
74 ```
75
76 ### 3. Dedicated Method for Tool Router Meta Tools
77
78 Added `getRawToolRouterMetaTools` (TypeScript) / `get_raw_tool_router_meta_tools` (Python) method in the Tools class for fetching meta tools directly from a tool router session.
79
80 **TypeScript:**
81 ```typescript
82 // @noErrors
83 const metaTools = await composio.tools.getRawToolRouterMetaTools('session_123', {
84 modifySchema: ({ toolSlug, toolkitSlug, schema }) => {
85 // Customize schema
86 return schema;
87 }
88 });
89 ```
90
91 **Python:**
92 ```python
93 meta_tools = tools_model.get_raw_tool_router_meta_tools(
94 session_id="session_123",
95 modifiers=[schema_modifier]
96 )
97 ```
98
99 ## Internal Improvements
100
101 ### 1. Performance Optimization
102
103 Eliminated unnecessary tool fetching during tool router execution, resulting in faster tool execution with fewer API calls.
104
105 ### 2. Improved Architecture
106
107 Tool router sessions now fetch tools directly from the session API endpoint instead of using tool slugs, providing better consistency and reliability.
108
109 ### 3. Simplified Implementation
110
111 Removed redundant tool schema fetching in execution paths, using a hardcoded 'composio' toolkit slug for meta tools.
112
113 ## Backward Compatibility
114
115 This release is fully backward compatible:
116
117 - All existing code continues to work without modifications
118 - New properties are optional with sensible defaults
119 - New modifier types can be adopted incrementally
120 - Internal changes have no impact on public APIs
121 - No migration required
122
123 ## Impact Summary
124
125 | Change | Runtime Breaking | TypeScript Breaking | Migration Required |
126 |--------|------------------|---------------------|-------------------|
127 | `wait_for_connections` property | No | No | No |
128 | Session-specific modifiers | No | No | No |
129 | `getRawToolRouterMetaTools` method | No | No | No |
130 | Tool router uses session API | No | No | No |
131 | Optimized tool execution | No | No | No |
132
133 All changes follow semantic versioning principles and maintain full backward compatibility.
134