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

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

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

Synced Nov 22, 18:15 UTC

remove native tools references

Sushmithamallesh committed Dec 8, 2025 at 17:42 UTC ca02c5e63899624b59ac675243272ac12849ba92
6 files changed +133 -259
fern/pages/src/tool-router/creating-sessions.mdx
+2 -2
@@ -158,7 +158,7 @@ For more details, see [Using in-chat authentication](/tool-router/using-in-chat-
158
159 ## Session methods
160
161 -### tools()
161 +{/* ### tools()
162
163 Get meta-tools to pass to your agent framework.
164
@@ -184,7 +184,7 @@ const agent = new Agent({
184 ```
185 </CodeGroup>
186
187 -For framework-specific examples, see [Using as native tools](/tool-router/using-as-native-tools).
187 +For framework-specific examples, see [Using as native tools](/tool-router/using-as-native-tools). */}
188
189 ### mcp
190
fern/pages/src/tool-router/manually-authenticating-users.mdx
+52 -19
@@ -131,14 +131,19 @@ A common pattern is to verify all required connections before starting the agent
131
132 <CodeGroup>
133 ```python
134 +from composio import Composio
135 +from agents import Agent, Runner, HostedMCPTool
136 +
137 +composio = Composio()
138 +
139 required_toolkits = ["gmail", "googlecalendar", "linear", "slack"]
140
136 -session = await composio.create(
137 - user=user_id,
141 +session = composio.create(
142 + user_id=user_id,
143 manage_connections=False,
144 )
145
141 -toolkits = await session.toolkits()
146 +toolkits = session.toolkits()
147
148 def is_connected(slug):
149 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)]
153
154 if pending:
155 for slug in pending:
151 - connection_request = await session.authorize(
156 + connection_request = session.authorize(
157 slug,
158 callback_url="https://yourapp.com/onboarding"
159 )
155 - # Show connection_request.redirect_url to user
156 -
157 - # Wait for all connections before continuing
160 + print(f"Connect {slug}: {connection_request.redirect_url}")
161 + connection_request.wait_for_connection()
162 +
163 +agent = Agent(
164 + name="Personal Assistant",
165 + instructions="You are a helpful personal assistant.",
166 + tools=[
167 + HostedMCPTool(
168 + tool_config={
169 + "type": "mcp",
170 + "server_label": "composio",
171 + "server_url": session.mcp.url,
172 + "require_approval": "never",
173 + }
174 + )
175 + ],
176 +)
177
159 -# All apps connected, start the agent
160 -tools = await session.tools()
178 +result = Runner.run_sync(agent, "Summarize my emails from today")
179 +print(result.final_output)
180 ```
181 ```typescript
182 +import { Composio } from "@composio/core";
183 +import { Agent, run, hostedMcpTool } from "@openai/agents";
184 +
185 +const composio = new Composio();
186 +
187 const requiredToolkits = ["gmail", "googlecalendar", "linear", "slack"];
188
189 const session = await composio.create(userId, {
@@ -173,18 +197,27 @@ const pending = requiredToolkits.filter((slug) => {
197 return !toolkit?.connectedAccount;
198 });
199
176 -if (pending.length > 0) {
177 - for (const slug of pending) {
178 - const connectionRequest = await session.authorize(slug, {
179 - callbackUrl: "https://yourapp.com/onboarding",
180 - });
181 - // Show connectionRequest.redirectUrl to user
182 - }
183 - // Wait for all connections before continuing
200 +for (const slug of pending) {
201 + const connectionRequest = await session.authorize(slug, {
202 + callbackUrl: "https://yourapp.com/onboarding",
203 + });
204 + console.log(`Connect ${slug}: ${connectionRequest.redirectUrl}`);
205 + await connectionRequest.waitForConnection();
206 }
207
186 -// All apps connected, start the agent
187 -const tools = await session.tools();
208 +const agent = new Agent({
209 + name: "Personal Assistant",
210 + instructions: "You are a helpful personal assistant.",
211 + tools: [
212 + hostedMcpTool({
213 + serverLabel: "composio",
214 + serverUrl: session.mcp.url,
215 + }),
216 + ],
217 +});
218 +
219 +const result = await run(agent, "Summarize my emails from today");
220 +console.log(result.finalOutput);
221 ```
222 </CodeGroup>
223
fern/pages/src/tool-router/overview.mdx
+1 -1
@@ -21,4 +21,4 @@ This is what powers complex agentic products like [Rube](https://rube.app).
21
22 - [Quickstart](/tool-router/quickstart): Build your first AI agent with Tool Router.
23 - [Using with MCP clients](/tool-router/using-with-mcp-clients): Guides on how to use Tool Router MCP with popular MCP clients.
24 -- [Using as native tools](/tool-router/using-as-native-tools): Guides on how to use Tool router as a tool with popular Agentic Providers.
24 +{/* - [Using as native tools](/tool-router/using-as-native-tools): Guides on how to use Tool router as a tool with popular Agentic Providers. */}
fern/pages/src/tool-router/quickstart.mdx
-172
@@ -62,8 +62,6 @@ console.log(result.finalOutput);
62 <Info>
63 `pg-user-550e8400-e29b-41d4` is a placeholder for your user's ID. See [User Management](/docs/user-management) for details.
64 </Info>
65 -
66 -To use OpenAI Agents SDK with Tool Router as native tools instead, see [Using as Native Tools](/tool-router/using-as-native-tools#openai).
65 </Step>
66 </Steps>
67
@@ -133,180 +131,10 @@ for await (const textPart of stream.textStream) {
131 <Info>
132 `pg-user-550e8400-e29b-41d4` is a placeholder for your user's ID. See [User Management](/docs/user-management) for details.
133 </Info>
136 -
137 -To use Vercel AI SDK with Tool Router as native tools instead, see [Using as Native Tools](/tool-router/using-as-native-tools#vercel).
138 -</Step>
139 -</Steps>
140 -
141 -</Tab>
142 -
143 -{/* <Tab title="Anthropic (TypeScript)">
144 -
145 -<Steps>
146 -<Step title="Install Composio SDK">
147 -```bash
148 -npm install @composio/core @anthropic-ai/claude-agent-sdk
149 -```
150 -</Step>
151 -
152 -<Step title="Create session and run agent">
153 -[Sessions](/tool-router/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
154 -
155 -<Info>
156 -Replace `your-composio-api-key` with your Composio API key from the [settings](https://platform.composio.dev/?next_page=/settings) page.
157 -</Info>
158 -
159 -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).
160 -
161 -```typescript
162 -import { Composio } from "@composio/core";
163 -import { query } from "@anthropic-ai/claude-agent-sdk";
164 -
165 -const composio = new Composio({ apiKey: "your-composio-api-key" });
166 -
167 -console.log("Creating Tool Router session...");
168 -const { mcp } = await composio.create("pg-user-550e8400-e29b-41d4");
169 -console.log(`Tool Router session created: ${mcp.url}`);
170 -
171 -console.log("Waiting for agent response...");
172 -for await (const message of query({
173 - prompt: "Summarize all the emails in my Gmail inbox today",
174 - options: {
175 - systemPrompt: "You are a helpful personal assistant.",
176 - mcpServers: {
177 - composio: {
178 - type: "http",
179 - url: mcp.url,
180 - headers: { "x-api-key": "your-composio-api-key" },
181 - },
182 - },
183 - },
184 -})) {
185 - if (message.type === "result" && message.subtype === "success") {
186 - console.log(message.result);
187 - }
188 -}
189 -```
190 -
191 -<Info>
192 -`pg-user-550e8400-e29b-41d4` is a placeholder for your user's ID. See [User Management](/docs/user-management) for details.
193 -</Info>
194 -
195 -To use Anthropic Agents SDK with Tool Router as native tools instead, see [Using as Native Tools](/tool-router/using-as-native-tools#anthropic).
196 -</Step>
197 -</Steps>
198 -
199 -</Tab>
200 -
201 -<Tab title="OpenAI (Python)">
202 -
203 -<Steps>
204 -<Step title="Install Composio SDK">
205 -```bash
206 -pip install composio openai-agents
207 -```
208 -</Step>
209 -
210 -<Step title="Create session and run agent">
211 -[Sessions](/tool-router/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
212 -
213 -<Info>
214 -Replace `your-composio-api-key` with your Composio API key from the [settings](https://platform.composio.dev/?next_page=/settings) page.
215 -</Info>
216 -
217 -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).
218 -
219 -```python
220 -from composio import Composio
221 -from agents import Agent, Runner, HostedMCPTool
222 -
223 -composio = Composio(api_key="your-composio-api-key")
224 -
225 -session = composio.create(user_id="pg-user-550e8400-e29b-41d4")
226 -
227 -agent = Agent(
228 - name="Personal Assistant",
229 - instructions="You are a helpful personal assistant.",
230 - tools=[
231 - HostedMCPTool(
232 - tool_config={
233 - "type": "mcp",
234 - "server_label": "composio",
235 - "server_url": session.mcp.url,
236 - "require_approval": "never",
237 - "headers": {
238 - "x-api-key": "your-composio-api-key",
239 - },
240 - }
241 - )
242 - ],
243 -)
244 -
245 -result = Runner.run_sync(
246 - agent,
247 - "Summarize all the emails in my Gmail inbox today"
248 -)
249 -print(result.final_output)
250 -```
251 -
252 -<Info>
253 -`pg-user-550e8400-e29b-41d4` is a placeholder for your user's ID. See [User Management](/docs/user-management) for details.
254 -</Info>
255 -
256 -To use OpenAI Agents SDK with Tool Router as native tools instead, see [Using as Native Tools](/tool-router/using-as-native-tools#openai).
134 </Step>
135 </Steps>
136
137 </Tab>
261 -
262 -<Tab title="Anthropic (Python)">
263 -
264 -<Steps>
265 -<Step title="Install Composio SDK">
266 -```bash
267 -pip install composio anthropic-agents
268 -```
269 -</Step>
270 -
271 -<Step title="Create session and run agent">
272 -[Sessions](/tool-router/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
273 -
274 -<Info>
275 -Replace `your-composio-api-key` with your Composio API key from the [settings](https://platform.composio.dev/?next_page=/settings) page.
276 -</Info>
277 -
278 -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).
279 -
280 -```python
281 -from composio import Composio
282 -from anthropic_agents import Agent, run
283 -
284 -composio = Composio(api_key="your-composio-api-key")
285 -
286 -session = composio.create(user_id="pg-user-550e8400-e29b-41d4")
287 -
288 -agent = Agent(
289 - name="Personal Assistant",
290 - instructions="You are a helpful personal assistant.",
291 - mcp_servers=[session.mcp.url]
292 -)
293 -
294 -result = run(
295 - agent,
296 - "Summarize all the emails in my Gmail inbox today"
297 -)
298 -print(result.final_output)
299 -```
300 -
301 -<Info>
302 -`pg-user-550e8400-e29b-41d4` is a placeholder for your user's ID. See [User Management](/docs/user-management) for details.
303 -</Info>
304 -
305 -To use Anthropic Agents SDK with Tool Router as native tools instead, see [Using as Native Tools](/tool-router/using-as-native-tools#anthropic).
306 -</Step>
307 -</Steps>
308 -
309 -</Tab> */}
138 </Tabs>
139
140 ## What just happened?
fern/snippets/tool-router/python/manual-auth.py
+45 -36
@@ -1,43 +1,52 @@
1 -import asyncio
1 from composio import Composio
2 +from agents import Agent, Runner, HostedMCPTool
3
4 composio = Composio(api_key="your-composio-api-key")
5
6 user_id = "pg-user-550e8400-e29b-41d4"
7 required_toolkits = ["gmail", "googlecalendar", "linear", "slack"]
8
9 -async def main():
10 - session = await composio.create(
11 - user=user_id,
12 - manage_connections=False,
13 - )
14 -
15 - toolkits = await session.toolkits()
16 -
17 - def is_connected(slug):
18 - toolkit = next((t for t in toolkits if t.slug == slug), None)
19 - return toolkit and toolkit.connected_account
20 -
21 - pending = [slug for slug in required_toolkits if not is_connected(slug)]
22 -
23 - if pending:
24 - print("Connect these apps to continue:")
25 -
26 - for slug in pending:
27 - connection_request = await session.authorize(
28 - slug,
29 - callback_url="https://yourapp.com/onboarding"
30 - )
31 - print(f" {slug}: {connection_request.redirect_url}")
32 -
33 - print("\nWaiting for connections...")
34 -
35 - for slug in pending:
36 - connection_request = await session.authorize(slug)
37 - await connection_request.wait_for_connection(60000)
38 - print(f" {slug} connected")
39 -
40 - print("\nAll apps connected. Starting assistant...")
41 - tools = await session.tools()
42 -
43 -asyncio.run(main())
9 +session = composio.create(
10 + user_id=user_id,
11 + manage_connections=False,
12 +)
13 +
14 +toolkits = session.toolkits()
15 +
16 +def is_connected(slug):
17 + toolkit = next((t for t in toolkits if t.slug == slug), None)
18 + return toolkit and toolkit.connected_account
19 +
20 +pending = [slug for slug in required_toolkits if not is_connected(slug)]
21 +
22 +if pending:
23 + print("Connect these apps to continue:")
24 +
25 + for slug in pending:
26 + connection_request = session.authorize(
27 + slug,
28 + callback_url="https://yourapp.com/onboarding"
29 + )
30 + print(f" {slug}: {connection_request.redirect_url}")
31 + connection_request.wait_for_connection(60000)
32 + print(f" {slug} connected")
33 +
34 +print("\nAll apps connected. Starting assistant...")
35 +
36 +agent = Agent(
37 + name="Personal Assistant",
38 + instructions="You are a helpful personal assistant.",
39 + tools=[
40 + HostedMCPTool(
41 + tool_config={
42 + "type": "mcp",
43 + "server_label": "composio",
44 + "server_url": session.mcp.url,
45 + "require_approval": "never",
46 + }
47 + )
48 + ],
49 +)
50 +
51 +result = Runner.run_sync(agent, "Summarize my emails from today")
52 +print(result.final_output)
fern/snippets/tool-router/typescript/manual-auth.ts
+33 -29
@@ -1,43 +1,47 @@
1 import { Composio } from "@composio/core";
2 +import { Agent, run, hostedMcpTool } from "@openai/agents";
3
4 const composio = new Composio({ apiKey: "your-composio-api-key" });
5
6 const userId = "pg-user-550e8400-e29b-41d4";
7 const requiredToolkits = ["gmail", "googlecalendar", "linear", "slack"];
8
8 -async function main() {
9 - const session = await composio.create(userId, {
10 - manageConnections: false,
11 - });
9 +const session = await composio.create(userId, {
10 + manageConnections: false,
11 +});
12
13 - const toolkits = await session.toolkits();
13 +const toolkits = await session.toolkits();
14
15 - const pending = requiredToolkits.filter((slug) => {
16 - const toolkit = toolkits.find((t) => t.slug === slug);
17 - return !toolkit?.connectedAccount;
18 - });
15 +const pending = requiredToolkits.filter((slug) => {
16 + const toolkit = toolkits.find((t) => t.slug === slug);
17 + return !toolkit?.connectedAccount;
18 +});
19
20 - if (pending.length > 0) {
21 - console.log("Connect these apps to continue:");
20 +if (pending.length > 0) {
21 + console.log("Connect these apps to continue:");
22
23 - for (const slug of pending) {
24 - const connectionRequest = await session.authorize(slug, {
25 - callbackUrl: "https://yourapp.com/onboarding",
26 - });
27 - console.log(` ${slug}: ${connectionRequest.redirectUrl}`);
28 - }
29 -
30 - console.log("\nWaiting for connections...");
31 -
32 - for (const slug of pending) {
33 - const connectionRequest = await session.authorize(slug);
34 - await connectionRequest.waitForConnection(60000);
35 - console.log(` ${slug} connected`);
36 - }
23 + for (const slug of pending) {
24 + const connectionRequest = await session.authorize(slug, {
25 + callbackUrl: "https://yourapp.com/onboarding",
26 + });
27 + console.log(` ${slug}: ${connectionRequest.redirectUrl}`);
28 + await connectionRequest.waitForConnection(60000);
29 + console.log(` ${slug} connected`);
30 }
38 -
39 - console.log("\nAll apps connected. Starting assistant...");
40 - const tools = await session.tools();
31 }
32
43 -main();
33 +console.log("\nAll apps connected. Starting assistant...");
34 +
35 +const agent = new Agent({
36 + name: "Personal Assistant",
37 + instructions: "You are a helpful personal assistant.",
38 + tools: [
39 + hostedMcpTool({
40 + serverLabel: "composio",
41 + serverUrl: session.mcp.url,
42 + }),
43 + ],
44 +});
45 +
46 +const result = await run(agent, "Summarize my emails from today");
47 +console.log(result.finalOutput);