@devries-cameron20 / composio Mirror · read-only / commits / 6114ec290
Fork 0

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

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 21:00 UTC

docs: add composio.use() hints to all quickstart framework tabs

Each code example now shows how to store the session ID and reuse it with composio.use() instead of calling create() again, as commented code below the create call. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Abir Taheer committed May 8, 2026 at 13:32 UTC 6114ec290857a7afba02dc72887feeecad12f2ea
1 file changed +36 -7
docs/content/docs/quickstart.mdx
+36 -7
@@ -24,7 +24,7 @@ Give your OpenAI Agent access to 1000+ tools (Gmail, GitHub, Slack, Notion, etc.
24
25 **Key concepts**
26
27 -- **Session**: Scoped environment for a user. Created with `composio.create(userId)`. Sessions have access to all toolkits by default — the agent discovers which tools to use via `COMPOSIO_SEARCH_TOOLS`.
27 +- **Session**: Scoped environment for a user. Created with `composio.create(userId)`, reused with `composio.use(sessionId)`. Each `create()` returns a new session ID — store it and reuse for multi-turn conversations. Sessions have access to all toolkits by default.
28 - **Provider**: Translates Composio tools into the framework's tool format. For OpenAI Agents, use `OpenAIAgentsProvider`.
29 - **Authentication**: When a tool requires auth (e.g., GitHub OAuth), Composio returns an auth URL. The user authenticates once; Composio manages tokens.
30
@@ -123,6 +123,10 @@ user_id = "user_123"
123 session = composio.create(user_id=user_id)
124 tools = session.tools()
125
126 +# For multi-turn, store the session ID and reuse instead of calling create() again:
127 +# session_id = session.session_id
128 +# session = composio.use(session_id)
129 +
130 agent = Agent(
131 name="Personal Assistant",
132 instructions="You are a helpful personal assistant. Use Composio tools to take action.",
@@ -168,6 +172,10 @@ const userId = "user_123";
172 const session = await composio.create(userId);
173 const tools = await session.tools();
174
175 +// For multi-turn, store the session ID and reuse instead of calling create() again:
176 +// const sessionId = session.sessionId;
177 +// const session = await composio.use(sessionId);
178 +
179 const agent = new Agent({
180 name: "Personal Assistant",
181 instructions: "You are a helpful personal assistant. Use Composio tools to take action.",
@@ -212,7 +220,7 @@ Give your OpenAI Agent access to 1000+ tools (Gmail, GitHub, Slack, Notion, etc.
220
221 **Key concepts**
222
215 -- **Session**: Scoped environment for a user. Created with `composio.create(userId)`. Sessions have access to all toolkits by default — the agent discovers which tools to use via `COMPOSIO_SEARCH_TOOLS`.
223 +- **Session**: Scoped environment for a user. Created with `composio.create(userId)`, reused with `composio.use(sessionId)`. Each `create()` returns a new session ID — store it and reuse for multi-turn conversations. Sessions have access to all toolkits by default.
224 - **MCP mode**: Instead of using a provider package, you connect to Composio's hosted MCP server using `session.mcp.url` and `session.mcp.headers`. No `@composio/openai-agents` package needed.
225 - **Authentication**: When a tool requires auth (e.g., GitHub OAuth), Composio returns an auth URL. The user authenticates once; Composio manages tokens.
226
@@ -423,7 +431,7 @@ Give your Claude agent access to 1000+ tools (Gmail, GitHub, Slack, Notion, etc.
431
432 **Key concepts**
433
426 -- **Session**: Scoped environment for a user. Created with `composio.create(userId)`. Sessions have access to all toolkits by default — the agent discovers which tools to use via `COMPOSIO_SEARCH_TOOLS`.
434 +- **Session**: Scoped environment for a user. Created with `composio.create(userId)`, reused with `composio.use(sessionId)`. Each `create()` returns a new session ID — store it and reuse for multi-turn conversations. Sessions have access to all toolkits by default.
435 - **Provider**: Translates Composio tools into the framework's tool format. For Claude Agent SDK, use `ClaudeAgentSDKProvider`.
436 - **SDK MCP server**: Tools must be wrapped in an SDK MCP server via `create_sdk_mcp_server` / `createSdkMcpServer` before passing to `ClaudeAgentOptions.mcp_servers`. Do NOT pass tools directly.
437 - **Authentication**: When a tool requires auth (e.g., GitHub OAuth), Composio returns an auth URL. The user authenticates once; Composio manages tokens.
@@ -530,6 +538,10 @@ user_id = "user_123"
538 session = composio.create(user_id=user_id)
539 tools = session.tools()
540
541 +# For multi-turn, store the session ID and reuse instead of calling create() again:
542 +# session_id = session.session_id
543 +# session = composio.use(session_id)
544 +
545 custom_server = create_sdk_mcp_server(name="composio", version="1.0.0", tools=tools)
546
547 async def main():
@@ -582,6 +594,10 @@ const userId = "user_123";
594 const session = await composio.create(userId);
595 const tools = await session.tools();
596
597 +// For multi-turn, store the session ID and reuse instead of calling create() again:
598 +// const sessionId = session.sessionId;
599 +// const session = await composio.use(sessionId);
600 +
601 const customServer = createSdkMcpServer({
602 name: "composio",
603 version: "1.0.0",
@@ -642,7 +658,7 @@ Give your Claude agent access to 1000+ tools (Gmail, GitHub, Slack, Notion, etc.
658
659 **Key concepts**
660
645 -- **Session**: Scoped environment for a user. Created with `composio.create(userId)`. Sessions have access to all toolkits by default — the agent discovers which tools to use via `COMPOSIO_SEARCH_TOOLS`.
661 +- **Session**: Scoped environment for a user. Created with `composio.create(userId)`, reused with `composio.use(sessionId)`. Each `create()` returns a new session ID — store it and reuse for multi-turn conversations. Sessions have access to all toolkits by default.
662 - **MCP mode**: Instead of using a provider package, you connect to Composio's hosted MCP server using `session.mcp.url` and `session.mcp.headers`. No `@composio/claude-agent-sdk` package needed.
663 - **Authentication**: When a tool requires auth (e.g., GitHub OAuth), Composio returns an auth URL. The user authenticates once; Composio manages tokens.
664
@@ -878,7 +894,7 @@ Give your Vercel AI agent access to 1000+ tools (Gmail, GitHub, Slack, Notion, e
894
895 **Key concepts**
896
881 -- **Session**: Scoped environment for a user. Created with `composio.create(userId)`. Sessions have access to all toolkits by default — the agent discovers which tools to use via `COMPOSIO_SEARCH_TOOLS`.
897 +- **Session**: Scoped environment for a user. Created with `composio.create(userId)`, reused with `composio.use(sessionId)`. Each `create()` returns a new session ID — store it and reuse for multi-turn conversations. Sessions have access to all toolkits by default.
898 - **Provider**: Translates Composio tools into the framework's tool format. For Vercel AI, use `VercelProvider`.
899 - **streamText vs generateText**: Use `streamText` for streaming responses, `generateText` for single responses. Both accept Composio tools via the `tools` parameter.
900 - **Authentication**: When a tool requires auth (e.g., GitHub OAuth), Composio returns an auth URL. The user authenticates once; Composio manages tokens.
@@ -962,6 +978,10 @@ const userId = "user_123";
978 const session = await composio.create(userId);
979 const tools = await session.tools();
980
981 +// For multi-turn, store the session ID and reuse instead of calling create() again:
982 +// const sessionId = session.sessionId;
983 +// const session = await composio.use(sessionId);
984 +
985 const readline = createInterface({ input: process.stdin, output: process.stdout });
986
987 console.log(`
@@ -1018,7 +1038,7 @@ Give your Vercel AI agent access to 1000+ tools (Gmail, GitHub, Slack, Notion, e
1038
1039 **Key concepts**
1040
1021 -- **Session**: Scoped environment for a user. Created with `composio.create(userId)`. Sessions have access to all toolkits by default — the agent discovers which tools to use via `COMPOSIO_SEARCH_TOOLS`.
1041 +- **Session**: Scoped environment for a user. Created with `composio.create(userId)`, reused with `composio.use(sessionId)`. Each `create()` returns a new session ID — store it and reuse for multi-turn conversations. Sessions have access to all toolkits by default.
1042 - **MCP mode**: Instead of using a provider package, you connect to Composio's hosted MCP server using `session.mcp.url` and `session.mcp.headers` via `@ai-sdk/mcp`. No `@composio/vercel` package needed.
1043 - **Client lifecycle**: Always close the MCP client with `await client.close()` when done.
1044 - **Authentication**: When a tool requires auth (e.g., GitHub OAuth), Composio returns an auth URL. The user authenticates once; Composio manages tokens.
@@ -1103,7 +1123,12 @@ const composio = new Composio();
1123
1124 // Create a session for your user
1125 const userId = "user_123";
1106 -const { mcp } = await composio.create(userId);
1126 +const composioSession = await composio.create(userId);
1127 +const { mcp } = composioSession;
1128 +
1129 +// For multi-turn, store the session ID and reuse instead of calling create() again:
1130 +// const sessionId = composioSession.sessionId;
1131 +// const composioSession = await composio.use(sessionId);
1132
1133 // Create an MCP client to connect to Composio
1134 const client = await createMCPClient({
@@ -1173,6 +1198,10 @@ readline.close();
1198 By default, sessions have access to **all available toolkits** in the Composio catalog. Your agent can discover and use any of them through `COMPOSIO_SEARCH_TOOLS`. To restrict which toolkits are available, see [Enable and disable toolkits](/docs/toolkits/enable-and-disable-toolkits).
1199 </Callout>
1200
1201 +<Callout>
1202 +Every `composio.create()` call returns a new session ID. For multi-turn conversations or web apps, store the session ID and call `composio.use(sessionId)` on subsequent requests instead of creating a new session each time. See [Reusing a session](/docs/users-and-sessions#reusing-a-session).
1203 +</Callout>
1204 +
1205 ## Next steps
1206
1207 <Cards>