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: add session.update() section to users-and-sessions
Shows how to modify a session's config (toolkits, auth configs, connected accounts, etc.) without creating a new session. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Abir Taheer committed
May 8, 2026 at 03:26 UTC
c1b1fa7fe875ca95953f9726e6c621259e762ba5
1 file changed
+32
-1
docs/content/docs/users-and-sessions.mdx
+32
-1
@@ -131,7 +131,38 @@ const tools = await session.tools();
131
</Tab>
132
</Tabs>
133
134
-This returns the same session with the same toolkits, auth configs, and connected accounts. The session's configuration is fixed at creation — to change toolkits or auth, create a new session.
134
+This returns the same session with the same toolkits, auth configs, and connected accounts.
135
+
136
+### Updating a session
137
+
138
+Use `session.update()` to modify a session's configuration without creating a new one. Only the fields you pass are changed — everything else is preserved.
139
+
140
+<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
141
+<Tab value="Python">
142
+```python
143
+session.update(
144
+ toolkits=["gmail", "slack"],
145
+ auth_configs={"gmail": "ac_new_config"},
146
+ connected_accounts={"slack": ["ca_work_slack"]},
147
+)
148
+```
149
+</Tab>
150
+<Tab value="TypeScript">
151
+```typescript
152
+import { Composio } from '@composio/core';
153
+const composio = new Composio({ apiKey: 'your_api_key' });
154
+const session = await composio.create("user_123");
155
+// ---cut---
156
+await session.update({
157
+ toolkits: ["gmail", "slack"],
158
+ authConfigs: { gmail: "ac_new_config" },
159
+ connectedAccounts: { slack: ["ca_work_slack"] },
160
+});
161
+```
162
+</Tab>
163
+</Tabs>
164
+
165
+You can update toolkits, auth configs, connected accounts, workbench settings, multi-account config, manage connections, tags, tools, and preload. See [Configuring Sessions](/docs/configuring-sessions) for the full list of options.
166
167
### Connected accounts persist across sessions
168