Skip to content

docs: add .use() with custom tools, update connectedAccounts to array#3357

Merged
abir-taheer merged 8 commits into
nextfrom
abir/docs-v31-customs-use-attach
May 8, 2026
Merged

docs: add .use() with custom tools, update connectedAccounts to array#3357
abir-taheer merged 8 commits into
nextfrom
abir/docs-v31-customs-use-attach

Conversation

@abir-taheer
Copy link
Copy Markdown
Contributor

Summary

  • Added "Attaching custom tools to an existing session" section to custom-tools-and-toolkits.mdx showing composio.use() with TS + Python examples
  • Updated all connectedAccounts examples from string to array format (string[]) matching the v3.1 SDK types shipped in feat(core): add custom tools support to session.use() via v3.1 attach #3350
  • Noted multi-account restriction: only one account per toolkit when multi-account mode is disabled
  • Updated users-and-sessions: session config is fixed at creation, except custom tools can be attached via .use()
  • Removed TypeScript-only qualifier for custom tools (Python now supported)

Files changed

  • docs/content/docs/toolkits/custom-tools-and-toolkits.mdx
  • docs/content/docs/configuring-sessions.mdx
  • docs/content/docs/users-and-sessions.mdx
  • docs/content/docs/managing-multiple-connected-accounts.mdx
  • docs/content/docs/sessions-vs-direct-execution.mdx
  • docs/content/docs/migration-guide/direct-to-sessions.mdx

Test plan

  • Verify docs build passes
  • Check new .use() section renders correctly with TS/Python tabs

🤖 Generated with Claude Code

@vercel
Copy link
Copy Markdown

vercel Bot commented May 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment May 8, 2026 9:56am

Request Review

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 7, 2026

Claude finished @abir-taheer's task in 1m 48s —— View job


Doc Review

  • Read docs-reviewer.md guidelines
  • Review diff against origin/next
  • Verify API claims against SDK source
  • Apply checklist to changed files

Looks good

Verified the technical claims against the SDK source:

Claim Verified
composio.use(id, { customTools }) exists in TS ts/packages/core/src/composio.ts:238-241 — accepts { customTools, customToolkits }
composio.use(session_id, custom_tools=[...]) exists in Python python/composio/core/models/tool_router.py:989 — accepts custom_tools and custom_toolkits
connectedAccounts: Record<string, string[]> (array) ts/packages/core/src/types/toolRouter.types.ts:204-209z.record(z.string(), z.array(z.string()))
Multi-account note wording Matches the schema's own description verbatim: "Only one account per toolkit is allowed when multi-account mode is disabled."
experimental_createTool import Re-exported from @composio/core at ts/packages/core/src/index.ts:38
await session.tools() (TS) / session.tools() (Python) TS is async (returns Promise), Python is sync — both usages correct

Other observations:

  • All connectedAccounts examples updated consistently across the 5 affected pages (configuring-sessions, managing-multiple-connected-accounts, migration-guide/direct-to-sessions, sessions-vs-direct-execution, custom-tools-and-toolkits keeps its existing examples unaffected).
  • "Sessions are immutable" → "Session configuration is fixed at creation" is the correct framing now that .use() can attach custom tools to an existing session.
  • Removing the TypeScript-only qualifier on custom tools is correct — Python now supports them.
  • New .use() examples follow the page's twoslash conventions (// @noErrors, declare const, // ---cut---).
  • No new pages or routes added, so no meta.json updates needed.

A developer copy-pasting any of these would land on working v3.1 code.
Branch: abir/docs-v31-customs-use-attach

Copilot AI review requested due to automatic review settings May 7, 2026 05:20
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 7, 2026

Claude finished @abir-taheer's task in 1m 43s —— View job


Doc Review

  • Read docs-reviewer.md guidelines
  • Review diff against origin/next
  • Apply checklist to changed files
  • Post review feedback

