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.

remove native tools references

Sushmithamalleshca02c5e63899
diff --git a/fern/pages/src/tool-router/creating-sessions.mdx b/fern/pages/src/tool-router/creating-sessions.mdx
index fc69cc854..16efa61e3 100644
--- a/fern/pages/src/tool-router/creating-sessions.mdx
+++ b/fern/pages/src/tool-router/creating-sessions.mdx
@@ -158,7 +158,7 @@ For more details, see [Using in-chat authentication](/tool-router/using-in-chat-
## Session methods
-### tools()
+{/* ### tools()
Get meta-tools to pass to your agent framework.
@@ -184,7 +184,7 @@ const agent = new Agent({
```
</CodeGroup>
-For framework-specific examples, see [Using as native tools](/tool-router/using-as-native-tools).
+For framework-specific examples, see [Using as native tools](/tool-router/using-as-native-tools). */}
### mcp
diff --git a/fern/pages/src/tool-router/manually-authenticating-users.mdx b/fern/pages/src/tool-router/manually-authenticating-users.mdx
index d95020070..b59043114 100644
--- a/fern/pages/src/tool-router/manually-authenticating-users.mdx
+++ b/fern/pages/src/tool-router/manually-authenticating-users.mdx
@@ -131,14 +131,19 @@ A common pattern is to verify all required connections before starting the agent
<CodeGroup>
```python
+from composio import Composio
+from agents import Agent, Runner, HostedMCPTool
+
+composio = Composio()
+
required_toolkits = ["gmail", "googlecalendar", "linear", "slack"]
-session = await composio.create(
- user=user_id,
+session = composio.create(
+ user_id=user_id,
manage_connections=False,
)
-toolkits = await session.toolkits()
+toolkits = session.toolkits()
def is_connected(slug):
toolkit = next((t for t in toolkits if t.slug == slug), None)
@@ -148,18 +153,37 @@ pending = [slug for slug in required_toolkits if not is_connected(slug)]
if pending:
for slug in pending:
- connection_request = await session.authorize(
+ connection_request = session.authorize(
slug,
callback_url="https://yourapp.com/onboarding"
)
- # Show connection_request.redirect_url to user
-
- # Wait for all connections before continuing
+ print(f"Connect {slug}: {connection_request.redirect_url}")
+ connection_request.wait_for_connection()
+
+agent = Agent(
+ name="Personal Assistant",
+ instructions="You are a helpful personal assistant.",
+ tools=[
+ HostedMCPTool(
+ tool_config={
+ "type": "mcp",
+ "server_label": "composio",
+ "server_url": session.mcp.url,
+ "require_approval": "never",
+ }
+ )
+ ],
+)
-# All apps connected, start the agent
-tools = await session.tools()
+result = Runner.run_sync(agent, "Summarize my emails from today")
+print(result.final_output)
```
```typescript
+import { Composio } from "@composio/core";
+import { Agent, run, hostedMcpTool } from "@openai/agents";
+
+const composio = new Composio();
+
const requiredToolkits = ["gmail", "googlecalendar", "linear", "slack"];
const session = await composio.create(userId, {
@@ -173,18 +197,27 @@ const pending = requiredToolkits.filter((slug) => {
return !toolkit?.connectedAccount;
});
-if (pending.length > 0) {
- for (const slug of pending) {
- const connectionRequest = await session.authorize(slug, {
- callbackUrl: "https://yourapp.com/onboarding",
- });
- // Show connectionRequest.redirectUrl to user
- }
- // Wait for all connections before continuing
+for (const slug of pending) {
+ const connectionRequest = await session.authorize(slug, {
+ callbackUrl: "https://yourapp.com/onboarding",
+ });
+ console.log(`Connect ${slug}: ${connectionRequest.redirectUrl}`);
+ await connectionRequest.waitForConnection();
}
-// All apps connected, start the agent
-const tools = await session.tools();
+const agent = new Agent({
+ name: "Personal Assistant",
+ instructions: "You are a helpful personal assistant.",
+ tools: [
+ hostedMcpTool({
+ serverLabel: "composio",
+ serverUrl: session.mcp.url,
+ }),
+ ],
+});
+
+const result = await run(agent, "Summarize my emails from today");
+console.log(result.finalOutput);
```
</CodeGroup>
diff --git a/fern/pages/src/tool-router/overview.mdx b/fern/pages/src/tool-router/overview.mdx
index d359b73fc..13c9f1dcb 100644
--- a/fern/pages/src/tool-router/overview.mdx
+++ b/fern/pages/src/tool-router/overview.mdx
@@ -21,4 +21,4 @@ This is what powers complex agentic products like [Rube](https://rube.app).
- [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 native tools](/tool-router/using-as-native-tools): Guides on how to use Tool router as a tool with popular Agentic Providers.
+{/* - [Using as native tools](/tool-router/using-as-native-tools): Guides on how to use Tool router as a tool with popular Agentic Providers. */}
diff --git a/fern/pages/src/tool-router/quickstart.mdx b/fern/pages/src/tool-router/quickstart.mdx
index 4833b6c7d..2ed1476a4 100644
--- a/fern/pages/src/tool-router/quickstart.mdx
+++ b/fern/pages/src/tool-router/quickstart.mdx
@@ -62,8 +62,6 @@ console.log(result.finalOutput);
<Info>
`pg-user-550e8400-e29b-41d4` is a placeholder for your user's ID. See [User Management](/docs/user-management) for details.
</Info>
-
-To use OpenAI Agents SDK with Tool Router as native tools instead, see [Using as Native Tools](/tool-router/using-as-native-tools#openai).
</Step>
</Steps>
@@ -133,180 +131,10 @@ for await (const textPart of stream.textStream) {
<Info>
`pg-user-550e8400-e29b-41d4` is a placeholder for your user's ID. See [User Management](/docs/user-management) for details.
</Info>
-
-To use Vercel AI SDK with Tool Router as native tools instead, see [Using as Native Tools](/tool-router/using-as-native-tools#vercel).
-</Step>
-</Steps>
-
-</Tab>
-
-{/* <Tab title="Anthropic (TypeScript)">
-
-<Steps>
-<Step title="Install Composio SDK">
-```bash
-npm install @composio/core @anthropic-ai/claude-agent-sdk
-```
-</Step>
-
-<Step title="Create session and run agent">
-[Sessions](/tool-router/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
-
-<Info>
-Replace `your-composio-api-key` with your Composio API key from the [settings](https://platform.composio.dev/?next_page=/settings) page.
-</Info>
-
-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).
-
-```typescript
-import { Composio } from "@composio/core";
-import { query } from "@anthropic-ai/claude-agent-sdk";
-
-const composio = new Composio({ apiKey: "your-composio-api-key" });
-
-console.log("Creating Tool Router session...");
-const { mcp } = await composio.create("pg-user-550e8400-e29b-41d4");
-console.log(`Tool Router session created: ${mcp.url}`);
-
-console.log("Waiting for agent response...");
-for await (const message of query({
- prompt: "Summarize all the emails in my Gmail inbox today",
- options: {
- systemPrompt: "You are a helpful personal assistant.",
- mcpServers: {
- composio: {
- type: "http",
- url: mcp.url,
- headers: { "x-api-key": "your-composio-api-key" },
- },
- },
- },
-})) {
- if (message.type === "result" && message.subtype === "success") {
- console.log(message.result);
- }
-}
-```
-
-<Info>
-`pg-user-550e8400-e29b-41d4` is a placeholder for your user's ID. See [User Management](/docs/user-management) for details.
-</Info>
-
-To use Anthropic Agents SDK with Tool Router as native tools instead, see [Using as Native Tools](/tool-router/using-as-native-tools#anthropic).
-</Step>
-</Steps>
-
-</Tab>
-
-<Tab title="OpenAI (Python)">
-
-<Steps>
-<Step title="Install Composio SDK">
-```bash
-pip install composio openai-agents
-```
-</Step>
-
-<Step title="Create session and run agent">
-[Sessions](/tool-router/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
-
-<Info>
-Replace `your-composio-api-key` with your Composio API key from the [settings](https://platform.composio.dev/?next_page=/settings) page.
-</Info>
-
-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).
-
-```python
-from composio import Composio
-from agents import Agent, Runner, HostedMCPTool
-
-composio = Composio(api_key="your-composio-api-key")
-
-session = composio.create(user_id="pg-user-550e8400-e29b-41d4")
-
-agent = Agent(
- name="Personal Assistant",
- instructions="You are a helpful personal assistant.",
- tools=[
- HostedMCPTool(
- tool_config={
- "type": "mcp",
- "server_label": "composio",
- "server_url": session.mcp.url,
- "require_approval": "never",
- "headers": {
- "x-api-key": "your-composio-api-key",
- },
- }
- )
- ],
-)
-
-result = Runner.run_sync(
- agent,
- "Summarize all the emails in my Gmail inbox today"
-)
-print(result.final_output)
-```
-
-<Info>
-`pg-user-550e8400-e29b-41d4` is a placeholder for your user's ID. See [User Management](/docs/user-management) for details.
-</Info>
-
-To use OpenAI Agents SDK with Tool Router as native tools instead, see [Using as Native Tools](/tool-router/using-as-native-tools#openai).
</Step>
</Steps>
</Tab>
-
-<Tab title="Anthropic (Python)">
-
-<Steps>
-<Step title="Install Composio SDK">
-```bash
-pip install composio anthropic-agents
-```
-</Step>
-
-<Step title="Create session and run agent">
-[Sessions](/tool-router/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
-
-<Info>
-Replace `your-composio-api-key` with your Composio API key from the [settings](https://platform.composio.dev/?next_page=/settings) page.
-</Info>
-
-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).
-
-```python
-from composio import Composio
-from anthropic_agents import Agent, run
-
-composio = Composio(api_key="your-composio-api-key")
-
-session = composio.create(user_id="pg-user-550e8400-e29b-41d4")
-
-agent = Agent(
- name="Personal Assistant",
- instructions="You are a helpful personal assistant.",
- mcp_servers=[session.mcp.url]
-)
-
-result = run(
- agent,
- "Summarize all the emails in my Gmail inbox today"
-)
-print(result.final_output)
-```
-
-<Info>
-`pg-user-550e8400-e29b-41d4` is a placeholder for your user's ID. See [User Management](/docs/user-management) for details.
-</Info>
-
-To use Anthropic Agents SDK with Tool Router as native tools instead, see [Using as Native Tools](/tool-router/using-as-native-tools#anthropic).
-</Step>
-</Steps>
-
-</Tab> */}
</Tabs>
## What just happened?
diff --git a/fern/snippets/tool-router/python/manual-auth.py b/fern/snippets/tool-router/python/manual-auth.py
index 363f84d8c..fdcdc600a 100644
--- a/fern/snippets/tool-router/python/manual-auth.py
+++ b/fern/snippets/tool-router/python/manual-auth.py
@@ -1,43 +1,52 @@
-import asyncio
from composio import Composio
+from agents import Agent, Runner, HostedMCPTool
composio = Composio(api_key="your-composio-api-key")
user_id = "pg-user-550e8400-e29b-41d4"
required_toolkits = ["gmail", "googlecalendar", "linear", "slack"]
-async def main():
- session = await composio.create(
- user=user_id,
- manage_connections=False,
- )
-
- toolkits = await session.toolkits()
-
- def is_connected(slug):
- toolkit = next((t for t in toolkits if t.slug == slug), None)
- return toolkit and toolkit.connected_account
-
- pending = [slug for slug in required_toolkits if not is_connected(slug)]
-
- if pending:
- print("Connect these apps to continue:")
-
- for slug in pending:
- connection_request = await session.authorize(
- slug,
- callback_url="https://yourapp.com/onboarding"
- )
- print(f" {slug}: {connection_request.redirect_url}")
-
- print("\nWaiting for connections...")
-
- for slug in pending:
- connection_request = await session.authorize(slug)
- await connection_request.wait_for_connection(60000)
- print(f" {slug} connected")
-
- print("\nAll apps connected. Starting assistant...")
- tools = await session.tools()
-
-asyncio.run(main())
+session = composio.create(
+ user_id=user_id,
+ manage_connections=False,
+)
+
+toolkits = session.toolkits()
+
+def is_connected(slug):
+ toolkit = next((t for t in toolkits if t.slug == slug), None)
+ return toolkit and toolkit.connected_account
+
+pending = [slug for slug in required_toolkits if not is_connected(slug)]
+
+if pending:
+ print("Connect these apps to continue:")
+
+ for slug in pending:
+ connection_request = session.authorize(
+ slug,
+ callback_url="https://yourapp.com/onboarding"
+ )
+ print(f" {slug}: {connection_request.redirect_url}")
+ connection_request.wait_for_connection(60000)
+ print(f" {slug} connected")
+
+print("\nAll apps connected. Starting assistant...")
+
+agent = Agent(
+ name="Personal Assistant",
+ instructions="You are a helpful personal assistant.",
+ tools=[
+ HostedMCPTool(
+ tool_config={
+ "type": "mcp",
+ "server_label": "composio",
+ "server_url": session.mcp.url,
+ "require_approval": "never",
+ }
+ )
+ ],
+)
+
+result = Runner.run_sync(agent, "Summarize my emails from today")
+print(result.final_output)
diff --git a/fern/snippets/tool-router/typescript/manual-auth.ts b/fern/snippets/tool-router/typescript/manual-auth.ts
index e66589343..1c1cb754f 100644
--- a/fern/snippets/tool-router/typescript/manual-auth.ts
+++ b/fern/snippets/tool-router/typescript/manual-auth.ts
@@ -1,43 +1,47 @@
import { Composio } from "@composio/core";
+import { Agent, run, hostedMcpTool } from "@openai/agents";
const composio = new Composio({ apiKey: "your-composio-api-key" });
const userId = "pg-user-550e8400-e29b-41d4";
const requiredToolkits = ["gmail", "googlecalendar", "linear", "slack"];
-async function main() {
- const session = await composio.create(userId, {
- manageConnections: false,
- });
+const session = await composio.create(userId, {
+ manageConnections: false,
+});
- const toolkits = await session.toolkits();
+const toolkits = await session.toolkits();
- const pending = requiredToolkits.filter((slug) => {
- const toolkit = toolkits.find((t) => t.slug === slug);
- return !toolkit?.connectedAccount;
- });
+const pending = requiredToolkits.filter((slug) => {
+ const toolkit = toolkits.find((t) => t.slug === slug);
+ return !toolkit?.connectedAccount;
+});
- if (pending.length > 0) {
- console.log("Connect these apps to continue:");
+if (pending.length > 0) {
+ console.log("Connect these apps to continue:");
- for (const slug of pending) {
- const connectionRequest = await session.authorize(slug, {
- callbackUrl: "https://yourapp.com/onboarding",
- });
- console.log(` ${slug}: ${connectionRequest.redirectUrl}`);
- }
-
- console.log("\nWaiting for connections...");
-
- for (const slug of pending) {
- const connectionRequest = await session.authorize(slug);
- await connectionRequest.waitForConnection(60000);
- console.log(` ${slug} connected`);
- }
+ for (const slug of pending) {
+ const connectionRequest = await session.authorize(slug, {
+ callbackUrl: "https://yourapp.com/onboarding",
+ });
+ console.log(` ${slug}: ${connectionRequest.redirectUrl}`);
+ await connectionRequest.waitForConnection(60000);
+ console.log(` ${slug} connected`);
}
-
- console.log("\nAll apps connected. Starting assistant...");
- const tools = await session.tools();
}
-main();
+console.log("\nAll apps connected. Starting assistant...");
+
+const agent = new Agent({
+ name: "Personal Assistant",
+ instructions: "You are a helpful personal assistant.",
+ tools: [
+ hostedMcpTool({
+ serverLabel: "composio",
+ serverUrl: session.mcp.url,
+ }),
+ ],
+});
+
+const result = await run(agent, "Summarize my emails from today");
+console.log(result.finalOutput);