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: merge Tool Router section into main docs

Sushmithamalleshc5369010b3ef
diff --git a/docs/app/(home)/tool-router/[[...slug]]/page.tsx b/docs/app/(home)/tool-router/[[...slug]]/page.tsx
deleted file mode 100644
index e46bb881b..000000000
--- a/docs/app/(home)/tool-router/[[...slug]]/page.tsx
+++ /dev/null
@@ -1,6 +0,0 @@
-import { toolRouterSource } from '@/lib/source';
-import { createDocsPage, createGenerateStaticParams, createGenerateMetadata } from '@/lib/create-docs-page';
-
-export default createDocsPage(toolRouterSource);
-export const generateStaticParams = createGenerateStaticParams(toolRouterSource);
-export const generateMetadata = createGenerateMetadata(toolRouterSource);
diff --git a/docs/app/(home)/tool-router/layout.tsx b/docs/app/(home)/tool-router/layout.tsx
deleted file mode 100644
index 719298a5a..000000000
--- a/docs/app/(home)/tool-router/layout.tsx
+++ /dev/null
@@ -1,4 +0,0 @@
-import { toolRouterSource } from '@/lib/source';
-import { createDocsLayout } from '@/lib/create-docs-layout';
-
-export default createDocsLayout(toolRouterSource);
diff --git a/docs/app/api/search/route.ts b/docs/app/api/search/route.ts
index 15f4d51d4..255cf2b94 100644
--- a/docs/app/api/search/route.ts
+++ b/docs/app/api/search/route.ts
@@ -1,5 +1,5 @@
// Use direct imports from collections to avoid top-level await in lib/source.ts
-import { docs, toolRouter, examples, toolkits } from 'fumadocs-mdx:collections/server';
+import { docs, examples, toolkits } from 'fumadocs-mdx:collections/server';
import { createSearchAPI } from 'fumadocs-core/search/server';
import { loader } from 'fumadocs-core/source';
import { lucideIconsPlugin } from 'fumadocs-core/source/lucide-icons';
@@ -11,12 +11,6 @@ const docsSource = loader({
plugins: [lucideIconsPlugin()],
});
-const toolRouterSource = loader({
- baseUrl: '/tool-router',
- source: toolRouter.toFumadocsSource(),
- plugins: [lucideIconsPlugin()],
-});
-
const examplesSource = loader({
baseUrl: '/examples',
source: examples.toFumadocsSource(),
@@ -31,7 +25,6 @@ const toolkitsSource = loader({
const allPages = [
...docsSource.getPages(),
- ...toolRouterSource.getPages(),
...examplesSource.getPages(),
...toolkitsSource.getPages(),
];
diff --git a/docs/app/llms.mdx/[[...slug]]/route.ts b/docs/app/llms.mdx/[[...slug]]/route.ts
index 613f938bb..2a4740c52 100644
--- a/docs/app/llms.mdx/[[...slug]]/route.ts
+++ b/docs/app/llms.mdx/[[...slug]]/route.ts
@@ -1,6 +1,5 @@
import {
source,
- toolRouterSource,
referenceSource,
examplesSource,
toolkitsSource,
@@ -377,7 +376,6 @@ async function openapiPageToMarkdown(
// Map URL prefixes to their sources
const sources = [
{ prefix: 'docs', source },
- { prefix: 'tool-router', source: toolRouterSource },
{ prefix: 'reference', source: referenceSource },
{ prefix: 'examples', source: examplesSource },
{ prefix: 'toolkits', source: toolkitsSource },
diff --git a/docs/content/tool-router/using-in-chat-authentication.mdx b/docs/content/docs/authenticating-users/in-chat-authentication.mdx
similarity index 99%
rename from docs/content/tool-router/using-in-chat-authentication.mdx
rename to docs/content/docs/authenticating-users/in-chat-authentication.mdx
index 9afff3294..7f535361f 100644
--- a/docs/content/tool-router/using-in-chat-authentication.mdx
+++ b/docs/content/docs/authenticating-users/in-chat-authentication.mdx
@@ -1,5 +1,5 @@
---
-title: Using In-chat authentication
+title: In-chat authentication
description: Let your agent prompt users to connect accounts during conversation
keywords: [automatic auth, dynamic auth, agent prompts]
---
diff --git a/docs/content/tool-router/manually-authenticating-users.mdx b/docs/content/docs/authenticating-users/manually-authenticating.mdx
similarity index 100%
rename from docs/content/tool-router/manually-authenticating-users.mdx
rename to docs/content/docs/authenticating-users/manually-authenticating.mdx
diff --git a/docs/content/docs/authenticating-users/meta.json b/docs/content/docs/authenticating-users/meta.json
new file mode 100644
index 000000000..3499847f0
--- /dev/null
+++ b/docs/content/docs/authenticating-users/meta.json
@@ -0,0 +1,7 @@
+{
+ "title": "Authenticating users",
+ "pages": [
+ "in-chat-authentication",
+ "manually-authenticating"
+ ]
+}
diff --git a/docs/content/docs/authentication.mdx b/docs/content/docs/authentication.mdx
index 3a51961a2..4031deac3 100644
--- a/docs/content/docs/authentication.mdx
+++ b/docs/content/docs/authentication.mdx
@@ -23,7 +23,7 @@ You: Done
Agent: Done! I've starred ComposioHQ/composio.
```
-This flow works well for chat applications where users interact directly with the agent. See [Using in-chat authentication](/tool-router/using-in-chat-authentication).
+This flow works well for chat applications where users interact directly with the agent. See [In-chat authentication](/docs/authenticating-users/in-chat-authentication).
## Manual authentication
@@ -50,7 +50,7 @@ console.log(connectionRequest.redirectUrl);
</Tab>
</Tabs>
-Use this when you want users to connect accounts during onboarding, or when building a custom connections page. See [Manually authenticating users](/tool-router/manually-authenticating-users) for a detailed guide.
+Use this when you want users to connect accounts during onboarding, or when building a custom connections page. See [Manually authenticating users](/docs/authenticating-users/manually-authenticating) for a detailed guide.
## How Tool Router manages auth configs
@@ -67,9 +67,9 @@ You don't need to create auth configs manually for most toolkits.
Tool Router supports **Composio managed OAuth** (GitHub, Gmail, Slack, and most toolkits) and **API key auth** (users enter their own keys via Connect Link).
<Callout type="info">
-Toolkits without Composio managed auth require a custom auth config. See [Using custom auth configs](/tool-router/using-custom-auth-configs).
+Toolkits without Composio managed auth require a custom auth config. See [Using custom auth configs](/docs/guides/using-custom-auth-configuration).
</Callout>
## White-labeling
-Show your own branding on OAuth consent screens by creating your own OAuth app. See [White-labeling authentication](/tool-router/white-labeling-authentication).
+Show your own branding on OAuth consent screens by creating your own OAuth app. See [White-labeling authentication](/docs/guides/white-labeling-authentication).
diff --git a/docs/content/tool-router/managing-multiple-accounts.mdx b/docs/content/docs/guides/managing-multiple-connected-accounts.mdx
similarity index 99%
rename from docs/content/tool-router/managing-multiple-accounts.mdx
rename to docs/content/docs/guides/managing-multiple-connected-accounts.mdx
index 6663c352f..ff3245053 100644
--- a/docs/content/tool-router/managing-multiple-accounts.mdx
+++ b/docs/content/docs/guides/managing-multiple-connected-accounts.mdx
@@ -1,5 +1,5 @@
---
-title: Managing multiple accounts
+title: Managing multiple connected accounts
description: Handle users with multiple accounts for the same toolkit
keywords: [multiple accounts, work personal, switch account]
---
diff --git a/docs/content/docs/guides/multitenancy.mdx b/docs/content/docs/guides/multitenancy.mdx
new file mode 100644
index 000000000..06c537946
--- /dev/null
+++ b/docs/content/docs/guides/multitenancy.mdx
@@ -0,0 +1,5 @@
+---
+title: Multitenancy
+description: Build multi-tenant applications with Composio
+---
+
diff --git a/docs/content/tool-router/using-custom-auth-configs.mdx b/docs/content/docs/guides/using-custom-auth-configuration.mdx
similarity index 97%
rename from docs/content/tool-router/using-custom-auth-configs.mdx
rename to docs/content/docs/guides/using-custom-auth-configuration.mdx
index 860278cb3..be2cff153 100644
--- a/docs/content/tool-router/using-custom-auth-configs.mdx
+++ b/docs/content/docs/guides/using-custom-auth-configuration.mdx
@@ -1,5 +1,5 @@
---
-title: Using custom auth configs
+title: Using custom auth configuration
description: Set up auth configs for toolkits without Composio managed authentication
keywords: [custom credentials, no managed auth]
---
diff --git a/docs/content/tool-router/white-labeling-authentication.mdx b/docs/content/docs/guides/white-labeling-authentication.mdx
similarity index 100%
rename from docs/content/tool-router/white-labeling-authentication.mdx
rename to docs/content/docs/guides/white-labeling-authentication.mdx
diff --git a/docs/content/docs/meta.json b/docs/content/docs/meta.json
index c1362d03b..d3405aa78 100644
--- a/docs/content/docs/meta.json
+++ b/docs/content/docs/meta.json
@@ -3,11 +3,20 @@
"---Get Started---",
"index",
"quickstart",
+ "quickstart-tool-router",
"providers",
"---Core Concepts---",
"users-and-sessions",
"authentication",
"tools-and-toolkits",
+ "---Getting Started---",
+ "authenticating-users",
+ "toolkits",
+ "---Guides---",
+ "guides/white-labeling-authentication",
+ "guides/managing-multiple-connected-accounts",
+ "guides/using-custom-auth-configuration",
+ "guides/multitenancy",
"---Tools---",
"fetching-tools",
"authenticating-tools",
diff --git a/docs/content/docs/migration-guide/tool-router-beta.mdx b/docs/content/docs/migration-guide/tool-router-beta.mdx
index 0d08b3282..fbd2d5ebc 100644
--- a/docs/content/docs/migration-guide/tool-router-beta.mdx
+++ b/docs/content/docs/migration-guide/tool-router-beta.mdx
@@ -103,11 +103,11 @@ const session = await composio.create('user_123',
Check out these new features available in the stable version:
-- **[Native tools](/tool-router/using-as-a-native-tool)**: Use Tool Router with any AI framework
+- **[Native tools](/docs/providers)**: Use Tool Router with any AI framework
- **Better [session](/docs/users-and-sessions) and [auth](/docs/authentication) config**
-- **[Multi-account support](/tool-router/managing-multiple-accounts)**: Manage multiple accounts per user seamlessly
-- **[Manual authentication](/tool-router/manually-authenticating-users)**: Control when and how users authenticate
-- **[Custom auth](/tool-router/using-custom-auth-configs)**: Support for toolkits that don't have composio managed auth
-- **[White labeling](/tool-router/white-labeling-authentication)**: Customize authentication screens with your branding
+- **[Multi-account support](/docs/guides/managing-multiple-connected-accounts)**: Manage multiple accounts per user seamlessly
+- **[Manual authentication](/docs/authenticating-users/manually-authenticating)**: Control when and how users authenticate
+- **[Custom auth](/docs/guides/using-custom-auth-configuration)**: Support for toolkits that don't have composio managed auth
+- **[White labeling](/docs/guides/white-labeling-authentication)**: Customize authentication screens with your branding
</Step>
</Steps>
diff --git a/docs/content/docs/providers/anthropic.mdx b/docs/content/docs/providers/anthropic.mdx
index 65ed34f3f..69a2a17a2 100644
--- a/docs/content/docs/providers/anthropic.mdx
+++ b/docs/content/docs/providers/anthropic.mdx
@@ -6,9 +6,190 @@ keywords: [claude]
The Anthropic Provider transforms Composio tools into a format compatible with Anthropic's function calling capabilities through its Messages API.
-## Setup
+## Usage with MCP
-The Anthropic provider can be installed for both SDKs.
+Use Composio Tool Router with the Claude Agent SDK for a fully managed MCP experience.
+
+### Installation
+
+<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
+<Tab value="Python">
+```bash
+pip install python-dotenv composio claude-agent-sdk
+```
+</Tab>
+<Tab value="TypeScript">
+```bash
+npm install dotenv @composio/core @anthropic-ai/claude-agent-sdk
+```
+</Tab>
+</Tabs>
+
+### Usage
+
+Create a Tool Router session and execute tasks with Claude:
+
+<Callout type="info">
+- Set your `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
+- Set your `ANTHROPIC_API_KEY` environment variable with your [Anthropic API key](https://platform.claude.com/settings/keys).
+</Callout>
+
+<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
+<Tab value="Python">
+```python
+import asyncio
+from dotenv import load_dotenv
+from claude_agent_sdk.client import ClaudeSDKClient
+from claude_agent_sdk.types import (
+ ClaudeAgentOptions,
+ AssistantMessage,
+ TextBlock,
+ ToolUseBlock,
+)
+from composio import Composio
+
+load_dotenv()
+
+# Initialize Composio (API key from env var COMPOSIO_API_KEY or pass explicitly)
+composio = Composio()
+
+# Unique identifier of the user
+user_id = "user_123"
+# Create a tool router session for the user
+session = composio.create(user_id=user_id)
+
+# Configure Claude with Composio MCP server
+options = ClaudeAgentOptions(
+ system_prompt=(
+ "You are a helpful assistant with access to external tools. "
+ "Always use the available tools to complete user requests."
+ ),
+ mcp_servers={
+ "composio": {
+ "type": "http",
+ "url": session.mcp.url,
+ "headers": session.mcp.headers, # Authentication headers for the Composio MCP server
+ }
+ },
+ permission_mode="bypassPermissions", # Auto-approve tools (demo only)
+)
+
+async def main():
+ print("""
+What task would you like me to help you with?
+I can use tools like Gmail, GitHub, Linear, Notion, and more.
+(Type 'exit' to exit)
+Example tasks:
+ • 'Summarize my emails from today'
+ • 'List all open issues on the composio github repository and create a notion page with the issues'
+""")
+
+ async with ClaudeSDKClient(options) as client:
+ # Multi-turn conversation with agentic tool calling
+ while True:
+ user_input = input("\nYou: ").strip()
+ if user_input.lower() == "exit":
+ break
+
+ print("\nClaude: ", end="", flush=True)
+ try:
+ await client.query(user_input)
+ async for msg in client.receive_response():
+ if isinstance(msg, AssistantMessage):
+ for block in msg.content:
+ if isinstance(block, ToolUseBlock):
+ print(f"\n[Using tool: {block.name}]", end="")
+ elif isinstance(block, TextBlock):
+ print(block.text, end="", flush=True)
+ except Exception as e:
+ print(f"\n[Error]: {e}")
+
+if __name__ == "__main__":
+ asyncio.run(main())
+```
+</Tab>
+<Tab value="TypeScript">
+```typescript
+import "dotenv/config";
+import { query, type Options } from "@anthropic-ai/claude-agent-sdk";
+import { Composio } from "@composio/core";
+import { createInterface } from "readline/promises";
+
+// Initialize Composio (API key from env var COMPOSIO_API_KEY or pass explicitly: { apiKey: "your-key" })
+const composio = new Composio();
+
+// Unique identifier of the user
+const userId = "user_123";
+
+// Create a tool router session for the user
+const session = await composio.create(userId);
+
+const options: Options = {
+ systemPrompt: `You are a helpful assistant with access to external tools. ` +
+ `Always use the available tools to complete user requests.`,
+ mcpServers: {
+ composio: {
+ type: "http",
+ url: session.mcp.url,
+ headers: session.mcp.headers // Authentication headers for the Composio MCP server
+ },
+ },
+ permissionMode: "bypassPermissions", // Auto-approve tools (demo only - use "default" in production)
+};
+
+// Set up interactive terminal input/output for the conversation
+const readline = createInterface({ input: process.stdin, output: process.stdout });
+
+console.log(`
+What task would you like me to help you with?
+I can use tools like Gmail, GitHub, Linear, Notion, and more.
+(Type 'exit' to exit)
+Example tasks:
+ • 'Summarize my emails from today'
+ • 'List all open issues on the composio github repository and create a notion page with the issues'
+`);
+
+let isFirstQuery = true;
+
+// Multi-turn conversation with agentic tool calling
+while (true) {
+ const answer = await readline.question('You: ');
+ const input = answer.trim();
+ if (input.toLowerCase() === "exit") break;
+
+ process.stdout.write("Claude: ");
+
+ const queryOptions = isFirstQuery ? options : { ...options, continue: true };
+ isFirstQuery = false;
+
+ try {
+ for await (const stream of query({ prompt: input, options: queryOptions })) {
+ // Only process assistant messages (the SDK also sends result/error messages)
+ if (stream.type === "assistant") {
+ const { content } = stream.message;
+ for (const block of content) {
+ if (block.type === "tool_use") {
+ process.stdout.write(`\n[Using tool: ${block.name}]`);
+ } else if (block.type === "text") {
+ process.stdout.write(block.text);
+ }
+ }
+ }
+ }
+ } catch (error) {
+ console.error("\n[Error]:", error instanceof Error ? error.message : error);
+ }
+ process.stdout.write("\n");
+}
+
+readline.close();
+```
+</Tab>
+</Tabs>
+
+## Usage with direct tools
+
+### Setup
<Tabs items={["Python", "TypeScript"]}>
<Tab value="Python">
@@ -55,7 +236,7 @@ const anthropic = new Anthropic();
</Tab>
</Tabs>
-## Usage
+### Usage
<Tabs items={["Python", "TypeScript"]}>
<Tab value="Python">
@@ -112,108 +293,3 @@ console.log(res[0].content);
```
</Tab>
</Tabs>
-
-## Modifiers
-
-Modifiers are functions that can be used to intercept and optionally modify the schema, the tool call request and the response from the tool call.
-
-Anthropic provider modifiers are the standard framework modifiers. Read more here: [Modifying tool schemas](/docs/modify-tool-behavior/modifying-tool-schemas).
-
-## Usage: Direct MCP Servers
-
-You can also use Composio MCP servers directly with the Anthropic SDK.
-
-<Callout type="info">
-Composio MCP servers only support Streamable HTTP transport.
-</Callout>
-
-<Tabs items={["Python", "TypeScript"]}>
-<Tab value="Python">
-```python
-from anthropic import Anthropic
-from composio import Composio
-
-# Initialize clients
-composio = Composio()
-anthropic = Anthropic(api_key="your-anthropic-api-key")
-
-# Create MCP server with GitHub and Linear tools
-server = composio.mcp.create(
- name="dev-workflow-server",
- toolkits=[
- {"toolkit": "github", "auth_config": "ac_github_id"},
- {"toolkit": "linear", "auth_config": "ac_linear_id"}
- ],
- allowed_tools=["GITHUB_LIST_PRS", "GITHUB_CREATE_COMMENT", "LINEAR_CREATE_ISSUE"]
-)
-
-# Generate MCP instance for user
-instance = server.generate("[email protected]")
-
-# Use MCP with Anthropic to manage development workflow
-response = anthropic.beta.messages.create(
- model="claude-sonnet-4-5",
- system="You are a helpful assistant with access to GitHub and Linear tools. Use these tools to help manage development workflows. Do not ask for confirmation before using the tools.",
- max_tokens=1000,
- messages=[{
- "role": "user",
- "content": "Check my GitHub PRs for review comments, create Linear tasks for any requested changes, and update the PR descriptions with task links"
- }],
- mcp_servers=[{
- "type": "url",
- "url": instance['url'],
- "name": "composio-mcp-server"
- }],
- betas=["mcp-client-2025-04-04"] # Enable MCP beta
-)
-
-print(response.content)
-```
-</Tab>
-<Tab value="TypeScript">
-```typescript
-// @noErrors
-import Anthropic from '@anthropic-ai/sdk';
-import { Composio } from '@composio/core';
-
-// Initialize clients
-const composio = new Composio();
-const anthropic = new Anthropic({
- apiKey: process.env.ANTHROPIC_API_KEY,
-});
-
-// Create MCP server with Google Sheets tools
-const server = await composio.mcp.create(
- "analytics-server",
- {
- toolkits: [
- { toolkit: "googlesheets", authConfigId: "ac_sheets_id" }
- ],
- allowedTools: ["GOOGLESHEETS_GET_DATA", "GOOGLESHEETS_UPDATE_DATA", "GOOGLESHEETS_CREATE_SHEET"]
- }
-);
-
-// Generate MCP instance for user
-const instance = await server.generate("[email protected]");
-
-// Use MCP with Anthropic for spreadsheet operations
-const response = await anthropic.beta.messages.create({
- model: "claude-sonnet-4-5",
- system: "You are a helpful assistant with access to Google Sheets tools. Use these tools to analyze and manage spreadsheet data. Do not ask for confirmation before using the tools.",
- max_tokens: 1000,
- messages: [{
- role: "user",
- content: "Analyze the sales data in my Google Sheets 'Q4 Revenue' spreadsheet, calculate month-over-month growth, and add a new summary sheet with visualizations"
- }],
- mcp_servers: [{
- type: "url",
- url: instance.url,
- name: "composio-mcp-server"
- }],
- betas: ["mcp-client-2025-04-04"] // Enable MCP beta
-});
-
-console.log(response.content);
-```
-</Tab>
-</Tabs>
diff --git a/docs/content/docs/providers/google.mdx b/docs/content/docs/providers/google.mdx
index 1a239bcb3..5ecd68488 100644
--- a/docs/content/docs/providers/google.mdx
+++ b/docs/content/docs/providers/google.mdx
@@ -109,9 +109,3 @@ if (response.functionCalls && response.functionCalls.length > 0) {
</Tab>
</Tabs>
-## Modifiers
-
-Modifiers are functions that can be used to intercept and optionally **modify** the schema, the tool call request and the response from the tool call.
-
-OpenAI provider modifiers are the standard framework modifiers.
-Read more here: [Modifying tool schemas](/docs/modify-tool-behavior/modifying-tool-schemas)
diff --git a/docs/content/docs/providers/openai-agents.mdx b/docs/content/docs/providers/openai-agents.mdx
index f9d2d4cde..ba0d70814 100644
--- a/docs/content/docs/providers/openai-agents.mdx
+++ b/docs/content/docs/providers/openai-agents.mdx
@@ -8,16 +8,331 @@ The OpenAI Agents Provider is a provider that formats the Composio tools into an
OpenAI Agents SDK is different from the OpenAI SDK. It helps build agentic AI apps in a lightweight, easy-to-use package with very few abstractions.
-<Tabs items={["Python", "TypeScript"]}>
+## Usage with Tools
+
+Use Composio Tool Router as a native tool with the OpenAI Agents SDK.
+
+### Installation
+
+<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
+<Tab value="Python">
+```bash
+pip install python-dotenv composio composio-openai-agents openai-agents
+```
+</Tab>
+<Tab value="TypeScript">
+```bash
+npm install @composio/core @composio/openai-agents @openai/agents
+```
+</Tab>
+</Tabs>
+
+### Usage
+
+Create a Tool Router session and use it as a native tool with OpenAI Agents SDK:
+
+<Callout type="info">
+- Set `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
+- Set `OPENAI_API_KEY` environment variable with your [OpenAI API key](https://platform.openai.com/api-keys).
+</Callout>
+
+<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
+<Tab value="Python">
+```python
+from dotenv import load_dotenv
+from composio import Composio
+from agents import Agent, Runner, SQLiteSession
+from composio_openai_agents import OpenAIAgentsProvider
+
+load_dotenv()
+
+# Initialize Composio with OpenAI Agents provider (API key from env var COMPOSIO_API_KEY)
+composio = Composio(provider=OpenAIAgentsProvider())
+
+# Unique identifier of the user
+user_id = "user_123"
+
+# Create a session and get native tools for the user
+session = composio.create(user_id=user_id)
+tools = session.tools()
+
+# Configure OpenAI agent with Composio tools
+agent = Agent(
+ name="Personal Assistant",
+ instructions="You are a helpful personal assistant. Use Composio tools to take action.",
+ model="gpt-5.2",
+ tools=tools,
+)
+
+# Memory for multi-turn conversation
+memory = SQLiteSession("conversation")
+
+# Execute an initial task
+print("Fetching GitHub issues from the Composio repository...\n")
+try:
+ result = Runner.run_sync(
+ starting_agent=agent,
+ input="Fetch all the open GitHub issues on the @ComposioHQ/composio repository and group them by bugs/features/docs.",
+ session=memory,
+ )
+ print(f"{result.final_output}\n")
+except Exception as e:
+ print(f"[Error]: {e}")
+
+# Continue with interactive conversation
+print("\nWhat else would you like me to do? (Type 'exit' to exit)")
+
+while True:
+ user_input = input("You: ").strip()
+ if user_input.lower() == "exit":
+ break
+
+ print("Assistant: ", end="", flush=True)
+ try:
+ result = Runner.run_sync(starting_agent=agent, input=user_input, session=memory)
+ print(f"{result.final_output}\n")
+ except Exception as e:
+ print(f"\n[Error]: {e}")
+```
+</Tab>
+<Tab value="TypeScript">
+```typescript
+import "dotenv/config";
+import { Composio } from "@composio/core";
+import { Agent, run, MemorySession } from "@openai/agents";
+import { OpenAIAgentsProvider } from "@composio/openai-agents";
+import { createInterface } from "readline/promises";
+
+// Initialize Composio with OpenAI Agents provider (API key from env var COMPOSIO_API_KEY)
+const composio = new Composio({ provider: new OpenAIAgentsProvider() });
+
+// Unique identifier of the user
+const userId = "user_123";
+
+// Create a session and get native tools for the user
+const session = await composio.create(userId);
+const tools = await session.tools();
+
+const agent = new Agent({
+ name: "Personal Assistant",
+ instructions: "You are a helpful personal assistant. Use Composio tools to take action.",
+ model: "gpt-5.2",
+ tools,
+});
+
+// Create a memory session for persistent multi-turn conversation
+const memory = new MemorySession();
+
+// Execute an initial task
+console.log("Fetching GitHub issues from the Composio repository...\n");
+try {
+ const initialResult = await run(
+ agent,
+ "Fetch all the open GitHub issues on the composio repository and group them by bugs/features/docs.",
+ { session: memory }
+ );
+ console.log(`${initialResult.finalOutput}\n`);
+} catch (error) {
+ console.error("[Error]:", error instanceof Error ? error.message : error);
+}
+
+// Continue with interactive conversation
+const readline = createInterface({ input: process.stdin, output: process.stdout });
+
+console.log(`
+What else would you like me to do?
+(Type 'exit' to exit)
+`);
+
+
+while (true) {
+ const input = (await readline.question("You: ")).trim();
+ if (input.toLowerCase() === "exit") break;
+
+ console.log("Assistant: ");
+
+ try {
+ const result = await run(agent, input, { session: memory });
+ console.log(`${result.finalOutput}\n`);
+ } catch (error) {
+ console.error("\n[Error]:", error instanceof Error ? error.message : error);
+ }
+}
+readline.close();
+```
+</Tab>
+</Tabs>
+
+## Usage with MCP
+
+Use Composio Tool Router with the OpenAI Agents SDK for a fully managed MCP experience.
+
+### Installation
+
+<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
+<Tab value="Python">
+```bash
+pip install python-dotenv composio openai-agents
+```
+</Tab>
+<Tab value="TypeScript">
+```bash
+npm install dotenv @composio/core @openai/agents zod@3
+```
+</Tab>
+</Tabs>
+
+### Usage
+
+Create a Tool Router session and execute tasks with OpenAI agents:
+
+<Callout type="info">
+- Set `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
+- Set `OPENAI_API_KEY` environment variable with your [OpenAI API key](https://platform.openai.com/api-keys).
+</Callout>
+
+<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
<Tab value="Python">
-## Setup
+```python
+from dotenv import load_dotenv
+from composio import Composio
+from agents import Agent, Runner, HostedMCPTool
+
+load_dotenv()
+
+# Initialize Composio (API key from env var COMPOSIO_API_KEY)
+composio = Composio()
+# Unique identifier of the user
+user_id = "user_123"
+
+# Create a Tool Router session for the user
+session = composio.create(user_id=user_id)
+
+# Configure OpenAI agent with Composio MCP server
+agent = Agent(
+ name="Personal Assistant",
+ instructions="You are a helpful personal assistant. Use Composio tools to take action.",
+ model="gpt-5.2",
+ tools=[
+ HostedMCPTool(
+ tool_config={
+ "type": "mcp",
+ "server_label": "composio",
+ "server_url": session.mcp.url,
+ "require_approval": "never",
+ "headers": session.mcp.headers,
+ }
+ )
+ ],
+)
+# Execute the task
+print("Fetching GitHub issues from the Composio repository @ComposioHQ/composio...\n")
+try:
+ result = Runner.run_sync(
+ starting_agent=agent,
+ input="Fetch all the open GitHub issues on the composio repository and group them by bugs/features/docs.",
+ )
+ print(result.final_output)
+except Exception as e:
+ print(f"[Error]: {e}")
+
+print("\n\n---")
+print("Tip: If prompted to authenticate, complete the auth flow and run again.")
+```
+</Tab>
+<Tab value="TypeScript">
+```typescript
+import "dotenv/config";
+import { Composio } from "@composio/core";
+import { Agent, hostedMcpTool, run, MemorySession } from "@openai/agents";
+import { createInterface } from "readline/promises";
+
+// Initialize Composio (API key from env var COMPOSIO_API_KEY or pass explicitly: { apiKey: "your-key" })
+const composio = new Composio();
+
+// Unique identifier of the user
+const userId = "user_123";
+
+// Create a tool router session for the user
+const session = await composio.create(userId);
+
+const agent = new Agent({
+ name: "Personal Assistant",
+ instructions: "You are a helpful personal assistant. Use Composio tools to take action.",
+ model: "gpt-5.2",
+ tools: [
+ hostedMcpTool({
+ serverLabel: "composio",
+ serverUrl: session.mcp.url,
+ headers: session.mcp.headers, // Authentication headers for the Composio MCP server
+ }),
+ ],
+});
+
+// Create a memory session for persistent multi-turn conversation
+const memory = new MemorySession();
+
+// Execute an initial task
+console.log("Fetching GitHub issues from the Composio repository...\n");
+try {
+ const initialResult = await run(
+ agent,
+ "Fetch all the open GitHub issues on the composio repository and group them by bugs/features/docs.",
+ { session: memory }
+ );
+ console.log(`${initialResult.finalOutput}\n`);
+} catch (error) {
+ console.error("[Error]:", error instanceof Error ? error.message : error);
+}
+
+// Continue with interactive conversation
+const readline = createInterface({ input: process.stdin, output: process.stdout });
+
+console.log(`
+What else would you like me to do?
+(Type 'exit' to exit)
+`);
+
+while (true) {
+ const input = (await readline.question("You: ")).trim();
+ if (input.toLowerCase() === "exit") break;
+
+ console.log("Assistant: ");
+
+ try {
+ const result = await run(agent, input, { session: memory });
+ console.log(`${result.finalOutput}\n`);
+ } catch (error) {
+ console.error("\n[Error]:", error instanceof Error ? error.message : error);
+ }
+}
+readline.close();
+```
+</Tab>
+</Tabs>
+
+## Usage with direct tools
+
+### Setup
+
+<Tabs items={["Python", "TypeScript"]}>
+<Tab value="Python">
```bash
pip install composio openai-agents composio-openai-agents
```
+</Tab>
+<Tab value="TypeScript">
+```bash
+npm install @composio/core @openai/agents @composio/openai-agents
+```
+</Tab>
+</Tabs>
-## Usage
+### Usage
+<Tabs items={["Python", "TypeScript"]}>
+<Tab value="Python">
```python
import asyncio
from composio import Composio
@@ -40,7 +355,7 @@ agent = Agent(
async def main():
result = await Runner.run(
starting_agent=agent,
- input="Send an email to [email protected] with the subject 'Hello from composio 👋🏻' and the body 'Congratulations on sending your first email using AI Agents and Composio!'",
+ input="Send an email to [email protected] with the subject 'Hello from composio' and the body 'Congratulations on sending your first email using AI Agents and Composio!'",
)
print(result.final_output)
@@ -48,14 +363,6 @@ asyncio.run(main())
```
</Tab>
<Tab value="TypeScript">
-## Setup
-
-```bash
-npm install @composio/core @openai/agents @composio/openai-agents
-```
-
-## Usage
-
```typescript
import { Composio } from "@composio/core";
import { Agent, run } from "@openai/agents";
diff --git a/docs/content/docs/providers/openai.mdx b/docs/content/docs/providers/openai.mdx
index 738bd0a4a..2ccca9f7f 100644
--- a/docs/content/docs/providers/openai.mdx
+++ b/docs/content/docs/providers/openai.mdx
@@ -196,106 +196,3 @@ main();
```
</Tab>
</Tabs>
-
-## Modifiers
-
-Modifiers are functions that can be used to intercept and optionally **modify** the schema, the tool call request and the response from the tool call.
-
-OpenAI provider modifiers are the standard framework modifiers.
-Read more here: [Modifying tool schemas](/docs/modify-tool-behavior/modifying-tool-schemas)
-
-## Usage: Direct MCP Servers
-
-You can also use Composio MCP servers directly with the OpenAI SDK.
-
-<Callout type="info">
-Composio MCP servers only support Streamable HTTP transport.
-</Callout>
-
-<Tabs items={["Python", "TypeScript"]}>
-<Tab value="Python">
-```python
-from openai import OpenAI
-from composio import Composio
-
-# Initialize clients
-composio = Composio()
-openai = OpenAI(api_key="your-openai-api-key")
-
-# Create MCP server with Google Sheets and Notion tools
-server = composio.mcp.create(
- name="data-docs-server",
- toolkits=[
- {"toolkit": "googlesheets", "auth_config": "ac_sheets_id"},
- {"toolkit": "notion", "auth_config": "ac_notion_id"}
- ],
- allowed_tools=["GOOGLESHEETS_GET_DATA", "GOOGLESHEETS_UPDATE_DATA", "NOTION_CREATE_PAGE"]
-)
-
-# Generate MCP instance for user
-instance = server.generate("[email protected]")
-
-# Use MCP with OpenAI for data management
-response = openai.responses.create(
- model="gpt-5",
- tools=[
- {
- "type": "mcp",
- "server_label": "composio-server",
- "server_description": "Composio MCP server with Google Sheets and Notion integrations",
- "server_url": instance['url'],
- "require_approval": "never",
- },
- ],
- input="Export the Q4 metrics from Google Sheets and create a comprehensive Notion page with charts and analysis",
-)
-
-print("OpenAI MCP Response:", response.output_text)
-```
-</Tab>
-<Tab value="TypeScript">
-```typescript
-// @noErrors
-import OpenAI from 'openai';
-import { Composio } from '@composio/core';
-
-// Initialize clients
-const composio = new Composio();
-const openai = new OpenAI({
- apiKey: process.env.OPENAI_API_KEY,
-});
-
-// Create MCP server with Linear and Notion tools
-const server = await composio.mcp.create(
- "project-docs-server",
- {
- toolkits: [
- { toolkit: "linear", authConfigId: "ac_linear_id" },
- { toolkit: "notion", authConfigId: "ac_notion_id" }
- ],
- allowedTools: ["LINEAR_LIST_ISSUES", "LINEAR_GET_ISSUE", "NOTION_CREATE_PAGE"]
- }
-);
-
-// Generate MCP instance for user
-const instance = await server.generate("[email protected]");
-
-// Use MCP with OpenAI for project documentation
-const response = await openai.responses.create({
- model: "gpt-5",
- tools: [
- {
- type: "mcp",
- server_label: "composio-server",
- server_description: "Composio MCP server with Linear and Notion integrations",
- server_url: instance.url,
- require_approval: "never",
- },
- ],
- input: "Find all completed Linear issues from this sprint and create a Notion page documenting the release notes",
-});
-
-console.log("OpenAI MCP Response:", response.output_text);
-```
-</Tab>
-</Tabs>
diff --git a/docs/content/docs/providers/vercel.mdx b/docs/content/docs/providers/vercel.mdx
index 5b62eae08..f703c9b27 100644
--- a/docs/content/docs/providers/vercel.mdx
+++ b/docs/content/docs/providers/vercel.mdx
@@ -8,7 +8,137 @@ Vercel AI SDK allows you to configure an optional async `execute` function that
The Vercel provider for Composio formats the Composio tools and adds this `execute` function to the tool calls.
-## Setup
+## Usage with Tools
+
+Use Composio Tool Router as a native tool with the Vercel AI SDK.
+
+### Installation
+
+```bash
+npm install @composio/core @composio/vercel ai @ai-sdk/anthropic
+```
+
+### Usage
+
+Create a Tool Router session and use it as a native tool with Vercel AI SDK:
+
+<Callout type="info">
+- Set `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
+- Set `ANTHROPIC_API_KEY` environment variable with your [Anthropic API key](https://console.anthropic.com/settings/keys).
+</Callout>
+
+```typescript
+import "dotenv/config";
+import { anthropic } from "@ai-sdk/anthropic";
+import { Composio } from "@composio/core";
+import { VercelProvider } from "@composio/vercel";
+import { stepCountIs, streamText } from "ai";
+
+// Initialize Composio with Vercel provider (API key from env var COMPOSIO_API_KEY)
+const composio = new Composio({ provider: new VercelProvider() });
+
+// Unique identifier of the user
+const userId = "user_123";
+
+// Create a session and get native tools for the user
+const session = await composio.create(userId);
+const tools = await session.tools();
+
+console.log("Fetching GitHub issues from the Composio repository...");
+
+// Stream the response with tool calling
+const stream = await streamText({
+ system: "You are a helpful personal assistant. Use Composio tools to take action.",
+ model: anthropic("claude-sonnet-4-5"),
+ prompt: "Fetch all the open GitHub issues on the composio repository and group them by bugs/features/docs.",
+ stopWhen: stepCountIs(10),
+ onStepFinish: (step) => {
+ for (const toolCall of step.toolCalls) {
+ console.log(`[Using tool: ${toolCall.toolName}]`);
+ }
+ },
+ tools,
+});
+
+for await (const textPart of stream.textStream) {
+ process.stdout.write(textPart);
+}
+
+console.log("\n\n---");
+console.log("Tip: If prompted to authenticate, complete the auth flow and run again.");
+```
+
+## Usage with MCP
+
+Use Composio Tool Router with the Vercel AI SDK for a fully managed MCP experience.
+
+### Installation
+
+```bash
+npm install dotenv @composio/core ai @ai-sdk/anthropic @ai-sdk/mcp
+```
+
+### Usage
+
+Use Tool Router with Vercel AI SDK's `streamText` for completions:
+
+<Callout type="info">
+- Set `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
+- Set `ANTHROPIC_API_KEY` environment variable with your [Anthropic API key](https://platform.claude.com/settings/keys).
+</Callout>
+
+```typescript
+import "dotenv/config";
+import { anthropic } from "@ai-sdk/anthropic";
+import { experimental_createMCPClient as createMCPClient } from "@ai-sdk/mcp";
+import { Composio } from "@composio/core";
+import { stepCountIs, streamText } from "ai";
+
+// Initialize Composio (API key from env var COMPOSIO_API_KEY or pass explicitly: { apiKey: "your-key" })
+const composio = new Composio();
+
+// Unique identifier of the user
+const userId = "user_123";
+
+// Create a tool router session for the user
+const { mcp } = await composio.create(userId);
+
+// Create an MCP client to connect to the Composio tool router
+const client = await createMCPClient({
+ transport: {
+ type: "http",
+ url: mcp.url,
+ headers: mcp.headers, // Authentication headers for the Composio MCP server
+ },
+});
+const tools = await client.tools();
+
+console.log("Summarizing your emails from today");
+
+const stream = await streamText({
+ system: "You are a helpful personal assistant. Use Composio tools to take action.",
+ model: anthropic("claude-sonnet-4-5"),
+ prompt: "Summarize my emails from today",
+ stopWhen: stepCountIs(10),
+ onStepFinish: (step) => {
+ for (const toolCall of step.toolCalls) {
+ console.log(`[Using tool: ${toolCall.toolName}]`);
+ }
+ },
+ tools,
+});
+
+for await (const textPart of stream.textStream) {
+ process.stdout.write(textPart);
+}
+
+console.log("\n\n---");
+console.log("Tip: If prompted to authenticate, complete the auth flow and run again.")
+```
+
+## Usage with direct tools
+
+### Setup
Vercel AI SDK and the provider are only available for the TypeScript SDK.
@@ -29,7 +159,7 @@ const composio = new Composio({
});
```
-## Usage
+### Usage
```typescript
import { Composio } from '@composio/core';
@@ -49,7 +179,7 @@ const { text } = await generateText({
messages: [
{
role: "user",
- content: `Send an email to [email protected] with the subject 'Hello from composio 👋🏻' and the body 'Congratulations on sending your first email using AI Agents and Composio!'`,
+ content: `Send an email to [email protected] with the subject 'Hello from composio' and the body 'Congratulations on sending your first email using AI Agents and Composio!'`,
},
],
tools,
diff --git a/docs/content/tool-router/quickstart.mdx b/docs/content/docs/quickstart-tool-router.mdx
similarity index 95%
rename from docs/content/tool-router/quickstart.mdx
rename to docs/content/docs/quickstart-tool-router.mdx
index c289012c9..4bb9a4be5 100644
--- a/docs/content/tool-router/quickstart.mdx
+++ b/docs/content/docs/quickstart-tool-router.mdx
@@ -1,5 +1,5 @@
---
-title: Quickstart
+title: Quickstart (Tool Router)
description: Build an AI agent with access to 1000+ tools
keywords: [tutorial, setup, first agent]
---
@@ -33,7 +33,7 @@ npm install dotenv @composio/core @anthropic-ai/claude-agent-sdk
<Step>
### Create session and run agent
-[Sessions](/tool-router/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
+[Sessions](/docs/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
<Callout type="info">
- Set `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
@@ -41,7 +41,7 @@ npm install dotenv @composio/core @anthropic-ai/claude-agent-sdk
- `userId` is your user's unique identifier. See [User Management](/docs/user-management) for details.
</Callout>
-When the agent needs authentication, it will prompt the user with a link to connect their account. If you want to customise the authentication flow and have more control over the user experience, see [Manual Authentication](/tool-router/manually-authenticating-users).
+When the agent needs authentication, it will prompt the user with a link to connect their account. If you want to customise the authentication flow and have more control over the user experience, see [Manual Authentication](/docs/authenticating-users/manually-authenticating).
<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
<Tab value="Python">
@@ -228,7 +228,7 @@ npm install dotenv @composio/core @openai/agents zod@3
<Step>
### Create session and run agent
-[Sessions](/tool-router/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
+[Sessions](/docs/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
<Callout type="info">
- Set `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
@@ -236,7 +236,7 @@ npm install dotenv @composio/core @openai/agents zod@3
- `userId` is your user's unique identifier. See [User Management](/docs/user-management) for details.
</Callout>
-When the agent needs authentication, it will prompt the user with a link to connect their account. If you want to customise the authentication flow and have more control over the user experience, see [Manual Authentication](/tool-router/manually-authenticating-users).
+When the agent needs authentication, it will prompt the user with a link to connect their account. If you want to customise the authentication flow and have more control over the user experience, see [Manual Authentication](/docs/authenticating-users/manually-authenticating).
<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
<Tab value="Python">
@@ -381,7 +381,7 @@ npm install dotenv @composio/core ai @ai-sdk/anthropic @ai-sdk/mcp
<Step>
### Create session and run agent
-[Sessions](/tool-router/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
+[Sessions](/docs/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
<Callout type="info">
- Set `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
@@ -389,7 +389,7 @@ npm install dotenv @composio/core ai @ai-sdk/anthropic @ai-sdk/mcp
- `userId` is your user's unique identifier. See [User Management](/docs/user-management) for details.
</Callout>
-When the agent needs authentication, it will prompt the user with a link to connect their account. If you want to customise the authentication flow and have more control over the user experience, see [Manual Authentication](/tool-router/manually-authenticating-users).
+When the agent needs authentication, it will prompt the user with a link to connect their account. If you want to customise the authentication flow and have more control over the user experience, see [Manual Authentication](/docs/authenticating-users/manually-authenticating).
```typescript
import "dotenv/config";
@@ -687,19 +687,16 @@ When you run this agent, Tool Router:
## Next steps
<Cards>
- <Card title="Session management" href="/tool-router/users-and-sessions">
+ <Card title="Session management" href="/docs/users-and-sessions">
Learn about users, sessions, and how they work.
</Card>
- <Card title="Tools and toolkits" href="/tool-router/tools-and-toolkits">
+ <Card title="Tools and toolkits" href="/docs/tools-and-toolkits">
Learn about tools, toolkits, and how to configure them.
</Card>
- <Card title="Manual authentication" href="/tool-router/manually-authenticating-users">
+ <Card title="Manual authentication" href="/docs/authenticating-users/manually-authenticating">
Customise the authentication flow for your users.
</Card>
- <Card title="Using MCP" href="/tool-router/using-with-mcp-clients">
+ <Card title="Using MCP" href="/docs/mcp">
Connect Tool Router to any MCP-compatible client.
</Card>
- <Card title="Using as a native tool" href="/tool-router/using-as-a-native-tool">
- Use Tool Router as a native tool with any AI framework.
- </Card>
</Cards>
diff --git a/docs/content/docs/quickstart.mdx b/docs/content/docs/quickstart.mdx
index a86e23e36..6bc906cc5 100644
--- a/docs/content/docs/quickstart.mdx
+++ b/docs/content/docs/quickstart.mdx
@@ -45,7 +45,7 @@ OPENAI_API_KEY=xxxxxxxxx
<Step>
### Create session and run agent
-[Sessions](/tool-router/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
+[Sessions](/docs/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
<Callout type="info">
Replace the sample user ID with your own user's identifier. See [User Management](/docs/user-management) for details.
@@ -174,7 +174,7 @@ ANTHROPIC_API_KEY=xxxxxxxxx
<Step>
### Create session and run agent
-[Sessions](/tool-router/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
+[Sessions](/docs/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
<Callout type="info">
Replace the sample user ID with your own user's identifier. See [User Management](/docs/user-management) for details.
@@ -300,7 +300,7 @@ OPENAI_API_KEY=xxxxxxxxx
<Step>
### Create session and run agent
-[Sessions](/tool-router/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
+[Sessions](/docs/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
<Callout type="info">
Replace the sample user ID with your own user's identifier. See [User Management](/docs/user-management) for details.
@@ -355,12 +355,12 @@ for await (const textPart of stream.textStream) {
<Cards>
<Card
title="Session management"
- href="/docs/tool-router/users-and-sessions"
+ href="/docs/users-and-sessions"
description="Learn about users, sessions, and how they work."
/>
<Card
title="Tools and toolkits"
- href="/docs/tool-router/tools-and-toolkits"
+ href="/docs/tools-and-toolkits"
description="Learn about tools, toolkits, and how to configure them."
/>
</Cards>
diff --git a/docs/content/docs/toolkits/fetching-tools-and-toolkits.mdx b/docs/content/docs/toolkits/fetching-tools-and-toolkits.mdx
new file mode 100644
index 000000000..990bd5a1d
--- /dev/null
+++ b/docs/content/docs/toolkits/fetching-tools-and-toolkits.mdx
@@ -0,0 +1,5 @@
+---
+title: Fetching tools and toolkits
+description: How to fetch and filter tools and toolkits for your AI agents
+---
+
diff --git a/docs/content/docs/toolkits/meta.json b/docs/content/docs/toolkits/meta.json
new file mode 100644
index 000000000..800f9376c
--- /dev/null
+++ b/docs/content/docs/toolkits/meta.json
@@ -0,0 +1,6 @@
+{
+ "title": "Toolkits",
+ "pages": [
+ "fetching-tools-and-toolkits"
+ ]
+}
diff --git a/docs/content/docs/tools-and-toolkits.mdx b/docs/content/docs/tools-and-toolkits.mdx
index 824ed1ef9..4b0ead410 100644
--- a/docs/content/docs/tools-and-toolkits.mdx
+++ b/docs/content/docs/tools-and-toolkits.mdx
@@ -4,7 +4,7 @@ description: Access 800+ toolkits through Tool Router
keywords: [available tools, browse toolkits]
---
-Tool Router gives your agent access to most Composio toolkits by default. For details on configuring which toolkits are available in a session, see [Users and sessions](/tool-router/users-and-sessions#enabling-toolkits).
+Tool Router gives your agent access to most Composio toolkits by default. For details on configuring which toolkits are available in a session, see [Users and sessions](/docs/users-and-sessions#enabling-toolkits).
## Toolkits and tools
@@ -50,7 +50,7 @@ for (const toolkit of toolkits) {
For details on browsing tools within toolkits and inspecting schemas, see [Fetching tools and schemas](/docs/fetching-tools).
<Callout type="info">
-Some toolkits require you to provide your own credentials. See [Using custom auth configs](/tool-router/using-custom-auth-configs).
+Some toolkits require you to provide your own credentials. See [Using custom auth configs](/docs/guides/using-custom-auth-configuration).
</Callout>
<Callout type="info">
@@ -77,7 +77,7 @@ const session = await composio.create("user_123");
</Tab>
</Tabs>
-Your agent can search and use tools from any toolkit. To restrict or configure which toolkits are available, see [Users and sessions](/tool-router/users-and-sessions#enabling-toolkits).
+Your agent can search and use tools from any toolkit. To restrict or configure which toolkits are available, see [Users and sessions](/docs/users-and-sessions#enabling-toolkits).
<Callout type="info">
Triggers can be used alongside Tool Router to respond to events in connected apps. See [Triggers](/docs/triggers) for setup instructions.
diff --git a/docs/content/docs/users-and-sessions.mdx b/docs/content/docs/users-and-sessions.mdx
index d2d026ad3..b9f73b69a 100644
--- a/docs/content/docs/users-and-sessions.mdx
+++ b/docs/content/docs/users-and-sessions.mdx
@@ -125,7 +125,7 @@ const session = await composio.create("user_123", {
</Tab>
</Tabs>
-See [White-labeling authentication](/tool-router/white-labeling-authentication) for branding, or [Using custom auth configs](/tool-router/using-custom-auth-configs) for toolkits that require your own credentials.
+See [White-labeling authentication](/docs/guides/white-labeling-authentication) for branding, or [Using custom auth configs](/docs/guides/using-custom-auth-configuration) for toolkits that require your own credentials.
## Connected accounts
@@ -198,7 +198,7 @@ console.log(mcp.url);
</Tab>
</Tabs>
-For framework examples, see [Using with MCP clients](/tool-router/using-with-mcp-clients) or [Using as a native tool](/tool-router/using-as-a-native-tool).
+For framework examples, see the [Providers](/docs/providers) documentation.
### tools()
@@ -252,7 +252,7 @@ const connectedAccount = await connectionRequest.waitForConnection();
</Tab>
</Tabs>
-For more details, see [Manually authenticating users](/tool-router/manually-authenticating-users).
+For more details, see [Manually authenticating users](/docs/authenticating-users/manually-authenticating).
### toolkits()
diff --git a/docs/content/tool-router/index.mdx b/docs/content/tool-router/index.mdx
deleted file mode 100644
index f7dd9fd64..000000000
--- a/docs/content/tool-router/index.mdx
+++ /dev/null
@@ -1,23 +0,0 @@
----
-title: Overview
-description: Give your AI agent access to thousands of tools through a unified interface
-keywords: [unified interface, meta-tools]
----
-
-Tool Router is a unified interface that lets an agent **search**, **plan**, **authenticate**, and **execute** actions across thousands of Composio tools.
-
-Consider an agent that works across Gmail, Notion, Slack, Google Drive, and hundreds of other apps. The challenges:
-
-- **Search**: Identifying the right tool for the task
-- **Context Management**: Managing context for complex queries with large responses
-- **Authentication**: Handling authentication across all of them
-
-Tool Router exposes a set of meta-tools that handle all this complexity including search to discover the right tools, and a workbench to process results without flooding context.
-
-This is what powers complex agentic products like [Rube](https://rube.app).
-
-## Quick links
-
-- [Quickstart](/tool-router/quickstart): Build your first AI agent with Tool Router.
-- [Using with MCP clients](/tool-router/using-with-mcp-clients): Guides on how to use Tool Router MCP with popular MCP clients.
-- [Using as a native tool](/tool-router/using-as-a-native-tool): Guide on how to use Tool Router as a native tool with any AI framework.
diff --git a/docs/content/tool-router/meta.json b/docs/content/tool-router/meta.json
deleted file mode 100644
index 96da365e8..000000000
--- a/docs/content/tool-router/meta.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "title": "Tool Router",
- "pages": [
- "---Get Started---",
- "index",
- "quickstart",
- "---Guides---",
- "using-in-chat-authentication",
- "manually-authenticating-users",
- "managing-multiple-accounts",
- "white-labeling-authentication",
- "using-custom-auth-configs",
- "using-with-mcp-clients",
- "using-as-a-native-tool"
- ]
-}
diff --git a/docs/content/tool-router/migration-guide/beta-to-stable.mdx b/docs/content/tool-router/migration-guide/beta-to-stable.mdx
deleted file mode 100644
index 16b2bde87..000000000
--- a/docs/content/tool-router/migration-guide/beta-to-stable.mdx
+++ /dev/null
@@ -1,113 +0,0 @@
----
-title: Beta to Stable Migration
-description: Migrate from Tool Router beta to the stable version
-keywords: [upgrade, migrate, experimental, beta]
----
-
-The stable version includes improved session management, multiple configuring options, and enhanced authentication capabilities.
-
-## The basics
-
-<Steps>
-<Step>
-### Upgrade composio package
-
-Upgrade to the latest stable version:
-
-<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
-<Tab value="Python">
-```bash
-pip install --upgrade composio
-```
-</Tab>
-<Tab value="TypeScript">
-```bash
-npm install @composio/core@latest
-```
-</Tab>
-</Tabs>
-</Step>
-
-<Step>
-### Update session creation
-
-<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
-<Tab value="Python">
-```python
-# Beta (before)
-session = composio.experimental.tool_router.create_session(
- user_id="[email protected]"
-)
-
-# Stable (after)
-session = composio.create(
- user_id="[email protected]"
-)
-```
-</Tab>
-<Tab value="TypeScript">
-```typescript
-// @noErrors
-// Beta (before)
-const session = await composio.experimental.toolRouter.createSession('user_123');
-
-// Stable (after)
-const session = await composio.create('user_123');
-```
-</Tab>
-</Tabs>
-</Step>
-
-<Step>
-### Moving users (optional)
-
-If you have existing users on tool router and you don't want them to authenticate again:
-- Tool Router will auto-detect auth configs and connected accounts it created (from the beta version).
-- If you have custom auth configs (not created by Tool Router):
- - Search for the Auth config for that connected account. See [Connected Accounts](/docs/connected-accounts) to fetch existing accounts programmatically.
- - While creating a session configure to use this Auth config.
- - You need to repeat this for each toolkit you want to enable for that session.
-
-<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
-<Tab value="Python">
-```python
-session = composio.create(
- user_id="user_123",
- auth_configs={
- "github": "ac_your_github_config",
- "slack": "ac_your_slack_config"
- }
-)
-```
-</Tab>
-<Tab value="TypeScript">
-```typescript
-import { Composio } from '@composio/core';
-const composio = new Composio({ apiKey: 'your_api_key' });
-// ---cut---
-const session = await composio.create('user_123',
- {
- authConfigs: {
- github: "ac_your_github_config",
- slack: "ac_your_slack_config",
- },
- }
-);
-```
-</Tab>
-</Tabs>
-</Step>
-
-<Step>
-### Explore new capabilities
-
-Check out these new features available in the stable version:
-
-- **[Native tools](/tool-router/using-as-a-native-tool)**: Use Tool Router with any AI framework
-- **Better [session](/tool-router/users-and-sessions) and [auth](/tool-router/authentication) config**
-- **[Multi-account support](/tool-router/managing-multiple-accounts)**: Manage multiple accounts per user seamlessly
-- **[Manual authentication](/tool-router/manually-authenticating-users)**: Control when and how users authenticate
-- **[Custom auth](/tool-router/using-custom-auth-configs)**: Support for toolkits that don't have composio managed auth
-- **[White labeling](/tool-router/white-labeling-authentication)**: Customize authentication screens with your branding
-</Step>
-</Steps>
diff --git a/docs/content/tool-router/migration-guide/meta.json b/docs/content/tool-router/migration-guide/meta.json
deleted file mode 100644
index 654fafe51..000000000
--- a/docs/content/tool-router/migration-guide/meta.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "title": "Migration Guides",
- "pages": [
- "beta-to-stable"
- ]
-}
diff --git a/docs/content/tool-router/using-as-a-native-tool.mdx b/docs/content/tool-router/using-as-a-native-tool.mdx
deleted file mode 100644
index f56c46665..000000000
--- a/docs/content/tool-router/using-as-a-native-tool.mdx
+++ /dev/null
@@ -1,241 +0,0 @@
----
-title: Using as a native tool
-description: Use Tool Router as a native tool with any AI framework
-keywords: [native tool, single tool, without mcp]
----
-
-Tool Router can be used as a single native tool with any AI framework. The tool handles search, authentication, and execution internally.
-
-## Examples for popular frameworks
-
-Jump to examples for:
-- [OpenAI](#openai) - Python, TypeScript
-- [Vercel AI SDK](#vercel-ai-sdk) - TypeScript
-
-## OpenAI
-
-### Installation
-
-<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
-<Tab value="Python">
-```bash
-pip install python-dotenv composio composio-openai-agents openai-agents
-```
-</Tab>
-<Tab value="TypeScript">
-```bash
-npm install @composio/core @composio/openai-agents @openai/agents
-```
-</Tab>
-</Tabs>
-
-### Usage
-
-Create a Tool Router session and use it as a native tool with OpenAI Agents SDK:
-
-<Callout type="info">
-- Set your `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
-- Set your `OPENAI_API_KEY` environment variable with your [OpenAI API key](https://platform.openai.com/api-keys).
-</Callout>
-
-<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
-<Tab value="Python">
-```python
-from dotenv import load_dotenv
-from composio import Composio
-from agents import Agent, Runner, SQLiteSession
-from composio_openai_agents import OpenAIAgentsProvider
-
-load_dotenv()
-
-# Initialize Composio with OpenAI Agents provider (API key from env var COMPOSIO_API_KEY)
-composio = Composio(provider=OpenAIAgentsProvider())
-
-# Unique identifier of the user
-user_id = "user_123"
-
-# Create a session and get native tools for the user
-session = composio.create(user_id=user_id)
-tools = session.tools()
-
-# Configure OpenAI agent with Composio tools
-agent = Agent(
- name="Personal Assistant",
- instructions="You are a helpful personal assistant. Use Composio tools to take action.",
- model="gpt-5.2",
- tools=tools,
-)
-
-# Memory for multi-turn conversation
-memory = SQLiteSession("conversation")
-
-# Execute an initial task
-print("Fetching GitHub issues from the Composio repository...\n")
-try:
- result = Runner.run_sync(
- starting_agent=agent,
- input="Fetch all the open GitHub issues on the @ComposioHQ/composio repository and group them by bugs/features/docs.",
- session=memory,
- )
- print(f"{result.final_output}\n")
-except Exception as e:
- print(f"[Error]: {e}")
-
-# Continue with interactive conversation
-print("\nWhat else would you like me to do? (Type 'exit' to exit)")
-
-while True:
- user_input = input("You: ").strip()
- if user_input.lower() == "exit":
- break
-
- print("Assistant: ", end="", flush=True)
- try:
- result = Runner.run_sync(starting_agent=agent, input=user_input, session=memory)
- print(f"{result.final_output}\n")
- except Exception as e:
- print(f"\n[Error]: {e}")
-```
-</Tab>
-<Tab value="TypeScript">
-```typescript
-import "dotenv/config";
-import { Composio } from "@composio/core";
-import { Agent, run, MemorySession } from "@openai/agents";
-import { OpenAIAgentsProvider } from "@composio/openai-agents";
-import { createInterface } from "readline/promises";
-
-// Initialize Composio with OpenAI Agents provider (API key from env var COMPOSIO_API_KEY)
-const composio = new Composio({ provider: new OpenAIAgentsProvider() });
-
-// Unique identifier of the user
-const userId = "user_123";
-
-// Create a session and get native tools for the user
-const session = await composio.create(userId);
-const tools = await session.tools();
-
-const agent = new Agent({
- name: "Personal Assistant",
- instructions: "You are a helpful personal assistant. Use Composio tools to take action.",
- model: "gpt-5.2",
- tools,
-});
-
-// Create a memory session for persistent multi-turn conversation
-const memory = new MemorySession();
-
-// Execute an initial task
-console.log("Fetching GitHub issues from the Composio repository...\n");
-try {
- const initialResult = await run(
- agent,
- "Fetch all the open GitHub issues on the composio repository and group them by bugs/features/docs.",
- { session: memory }
- );
- console.log(`${initialResult.finalOutput}\n`);
-} catch (error) {
- console.error("[Error]:", error instanceof Error ? error.message : error);
-}
-
-// Continue with interactive conversation
-const readline = createInterface({ input: process.stdin, output: process.stdout });
-
-console.log(`
-What else would you like me to do?
-(Type 'exit' to exit)
-`);
-
-
-while (true) {
- const input = (await readline.question("You: ")).trim();
- if (input.toLowerCase() === "exit") break;
-
- console.log("Assistant: ");
-
- try {
- const result = await run(agent, input, { session: memory });
- console.log(`${result.finalOutput}\n`);
- } catch (error) {
- console.error("\n[Error]:", error instanceof Error ? error.message : error);
- }
-}
-readline.close();
-```
-</Tab>
-</Tabs>
-
-## Vercel AI SDK
-
-### Installation
-
-```bash
-npm install @composio/core @composio/vercel ai @ai-sdk/anthropic
-```
-
-### Usage
-
-Create a Tool Router session and use it as a native tool with Vercel AI SDK:
-
-<Callout type="info">
-- Set your `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
-- Set your `ANTHROPIC_API_KEY` environment variable with your [Anthropic API key](https://console.anthropic.com/settings/keys).
-</Callout>
-
-```typescript
-import "dotenv/config";
-import { anthropic } from "@ai-sdk/anthropic";
-import { Composio } from "@composio/core";
-import { VercelProvider } from "@composio/vercel";
-import { stepCountIs, streamText } from "ai";
-
-// Initialize Composio with Vercel provider (API key from env var COMPOSIO_API_KEY)
-const composio = new Composio({ provider: new VercelProvider() });
-
-// Unique identifier of the user
-const userId = "user_123";
-
-// Create a session and get native tools for the user
-const session = await composio.create(userId);
-const tools = await session.tools();
-
-console.log("Fetching GitHub issues from the Composio repository...");
-
-// Stream the response with tool calling
-const stream = await streamText({
- system: "You are a helpful personal assistant. Use Composio tools to take action.",
- model: anthropic("claude-sonnet-4-5"),
- prompt: "Fetch all the open GitHub issues on the composio repository and group them by bugs/features/docs.",
- stopWhen: stepCountIs(10),
- onStepFinish: (step) => {
- for (const toolCall of step.toolCalls) {
- console.log(`[Using tool: ${toolCall.toolName}]`);
- }
- },
- tools,
-});
-
-for await (const textPart of stream.textStream) {
- process.stdout.write(textPart);
-}
-
-console.log("\n\n---");
-console.log("Tip: If prompted to authenticate, complete the auth flow and run again.");
-```
-
-## Next steps
-
-<Cards>
- <Card title="Quickstart" href="/tool-router/quickstart">
- See both MCP and native tool in action
- </Card>
- <Card title="Using with MCP" href="/tool-router/using-with-mcp-clients">
- Use Tool Router with MCP-compatible clients
- </Card>
- <Card title="Authentication" href="/tool-router/authentication">
- Learn about authentication options
- </Card>
- <Card title="Session management" href="/tool-router/users-and-sessions">
- Configure sessions for your users
- </Card>
-</Cards>
diff --git a/docs/content/tool-router/using-with-mcp-clients.mdx b/docs/content/tool-router/using-with-mcp-clients.mdx
deleted file mode 100644
index f0a81ea6e..000000000
--- a/docs/content/tool-router/using-with-mcp-clients.mdx
+++ /dev/null
@@ -1,406 +0,0 @@
----
-title: Using with MCP clients
-description: Use Tool Router as an MCP server with any MCP client
-keywords: [mcp server, http transport]
----
-
-Every Tool Router session provides a unique MCP server URL. This URL exposes the exact session you created - with the specific user, toolkits, and auth configs you configured. Any MCP client that supports HTTP transport can connect using just the URL and your API key.
-
-## Examples for popular frameworks
-
-Jump to examples for:
-- [Claude Agent SDK](#claude-agent-sdk) - Python, TypeScript
-- [OpenAI Agents SDK](#openai-agents-sdk) - Python, TypeScript
-- [Vercel AI SDK](#vercel-ai-sdk) - TypeScript
-
-## Claude Agent SDK
-
-### Installation
-
-<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
-<Tab value="Python">
-```bash
-pip install python-dotenv composio claude-agent-sdk
-```
-</Tab>
-<Tab value="TypeScript">
-```bash
-npm install dotenv @composio/core @anthropic-ai/claude-agent-sdk
-```
-</Tab>
-</Tabs>
-
-### Usage
-
-Create a Tool Router session and execute tasks with Claude:
-
-<Callout type="info">
-- Set your `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
-- Set your `ANTHROPIC_API_KEY` environment variable with your [Anthropic API key](https://platform.claude.com/settings/keys).
-</Callout>
-
-<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
-<Tab value="Python">
-```python
-import asyncio
-from dotenv import load_dotenv
-from claude_agent_sdk.client import ClaudeSDKClient
-from claude_agent_sdk.types import (
- ClaudeAgentOptions,
- AssistantMessage,
- TextBlock,
- ToolUseBlock,
-)
-from composio import Composio
-
-load_dotenv()
-
-# Initialize Composio (API key from env var COMPOSIO_API_KEY or pass explicitly)
-composio = Composio()
-
-# Unique identifier of the user
-user_id = "user_123"
-# Create a tool router session for the user
-session = composio.create(user_id=user_id)
-
-# Configure Claude with Composio MCP server
-options = ClaudeAgentOptions(
- system_prompt=(
- "You are a helpful assistant with access to external tools. "
- "Always use the available tools to complete user requests."
- ),
- mcp_servers={
- "composio": {
- "type": "http",
- "url": session.mcp.url,
- "headers": session.mcp.headers, # Authentication headers for the Composio MCP server
- }
- },
- permission_mode="bypassPermissions", # Auto-approve tools (demo only)
-)
-
-async def main():
- print("""
-What task would you like me to help you with?
-I can use tools like Gmail, GitHub, Linear, Notion, and more.
-(Type 'exit' to exit)
-Example tasks:
- • 'Summarize my emails from today'
- • 'List all open issues on the composio github repository and create a notion page with the issues'
-""")
-
- async with ClaudeSDKClient(options) as client:
- # Multi-turn conversation with agentic tool calling
- while True:
- user_input = input("\nYou: ").strip()
- if user_input.lower() == "exit":
- break
-
- print("\nClaude: ", end="", flush=True)
- try:
- await client.query(user_input)
- async for msg in client.receive_response():
- if isinstance(msg, AssistantMessage):
- for block in msg.content:
- if isinstance(block, ToolUseBlock):
- print(f"\n[Using tool: {block.name}]", end="")
- elif isinstance(block, TextBlock):
- print(block.text, end="", flush=True)
- except Exception as e:
- print(f"\n[Error]: {e}")
-
-if __name__ == "__main__":
- asyncio.run(main())
-```
-</Tab>
-<Tab value="TypeScript">
-```typescript
-import "dotenv/config";
-import { query, type Options } from "@anthropic-ai/claude-agent-sdk";
-import { Composio } from "@composio/core";
-import { createInterface } from "readline/promises";
-
-// Initialize Composio (API key from env var COMPOSIO_API_KEY or pass explicitly: { apiKey: "your-key" })
-const composio = new Composio();
-
-// Unique identifier of the user
-const userId = "user_123";
-
-// Create a tool router session for the user
-const session = await composio.create(userId);
-
-const options: Options = {
- systemPrompt: `You are a helpful assistant with access to external tools. ` +
- `Always use the available tools to complete user requests.`,
- mcpServers: {
- composio: {
- type: "http",
- url: session.mcp.url,
- headers: session.mcp.headers // Authentication headers for the Composio MCP server
- },
- },
- permissionMode: "bypassPermissions", // Auto-approve tools (demo only - use "default" in production)
-};
-
-// Set up interactive terminal input/output for the conversation
-const readline = createInterface({ input: process.stdin, output: process.stdout });
-
-console.log(`
-What task would you like me to help you with?
-I can use tools like Gmail, GitHub, Linear, Notion, and more.
-(Type 'exit' to exit)
-Example tasks:
- • 'Summarize my emails from today'
- • 'List all open issues on the composio github repository and create a notion page with the issues'
-`);
-
-let isFirstQuery = true;
-
-// Multi-turn conversation with agentic tool calling
-while (true) {
- const answer = await readline.question('You: ');
- const input = answer.trim();
- if (input.toLowerCase() === "exit") break;
-
- process.stdout.write("Claude: ");
-
- const queryOptions = isFirstQuery ? options : { ...options, continue: true };
- isFirstQuery = false;
-
- try {
- for await (const stream of query({ prompt: input, options: queryOptions })) {
- // Only process assistant messages (the SDK also sends result/error messages)
- if (stream.type === "assistant") {
- const { content } = stream.message;
- for (const block of content) {
- if (block.type === "tool_use") {
- process.stdout.write(`\n[Using tool: ${block.name}]`);
- } else if (block.type === "text") {
- process.stdout.write(block.text);
- }
- }
- }
- }
- } catch (error) {
- console.error("\n[Error]:", error instanceof Error ? error.message : error);
- }
- process.stdout.write("\n");
-}
-
-readline.close();
-```
-</Tab>
-</Tabs>
-
-## OpenAI Agents SDK
-
-### Installation
-
-<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
-<Tab value="Python">
-```bash
-pip install python-dotenv composio openai-agents
-```
-</Tab>
-<Tab value="TypeScript">
-```bash
-npm install dotenv @composio/core @openai/agents zod@3
-```
-</Tab>
-</Tabs>
-
-### Usage
-
-Create a Tool Router session and execute tasks with OpenAI agents:
-
-<Callout type="info">
-- Set `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
-- Set `OPENAI_API_KEY` environment variable with your [OpenAI API key](https://platform.openai.com/api-keys).
-</Callout>
-
-<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
-<Tab value="Python">
-```python
-from dotenv import load_dotenv
-from composio import Composio
-from agents import Agent, Runner, HostedMCPTool
-
-load_dotenv()
-
-# Initialize Composio (API key from env var COMPOSIO_API_KEY)
-composio = Composio()
-# Unique identifier of the user
-user_id = "user_123"
-
-# Create a Tool Router session for the user
-session = composio.create(user_id=user_id)
-
-# Configure OpenAI agent with Composio MCP server
-agent = Agent(
- name="Personal Assistant",
- instructions="You are a helpful personal assistant. Use Composio tools to take action.",
- model="gpt-5.2",
- tools=[
- HostedMCPTool(
- tool_config={
- "type": "mcp",
- "server_label": "composio",
- "server_url": session.mcp.url,
- "require_approval": "never",
- "headers": session.mcp.headers,
- }
- )
- ],
-)
-
-# Execute the task
-print("Fetching GitHub issues from the Composio repository @ComposioHQ/composio...\n")
-try:
- result = Runner.run_sync(
- starting_agent=agent,
- input="Fetch all the open GitHub issues on the composio repository and group them by bugs/features/docs.",
- )
- print(result.final_output)
-except Exception as e:
- print(f"[Error]: {e}")
-
-print("\n\n---")
-print("Tip: If prompted to authenticate, complete the auth flow and run again.")
-```
-</Tab>
-<Tab value="TypeScript">
-```typescript
-import "dotenv/config";
-import { Composio } from "@composio/core";
-import { Agent, hostedMcpTool, run, MemorySession } from "@openai/agents";
-import { createInterface } from "readline/promises";
-
-// Initialize Composio (API key from env var COMPOSIO_API_KEY or pass explicitly: { apiKey: "your-key" })
-const composio = new Composio();
-
-// Unique identifier of the user
-const userId = "user_123";
-
-// Create a tool router session for the user
-const session = await composio.create(userId);
-
-const agent = new Agent({
- name: "Personal Assistant",
- instructions: "You are a helpful personal assistant. Use Composio tools to take action.",
- model: "gpt-5.2",
- tools: [
- hostedMcpTool({
- serverLabel: "composio",
- serverUrl: session.mcp.url,
- headers: session.mcp.headers, // Authentication headers for the Composio MCP server
- }),
- ],
-});
-
-// Create a memory session for persistent multi-turn conversation
-const memory = new MemorySession();
-
-// Execute an initial task
-console.log("Fetching GitHub issues from the Composio repository...\n");
-try {
- const initialResult = await run(
- agent,
- "Fetch all the open GitHub issues on the composio repository and group them by bugs/features/docs.",
- { session: memory }
- );
- console.log(`${initialResult.finalOutput}\n`);
-} catch (error) {
- console.error("[Error]:", error instanceof Error ? error.message : error);
-}
-
-// Continue with interactive conversation
-const readline = createInterface({ input: process.stdin, output: process.stdout });
-
-console.log(`
-What else would you like me to do?
-(Type 'exit' to exit)
-`);
-
-while (true) {
- const input = (await readline.question("You: ")).trim();
- if (input.toLowerCase() === "exit") break;
-
- console.log("Assistant: ");
-
- try {
- const result = await run(agent, input, { session: memory });
- console.log(`${result.finalOutput}\n`);
- } catch (error) {
- console.error("\n[Error]:", error instanceof Error ? error.message : error);
- }
-}
-readline.close();
-```
-</Tab>
-</Tabs>
-
-## Vercel AI SDK
-
-### Installation
-
-```bash
-npm install dotenv @composio/core ai @ai-sdk/anthropic @ai-sdk/mcp
-```
-
-### Usage
-
-Use Tool Router with Vercel AI SDK's `generateText` for single completions:
-
-<Callout type="info">
-- Set `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
-- Set `ANTHROPIC_API_KEY` environment variable with your [Anthropic API key](https://platform.claude.com/settings/keys).
-</Callout>
-
-```typescript
-import "dotenv/config";
-import { anthropic } from "@ai-sdk/anthropic";
-import { experimental_createMCPClient as createMCPClient } from "@ai-sdk/mcp";
-import { Composio } from "@composio/core";
-import { stepCountIs, streamText } from "ai";
-
-// Initialize Composio (API key from env var COMPOSIO_API_KEY or pass explicitly: { apiKey: "your-key" })
-const composio = new Composio();
-
-// Unique identifier of the user
-const userId = "user_123";
-
-// Create a tool router session for the user
-const { mcp } = await composio.create(userId);
-
-// Create an MCP client to connect to the Composio tool router
-const client = await createMCPClient({
- transport: {
- type: "http",
- url: mcp.url,
- headers: mcp.headers, // Authentication headers for the Composio MCP server
- },
-});
-const tools = await client.tools();
-
-console.log("Summarizing your emails from today");
-
-const stream = await streamText({
- system: "You are a helpful personal assistant. Use Composio tools to take action.",
- model: anthropic("claude-sonnet-4-5"),
- prompt: "Summarize my emails from today",
- stopWhen: stepCountIs(10),
- onStepFinish: (step) => {
- for (const toolCall of step.toolCalls) {
- console.log(`[Using tool: ${toolCall.toolName}]`);
- }
- },
- tools,
-});
-
-for await (const textPart of stream.textStream) {
- process.stdout.write(textPart);
-}
-
-console.log("\n\n---");
-console.log("Tip: If prompted to authenticate, complete the auth flow and run again.")
-```
diff --git a/docs/lib/layout.shared.tsx b/docs/lib/layout.shared.tsx
index ab5958877..79316202a 100644
--- a/docs/lib/layout.shared.tsx
+++ b/docs/lib/layout.shared.tsx
@@ -39,11 +39,6 @@ export function baseOptions(): BaseLayoutProps {
url: '/docs',
active: 'nested-url',
},
- {
- text: 'Tool Router',
- url: '/tool-router',
- active: 'nested-url',
- },
{
text: 'Toolkits',
url: '/toolkits',
diff --git a/docs/lib/source.ts b/docs/lib/source.ts
index eb9ae158f..b7e7edd96 100644
--- a/docs/lib/source.ts
+++ b/docs/lib/source.ts
@@ -1,4 +1,4 @@
-import { docs, toolRouter, reference, examples, toolkits, changelog } from 'fumadocs-mdx:collections/server';
+import { docs, reference, examples, toolkits, changelog } from 'fumadocs-mdx:collections/server';
import { type InferPageType, loader, multiple } from 'fumadocs-core/source';
import { lucideIconsPlugin } from 'fumadocs-core/source/lucide-icons';
import { openapi } from './openapi';
@@ -11,12 +11,6 @@ export const source = loader({
plugins: [lucideIconsPlugin()],
});
-export const toolRouterSource = loader({
- baseUrl: '/tool-router',
- source: toolRouter.toFumadocsSource(),
- plugins: [lucideIconsPlugin()],
-});
-
// Combined reference source with MDX pages and OpenAPI-generated pages
const openapiPages = await openapiSource(openapi, {
groupBy: 'tag',
diff --git a/docs/next.config.mjs b/docs/next.config.mjs
index 4dcb992f7..98260c88f 100644
--- a/docs/next.config.mjs
+++ b/docs/next.config.mjs
@@ -30,9 +30,19 @@ const config = {
destination: '/docs',
permanent: true,
},
+ {
+ source: '/tool-router',
+ destination: '/docs/quickstart',
+ permanent: true,
+ },
{
source: '/tool-router/overview',
- destination: '/tool-router',
+ destination: '/docs/quickstart',
+ permanent: true,
+ },
+ {
+ source: '/tool-router/quickstart',
+ destination: '/docs/quickstart-tool-router',
permanent: true,
},
// Core concepts moved from tool-router to docs
@@ -56,6 +66,37 @@ const config = {
destination: '/docs/tools-and-toolkits',
permanent: true,
},
+ // Authentication pages moved from tool-router to docs
+ {
+ source: '/tool-router/using-in-chat-authentication',
+ destination: '/docs/authenticating-users/in-chat-authentication',
+ permanent: true,
+ },
+ {
+ source: '/tool-router/manually-authenticating-users',
+ destination: '/docs/authenticating-users/manually-authenticating',
+ permanent: true,
+ },
+ {
+ source: '/tool-router/using-custom-auth-configs',
+ destination: '/docs/guides/using-custom-auth-configuration',
+ permanent: true,
+ },
+ {
+ source: '/docs/authenticating-users/using-custom-auth-configs',
+ destination: '/docs/guides/using-custom-auth-configuration',
+ permanent: true,
+ },
+ {
+ source: '/tool-router/white-labeling-authentication',
+ destination: '/docs/guides/white-labeling-authentication',
+ permanent: true,
+ },
+ {
+ source: '/tool-router/managing-multiple-accounts',
+ destination: '/docs/guides/managing-multiple-connected-accounts',
+ permanent: true,
+ },
// Provider redirects (old fern URLs -> new docs URLs)
{
source: '/providers/openai',
diff --git a/docs/scripts/validate-links.ts b/docs/scripts/validate-links.ts
index 63874888d..4967b77a7 100644
--- a/docs/scripts/validate-links.ts
+++ b/docs/scripts/validate-links.ts
@@ -7,7 +7,6 @@ import {
import type { InferPageType } from 'fumadocs-core/source';
import {
source,
- toolRouterSource,
referenceSource,
examplesSource,
toolkitsSource,
@@ -15,7 +14,6 @@ import {
type AnySource =
| typeof source
- | typeof toolRouterSource
| typeof referenceSource
| typeof examplesSource
| typeof toolkitsSource;
@@ -29,10 +27,6 @@ async function checkLinks() {
value: { slug: page.slugs },
hashes: getHeadings(page),
})),
- 'tool-router/[[...slug]]': toolRouterSource.getPages().map((page) => ({
- value: { slug: page.slugs },
- hashes: getHeadings(page),
- })),
'reference/[[...slug]]': referenceSource.getPages().map((page) => ({
value: { slug: page.slugs },
hashes: getHeadings(page),
@@ -80,7 +74,7 @@ function getHeadings({ data }: InferPageType<AnySource>): string[] {
}
async function getFiles(): Promise<FileObject[]> {
- const sources = [source, toolRouterSource, referenceSource, examplesSource, toolkitsSource];
+ const sources = [source, referenceSource, examplesSource, toolkitsSource];
const allFiles: FileObject[] = [];
for (const src of sources) {
diff --git a/docs/source.config.ts b/docs/source.config.ts
index 0c357ad20..85ec81e36 100644
--- a/docs/source.config.ts
+++ b/docs/source.config.ts
@@ -31,16 +31,6 @@ export const docs = defineDocs({
},
});
-export const toolRouter = defineDocs({
- dir: 'content/tool-router',
- docs: {
- schema: docsSchema,
- },
- meta: {
- schema: metaSchema,
- },
-});
-
// Reference docs use defineCollections with custom mdxOptions to exclude twoslash
// (SDK reference docs are auto-generated and don't need type checking)
export const reference = defineDocs({