Verified the docs against the source:

  • TS API matches: Composio.use(id, { customTools?, customToolkits? }) at ts/packages/core/src/composio.ts:238
  • Python API matches: Composio.use(session_id, *, custom_tools=None, custom_toolkits=None) at python/composio/core/models/tool_router.py:989
  • connectedAccounts is now Record<string, string[]> per ts/packages/core/src/types/toolRouter.types.ts:204, and the schema's own description mirrors the new "only one account per toolkit when multi-account mode is disabled" line
  • New ## Attaching custom tools to an existing session heading slots cleanly between the customTools()/customToolkits() listing and ## Programmatic execution
  • users-and-sessions.mdx rewording correctly carves out the composio.use() exception
  • All cross-links resolve (/docs/managing-multiple-connected-accounts, /docs/toolkits/custom-tools-and-toolkits)

One stale qualifier missed

File: docs/content/docs/glossary.mdx:43

The PR description says "Removed TypeScript-only qualifier for custom tools (Python now supported)", and that qualifier is correctly stripped from configuring-sessions.mdx. But the glossary still has it:

A user-defined tool used alongside Composio's built-in tools. For sessions, use local experimental custom tools and custom toolkits (TypeScript only) via [Custom tools and toolkits](/docs/toolkits/custom-tools-and-toolkits). For direct execution, see [Creating custom tools](/docs/tools-direct/custom-tools).

Suggested fix — drop (TypeScript only):

A user-defined tool used alongside Composio's built-in tools. For sessions, use local experimental custom tools and custom toolkits via [Custom tools and toolkits](/docs/toolkits/custom-tools-and-toolkits). For direct execution, see [Creating custom tools](/docs/tools-direct/custom-tools).

Fix this →

Otherwise looks good — a developer copying the new .use() examples and the updated connectedAccounts array form will have a working result.
Branch: abir/docs-v31-customs-use-attach

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates documentation to reflect the v3.1 SDK behavior around session configuration and connected accounts, and adds guidance for attaching custom tools to an existing session via .use().

Changes:

  • Added a new “Attaching custom tools to an existing session” section with TypeScript + Python examples.
  • Updated all connectedAccounts/connected_accounts examples from string to string[] to match v3.1 SDK types.
  • Clarified session configuration immutability and the multi-account restriction when multi-account mode is disabled.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
docs/content/docs/users-and-sessions.mdx Clarifies session config immutability and documents the .use() custom tools exception.
docs/content/docs/toolkits/custom-tools-and-toolkits.mdx Adds .use() rehydration + custom tools attachment examples (TS/Python).
docs/content/docs/sessions-vs-direct-execution.mdx Updates connected accounts examples to array format in both TS and Python.
docs/content/docs/migration-guide/direct-to-sessions.mdx Updates migration examples to array format for connected accounts.
docs/content/docs/managing-multiple-connected-accounts.mdx Updates connected accounts pinning examples to array format.
docs/content/docs/configuring-sessions.mdx Removes TS-only wording for custom tools and updates connected accounts examples + adds restriction note.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/content/docs/toolkits/custom-tools-and-toolkits.mdx
Comment thread docs/content/docs/toolkits/custom-tools-and-toolkits.mdx
Comment thread docs/content/docs/toolkits/custom-tools-and-toolkits.mdx
Comment thread docs/content/docs/users-and-sessions.mdx Outdated
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 8, 2026

Claude finished @abir-taheer's task in 1m 48s —— View job


Doc Review

  • Read docs-reviewer.md guidelines
  • Review diff against origin/next
  • Apply checklist to changed files
  • Post review feedback

Verified the technical claims against the SDK source on next:

Claim Verified
composio.use(id, { customTools, customToolkits }) (TS) ts/packages/core/src/composio.ts:240-243
composio.use(session_id, *, custom_tools, custom_toolkits) (Python) python/composio/core/models/tool_router.py:1036-1042
connectedAccounts accepts string[] ts/packages/core/src/types/toolRouter.types.ts:210-211z.record(z.string(), z.union([z.string(), z.array(z.string())]))
Multi-account note wording Matches the schema's own .describe() verbatim
experimental_createTool re-export from @composio/core ts/packages/core/src/index.ts
await session.tools() (TS, async) / session.tools() (Python, sync) Both correct

connectedAccounts array migration is consistent across the 5 affected pages, and the new ## Attaching custom tools to an existing session section slots cleanly between the rest of the customTools/customToolkits content and ## Programmatic execution.

One stale qualifier still missing

File: docs/content/docs/glossary.mdx:43

The PR description and configuring-sessions.mdx correctly drop the "(TypeScript only)" qualifier, but the glossary still has it:

A user-defined tool used alongside Composio's built-in tools. For sessions, use local experimental custom tools and custom toolkits (TypeScript only) via [Custom tools and toolkits](/docs/toolkits/custom-tools-and-toolkits). For direct execution, see [Creating custom tools](/docs/tools-direct/custom-tools).

Suggested fix — drop (TypeScript only) since Python now supports custom tools via composio.use():

A user-defined tool used alongside Composio's built-in tools. For sessions, use local experimental custom tools and custom toolkits via [Custom tools and toolkits](/docs/toolkits/custom-tools-and-toolkits). For direct execution, see [Creating custom tools](/docs/tools-direct/custom-tools).

Fix this →

Re: the Copilot review comments

For context (these are not blocking — just noting why I'm not echoing them):

  • zod/v3 import — this is the canonical convention in this repo, used in 12 doc files. The Composio SDK's experimental tool/toolkit APIs are typed against Zod v3 schemas; switching to "zod" would actually break the example.
  • getUserProfile / get_user_profile not defined in the snippet — both are defined earlier in the same file (TS at line 84, Python at line 120). The new section uses the same declare const ...: ReturnType<typeof experimental_createTool> pattern that's already used at line 142 for the same identifier, with twoslash // ---cut--- hiding the boilerplate. Consistent with the rest of the page.
  • Inline composio.use() reference on users-and-sessions.mdx:114 — short pointer to a section that has full TS/Python examples one page over. Fine as-is.

Other than the glossary line, looks good — a developer following these examples on v3.1 will get working code.
Branch: abir/docs-v31-customs-use-attach

abir-taheer and others added 3 commits May 8, 2026 01:45
- Added "Attaching custom tools to an existing session" section to
  custom-tools-and-toolkits.mdx showing composio.use() with customs
- Updated all connectedAccounts examples to array format (string[])
  matching the v3.1 SDK types
- Updated configuring-sessions to note multi-account restriction
- Updated users-and-sessions: custom tools can be attached to existing
  sessions via .use()
- Removed TypeScript-only qualifier for custom tools

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@abir-taheer abir-taheer force-pushed the abir/docs-v31-customs-use-attach branch from ee1bc98 to 0172eed Compare May 8, 2026 08:48
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 8, 2026

Claude finished @abir-taheer's task in 1m 30s —— View job


Doc Review

  • Read docs-reviewer.md guidelines
  • Review diff against origin/next
  • Apply checklist to changed files
  • Post review feedback

Verified the technical claims against the SDK source on next:

Claim Verified
composio.use(id, { customTools, customToolkits }) (TS) ts/packages/core/src/composio.ts:240-243
composio.use(session_id, *, custom_tools, custom_toolkits) (Python) python/composio/core/models/tool_router.py:1036-1042
connectedAccounts accepts string | string[] ts/packages/core/src/types/toolRouter.types.ts:210-211z.record(z.string(), z.union([z.string(), z.array(z.string())]))
Multi-account note wording Matches the schema's own .describe() verbatim
experimental_createTool re-export from @composio/core ts/packages/core/src/index.ts
await session.tools() (TS, async) / session.tools() (Python, sync) Both correct

The connectedAccounts array migration is consistent across the 5 affected pages, the new <Callout> correctly notes that the single-string form is still accepted (matching the union in the schema), and the new ## Attaching custom tools to an existing session section slots cleanly between the rest of the customTools/customToolkits content and ## Programmatic execution.

One stale qualifier still missing

File: docs/content/docs/glossary.mdx:43

The PR description and configuring-sessions.mdx correctly drop the "(TypeScript only)" qualifier, but the glossary still has it (this push didn't touch glossary.mdx):

A user-defined tool used alongside Composio's built-in tools. For sessions, use local experimental custom tools and custom toolkits (TypeScript only) via [Custom tools and toolkits](/docs/toolkits/custom-tools-and-toolkits). For direct execution, see [Creating custom tools](/docs/tools-direct/custom-tools).

Suggested fix — drop (TypeScript only) since Python now supports custom tools via composio.use():

A user-defined tool used alongside Composio's built-in tools. For sessions, use local experimental custom tools and custom toolkits via [Custom tools and toolkits](/docs/toolkits/custom-tools-and-toolkits). For direct execution, see [Creating custom tools](/docs/tools-direct/custom-tools).

Fix this →

Re: the Copilot review comments

Not blocking — just noting why I'm not echoing them:

  • zod/v3 import — canonical convention in this repo (used in 12 doc files). The Composio SDK's experimental tool/toolkit APIs are typed against Zod v3 schemas; switching to "zod" would break the example.
  • getUserProfile / get_user_profile not defined in the snippet — both are defined earlier in the same file (TS at line 84, Python at line 120). The new section reuses the same declare const ...: ReturnType<typeof experimental_createTool> pattern already used at line 142 for the same identifier, with twoslash // ---cut--- hiding the boilerplate. Consistent with the rest of the page.
  • Inline composio.use() reference on users-and-sessions.mdx:114 — short pointer to a section that has full TS/Python examples one page over. Fine as-is.

Other than the glossary line, looks good — a developer following these examples on v3.1 will get working code.
Branch: abir/docs-v31-customs-use-attach

Python now supports custom tools and custom toolkits in sessions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 8, 2026

Claude finished @abir-taheer's task in 1m 40s —— View job


Doc Review

  • Read docs-reviewer.md guidelines
  • Review diff against origin/next
  • Apply checklist to changed files
  • Post review feedback

Looks good

Verified the technical claims against the SDK source on next:

Claim Verified
composio.use(id, { customTools, customToolkits }) (TS) ts/packages/core/src/composio.ts:240-243
composio.use(session_id, *, custom_tools, custom_toolkits) (Python) python/composio/core/models/tool_router.py:1036-1042
connectedAccounts accepts string | string[] ts/packages/core/src/types/toolRouter.types.ts:210-211z.record(z.string(), z.union([z.string(), z.array(z.string())]))
Multi-account <Callout> wording Matches the schema's .describe() verbatim
experimental_createTool re-export from @composio/core Re-exported in ts/packages/core/src/index.ts
await session.tools() (TS, async) / session.tools() (Python, sync) Both correct
Glossary "(TypeScript only)" qualifier Removed in commit 22d8ecb

Across the diff:

  • The connectedAccounts array migration is consistent across all 5 affected pages (configuring-sessions, managing-multiple-connected-accounts, migration-guide/direct-to-sessions, sessions-vs-direct-execution, plus the multi-account <Callout>).
  • The new <Callout> in configuring-sessions.mdx correctly documents that the single-string form is still accepted (matches the union in the schema) and only one account per toolkit when multi-account mode is off.
  • The new ## Attaching custom tools to an existing session section in custom-tools-and-toolkits.mdx:639 slots cleanly between the customTools/customToolkits listing and ## Programmatic execution.
  • users-and-sessions.mdx:110 rewording ("Sessions are immutable" → "Session configuration is fixed at creation") correctly carves out the composio.use() exception, with an inline link to the new section.
  • The previously flagged glossary qualifier on glossary.mdx:43 has been fixed in this push.

Re: the Copilot review comments

Not blocking — just noting why I'm not echoing them:

  • zod/v3 import — canonical convention in this repo (used in 12 doc files). The Composio SDK's experimental tool/toolkit APIs are typed against Zod v3 schemas; switching to "zod" would break the example.
  • getUserProfile / get_user_profile not defined in the snippet — both are defined earlier in the same file (TS at line 84, Python at line 120). The new section reuses the same declare const ...: ReturnType<typeof experimental_createTool> pattern already used at line 142 for the same identifier, with twoslash // ---cut--- hiding the boilerplate. Consistent with the rest of the page.
  • Inline composio.use() reference on users-and-sessions.mdx:114 — short pointer to a section that has full TS/Python examples one page over. Fine as-is.

A developer copy-pasting any of these examples on v3.1 will land on working code.
Branch: abir/docs-v31-customs-use-attach

Copy link
Copy Markdown
Contributor

@dhawal1 dhawal1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we update examples for vercel sdk etc or anywhere else in docs?


## Attaching custom tools to an existing session

Use `composio.use()` to rehydrate an existing session and attach custom tools to it. This is useful when you have a session ID from a previous `create()` call and want to bind custom tools in a different process or request.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess main usecase is for multi-turn chat apps like vercel ai sdk? Like let's not focus so much on custom tools it doesn't have high usage

Primary use case is multi-turn chat apps reusing a session across
requests. Custom tools are a secondary option when rehydrating.

- Added "Reusing a session" section to users-and-sessions.mdx
- Trimmed custom-tools page to a brief mention with link back
- Updated "When should I create a new session?" accordion

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 8, 2026

Claude encountered an error —— View job


Doc Review

  • Read docs-reviewer.md guidelines
  • Review diff against origin/next
  • Apply checklist to changed files
  • Post review feedback
• [Branch: abir/docs-v31-customs-use-attach](https://github.com/ComposioHQ/composio/tree/abir/docs-v31-customs-use-attach)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

⚠️ Secrets Detection Alert

Potential secrets or sensitive data have been detected in this pull request.

Action Required

  • Review the Gitleaks scan results in the workflow logs
  • Remove any hardcoded secrets, API keys, tokens, or sensitive data
  • Use environment variables or GitHub Secrets for sensitive values
  • Consider using Doppler for secret management (as per project standards)

Common Issues

  • API keys and tokens
  • Database credentials
  • Slack webhook URLs
  • Private keys
  • OAuth tokens

Resources

This PR cannot be merged until all secrets are removed.

cc: @abir-taheer

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 8, 2026

Claude finished @abir-taheer's task in 2m 42s —— View job


Doc Review

  • Read docs-reviewer.md guidelines
  • Review diff against origin/next
  • Apply checklist to changed files
  • Post review feedback

Looks good

Re-verified the technical claims against the SDK source on next HEAD:

Claim Verified
composio.use(id, { customTools, customToolkits }) (TS) ts/packages/core/src/composio.ts:240-243
composio.use(session_id, *, custom_tools, custom_toolkits) (Python) python/composio/core/models/tool_router.py:1036-1042
connectedAccounts accepts string | string[] ts/packages/core/src/types/toolRouter.types.ts:210-211z.record(z.string(), z.union([z.string(), z.array(z.string())]))
Multi-account <Callout> wording Matches the schema's .describe() verbatim
experimental_createTool re-export from @composio/core Re-exported in ts/packages/core/src/index.ts
await session.tools() (TS, async) / session.tools() (Python, sync) Both correct
Glossary "(TypeScript only)" qualifier Removed in commit 22d8ecb

Across the diff:

  • The connectedAccounts array migration is consistent across all 5 affected pages (configuring-sessions, managing-multiple-connected-accounts, migration-guide/direct-to-sessions, sessions-vs-direct-execution, plus the multi-account <Callout>). I grepped for connectedAccounts: / connected_accounts= across all docs — every session-config site has been updated; no stragglers.
  • The <Callout> in configuring-sessions.mdx:398 correctly documents that the single-string form is still accepted (matches the union in the schema).
  • The reframed ### Reusing a session section in users-and-sessions.mdx:110 carves out the composio.use() exception cleanly. The accordion wording in commit ea51d55 ("fundamentally different setup") is consistent with the section body, which still correctly states config is fixed at creation.
  • The new ## Reusing a session with custom tools section in custom-tools-and-toolkits.mdx:639 slots between the customTools/customToolkits listing and ## Programmatic execution, and correctly cross-links to /docs/users-and-sessions#reusing-a-session.

Note: PR description still says the section heading is "Attaching custom tools to an existing session", but commit 1252423 renamed it to "Reusing a session with custom tools". Just description drift — not a blocker.

Re: the Copilot review comments

Not blocking — just noting why I'm not echoing them:

  • zod/v3 import — canonical convention in this repo (used in 12 doc files). The Composio SDK's experimental tool/toolkit APIs are typed against Zod v3 schemas; switching to "zod" would break the example.
  • getUserProfile / get_user_profile not defined in the snippet — both are defined earlier in the same file (TS at line 84, Python at line 120). The new section reuses the same declare const ...: ReturnType<typeof experimental_createTool> pattern already used at line 142 for the same identifier, with twoslash // ---cut--- hiding the boilerplate. Consistent with the rest of the page.
  • Inline composio.use() reference on users-and-sessions.mdx — short pointer to a section that has full TS/Python examples one page over. Fine as-is.

Re: @dhawal1's comment about updating other docs

I checked — no other docs use the connectedAccounts session-config pattern with the old single-string form. Framework-integration docs (Vercel, OpenAI, LangChain, etc.) don't have multi-account session-config examples to update. The chat-app cookbook calls composio.create() per request rather than reusing via .use(); that could be a future cookbook-level rewrite but is outside the scope of this types/format-update PR.

A developer copy-pasting any of these examples on v3.1 will land on working code.
Branch: abir/docs-v31-customs-use-attach

Previously create() would return the same session ID for identical
configs. Now it always returns a new one for better isolation and
observability. Updated guidance to use composio.use() for multi-turn.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 8, 2026

Claude finished @abir-taheer's task in 1m 20s —— View job


Doc Review

  • Read docs-reviewer.md guidelines
  • Review diff against origin/next
  • Apply checklist to changed files
  • Post review feedback

Looks good

Re-verified the technical claims against the SDK source on next HEAD:

Claim Verified
composio.use(id, { customTools, customToolkits }) (TS) ts/packages/core/src/composio.ts:240-243
composio.use(session_id, *, custom_tools, custom_toolkits) (Python) python/composio/core/models/tool_router.py:1036-1042
connectedAccounts accepts string | string[] ts/packages/core/src/types/toolRouter.types.ts:210-211z.record(z.string(), z.union([z.string(), z.array(z.string())]))
<Callout> wording about coercion + multi-account Matches the schema's own .describe() ("Only one account per toolkit is allowed when multi-account mode is disabled")
experimental_createTool re-export from @composio/core Present in ts/packages/core/src/index.ts
await session.tools() (TS, async) / session.tools() (Python, sync) Both correct
(TypeScript only) glossary qualifier Removed in commit 22d8ecb
"create() returns a new session ID each time" claim Newly added in commit 19a6296, consistent with the JSDoc on composio.create() and the rationale for surfacing composio.use() for multi-turn

Across the diff:

  • The connectedAccounts array migration is consistent across all 5 affected pages (configuring-sessions, managing-multiple-connected-accounts, migration-guide/direct-to-sessions, sessions-vs-direct-execution, plus the multi-account <Callout>). I grepped — no stragglers using the old single-string form in session-config sites.
  • The <Callout> in configuring-sessions.mdx:398 correctly documents the backwards-compat coercion (matches the union in the schema).
  • The reframed ### Reusing a session section in users-and-sessions.mdx:110 and the new accordion wording (commit ea51d55) carve out the composio.use() exception cleanly. The latest commit 19a6296 adds the "every create() call returns a new session ID" note, which correctly justifies why .use() is the right tool for multi-turn (instead of relying on create() returning a stable ID for identical configs).
  • The new ## Reusing a session with custom tools section in custom-tools-and-toolkits.mdx:639 slots between the customTools/customToolkits listing and ## Programmatic execution, and cross-links correctly to /docs/users-and-sessions#reusing-a-session.

Minor: PR description still says the section heading is "Attaching custom tools to an existing session", but commit 1252423 renamed it to "Reusing a session with custom tools". Description drift only — not a blocker.

Re: the Copilot review comments

Not blocking — just noting why I'm not echoing them:

  • zod/v3 import — canonical convention in this repo (used in 12 doc files). The Composio SDK's experimental tool/toolkit APIs are typed against Zod v3 schemas; switching to "zod" would break the example.
  • getUserProfile / get_user_profile not defined in the snippet — both are defined earlier in the same file (TS at line 84, Python at line 120). The new section reuses the same declare const ...: ReturnType<typeof experimental_createTool> pattern already used at line 142 for the same identifier, with twoslash // ---cut--- hiding the boilerplate. Consistent with the rest of the page.
  • Inline composio.use() reference on users-and-sessions.mdx — short pointer to a section that has full TS/Python examples one page over. Fine as-is.

Re: @dhawal1's comment about updating other docs

I checked — no other docs use the connectedAccounts session-config pattern with the old single-string form. Framework-integration docs (Vercel, OpenAI, LangChain, etc.) don't have multi-account session-config examples to update. The chat-app cookbook calls composio.create() per request rather than reusing via .use(); that could be a future cookbook-level rewrite but is outside the scope of this types/format-update PR.

A developer copy-pasting any of these examples on v3.1 will land on working code.
Branch: abir/docs-v31-customs-use-attach

…viders

Shows the pattern of creating a session once, storing the ID, and
reusing it across requests with composio.use().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 8, 2026

Claude finished @abir-taheer's task in 2m 52s —— View job


Doc Review

  • Read docs-reviewer.md guidelines
  • Review diff against origin/next
  • Verify new provider examples (Vercel, OpenAI, Anthropic)
  • Apply checklist to changed files
  • Post review feedback

Latest push (75e42e9) adds ## Multi-turn chat sections to the Vercel, OpenAI, and Anthropic provider pages. Re-verified the technical claims against the SDK source on next:

Claim Verified
composio.use(id, { customTools, customToolkits }) (TS) ts/packages/core/src/composio.ts:240-243
composio.use(session_id, *, custom_tools, custom_toolkits) (Python) python/composio/core/models/tool_router.py:1036
connectedAccounts accepts string | string[] ts/packages/core/src/types/toolRouter.types.ts:210-211
session.sessionId (TS) / session.session_id (Python) composio.ts:224, tool_router.py:1023
await session.tools() (TS) / session.tools() (Python) Both correct
(TypeScript only) glossary qualifier Removed in 22d8ecb

One real issue in the new provider snippets

The new Multi-turn chat sections in anthropic.mdx and openai.mdx instantiate Composio without a provider, but the existing examples on those pages correctly pass AnthropicProvider() / OpenAIResponsesProvider(). This matters because session.tools() returns provider-wrapped tools — without the provider configured, an Anthropic developer copy-pasting the snippet gets OpenAI-formatted tools that won't work with client.messages.create({ tools }).

docs/content/docs/providers/anthropic.mdx:158-180 — Python and TypeScript snippets:

# Current
composio = Composio()
// Current
const composio = new Composio({ apiKey: 'your_api_key' });

Should match the existing example earlier on the page:

from composio_anthropic import AnthropicProvider
composio = Composio(provider=AnthropicProvider())
import { AnthropicProvider } from '@composio/anthropic';
const composio = new Composio({ provider: new AnthropicProvider() });

Fix this →

docs/content/docs/providers/openai.mdx:301-337 — same issue. The page has an IntegrationTabs for Responses API vs Chat Completions, with OpenAIResponsesProvider() and OpenAIProvider() respectively. The new section drops this distinction entirely. Either:

  • Wire up OpenAIResponsesProvider() (matches the page's primary "Responses API" example), or
  • Use IntegrationTabs to mirror the existing structure with both Responses + Chat Completions variants.

The Vercel page (vercel.mdx:60-87) gets this right — it includes new VercelProvider() and the full generateText({ ... }) round-trip, so a reader sees how the rehydrated tools actually plug into the AI SDK.

Other observations (not blocking)

  • connectedAccounts array migration is consistent across all 5 affected pages; no stragglers.
  • The <Callout> in configuring-sessions.mdx:398 correctly documents the string→array coercion (matches the union in the schema).
  • The reframed ### Reusing a session section + accordion wording (commits ea51d55, 19a6296) carve out the composio.use() exception cleanly. The new "every create() call returns a new session ID" note correctly justifies why .use() is the right tool for multi-turn.
  • The new ## Reusing a session with custom tools section in custom-tools-and-toolkits.mdx:639 slots between the customTools/customToolkits listing and ## Programmatic execution, and cross-links correctly.

Minor: PR description still says the section heading is "Attaching custom tools to an existing session", but commit 1252423 renamed it to "Reusing a session with custom tools". Description drift — not a blocker.

Re: the Copilot review comments

Not blocking — same reasoning as before:

  • zod/v3 import — canonical convention in this repo (used in 12 doc files); SDK's experimental tool/toolkit APIs are typed against Zod v3.
  • getUserProfile / get_user_profile — both are defined earlier in the same file (TS at line 84, Python at line 120). The new section reuses the same declare const ...: ReturnType<typeof experimental_createTool> pattern already used at line 142, with // ---cut--- hiding the boilerplate.
  • Inline composio.use() reference on users-and-sessions.mdx — short pointer to a section that has full TS/Python examples one page over.

Re: @dhawal1's question about updating other docs

The new provider examples (vercel.mdx, openai.mdx, anthropic.mdx) do address the multi-turn use case @dhawal1 flagged. With the provider-instantiation fix above, these will be the right reference. No other docs use the connectedAccounts session-config pattern with the old single-string form.
Branch: abir/docs-v31-customs-use-attach

Copy link
Copy Markdown
Contributor

@dhawal1 dhawal1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to update these
https://docs.composio.dev/docs/quickstart - eg vercel ai sdk
https://docs.composio.dev/cookbooks/chat-app
lets do a scan across docs for what all to update?

</Tab>
</Tabs>

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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess this will change with session.update docs?

@abir-taheer abir-taheer merged commit b131d2a into next May 8, 2026
12 checks passed
@abir-taheer abir-taheer deleted the abir/docs-v31-customs-use-attach branch May 8, 2026 10:06
abir-taheer added a commit that referenced this pull request May 8, 2026
)

## Summary

Follow-up to #3357 per Dhawal's review comments.

- **Chat-app cookbook**: Updated `route.ts` to create session once and
reuse via `composio.use(sessionId)` across requests — the correct
pattern for multi-turn chat apps
- Updated cookbook description to explain the create-once/reuse pattern

### What was checked but didn't need changes
- **Quickstart**: Single-turn examples, `.use()` doesn't apply
- **Provider docs** (OpenAI, Vercel, Anthropic, etc.): Already updated
with multi-turn sections in #3357
- **Other cookbook examples** (gmail-labeler, pr-review-agent, etc.):
Single-shot scripts, not multi-turn

## Test plan
- [ ] Verify docs build passes
- [ ] Check chat-app example renders correctly

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants