@devries-cameron20 / composio Mirror · read-only / commits / b55b157c6
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, 17:00 UTC

remove unnecessary things

Sushmithamallesh committed Dec 15, 2025 at 22:14 UTC b55b157c6b750b9395ed94cff2082d701480e784
22 files changed +11 -1257
fern/pages/src/get-started/quickstart-preview.mdx deleted
-959
@@ -1,959 +0,0 @@
1 ----
2 -title: Quickstart
3 -image: "https://og.composio.dev/api/og?title=Quickstart" # image for socials
4 -subtitle: Connect AI agents to 500+ tools in under 5 minutes
5 -description: "Build production-ready AI agents with real-world tool access using Composio's powerful integration platform"
6 ----
7 -
8 -
9 -## Prerequisites
10 -
11 -Before you begin, ensure you have:
12 -- **Composio account**: [Sign up free](https://platform.composio.dev) (no credit card required)
13 -- **API key**: Get it from [your dashboard](https://platform.composio.dev?next_page=/settings)
14 -- **Development environment**: Python 3.10+ or Node.js 18+
15 -- **AI provider API key**: OpenAI, Anthropic, or other supported provider
16 -
17 -
18 -## Execute your first tool
19 -
20 -Composio offers three ways to connect AI agents to tools:
21 -
22 -<Tabs>
23 -<Tab title="Tool Router">
24 -Single MCP server and Tool that can search, authenticate, and execute across all Composio tools.
25 -
26 -<Steps>
27 -<Step title="Install SDK">
28 -<CodeGroup>
29 -```bash Python
30 -pip install composio
31 -```
32 -```bash TypeScript
33 -npm install @composio/core
34 -```
35 -</CodeGroup>
36 -</Step>
37 -
38 -<Step title="Create a session">
39 -Initialize Tool Router with your toolkits:
40 -
41 -<CodeGroup>
42 -```python Python
43 -from composio import Composio
44 -
45 -composio = Composio()
46 -
47 -session = composio.tool_router.create(
48 - user_id='user-123',
49 - toolkits=['gmail', 'calendar', 'slack', 'notion']
50 -)
51 -
52 -print(f'Session created: {session.id}')
53 -```
54 -```typescript TypeScript
55 -import { Composio } from '@composio/core';
56 -
57 -const composio = new Composio();
58 -
59 -const session = await composio.toolRouter.create({
60 - userId: 'user-123',
61 - toolkits: ['gmail', 'calendar', 'slack', 'notion']
62 -});
63 -
64 -console.log('Session created:', session.id);
65 -```
66 -</CodeGroup>
67 -</Step>
68 -
69 -<Step title="Get tools and execute">
70 -Use the session to get tools for any AI framework:
71 -
72 -<CodeGroup>
73 -```python Python
74 -from openai import OpenAI
75 -
76 -client = OpenAI()
77 -
78 -tools = session.get_tools()
79 -
80 -response = client.chat.completions.create(
81 - model="gpt-4",
82 - messages=[{
83 - "role": "user",
84 - "content": "Send an email to john@example.com about the meeting"
85 - }],
86 - tools=tools,
87 - tool_choice="auto"
88 -)
89 -
90 -result = session.handle_tool_call(response)
91 -print(f"Result: {result}")
92 -```
93 -```typescript TypeScript
94 -import OpenAI from 'openai';
95 -
96 -const client = new OpenAI();
97 -
98 -const tools = await session.getTools();
99 -
100 -const response = await client.chat.completions.create({
101 - model: 'gpt-4',
102 - messages: [{
103 - role: 'user',
104 - content: 'Send an email to john@example.com about the meeting'
105 - }],
106 - tools: tools,
107 - tool_choice: 'auto'
108 -});
109 -
110 -const result = await session.handleToolCall(response);
111 -console.log('Result:', result);
112 -```
113 -</CodeGroup>
114 -</Step>
115 -</Steps>
116 -
117 -<CardGroup cols={2}>
118 -<Card title="Tool Router Overview" icon="fa-light fa-sparkles" href="/tool-router/overview">
119 -Learn about Tool Router capabilities
120 -</Card>
121 -<Card title="Tool Router Quickstart" icon="fa-light fa-rocket" href="/tool-router/quickstart">
122 -Complete quickstart guide
123 -</Card>
124 -</CardGroup>
125 -
126 -</Tab>
127 -
128 -<Tab title="Composio Tools">
129 -Use Composio SDK to integrate tools directly with your favorite AI frameworks.
130 -
131 -<Tabs>
132 -<Tab title="OpenAI">
133 -<Steps>
134 -<Step title="Install Composio SDK and Authenticate your Users">
135 -Install the toolkit to get started
136 -
137 -<CodeGroup>
138 -```bash Python
139 -pip install composio composio-openai
140 -```
141 -```bash TypeScript
142 -npm install @composio/core @composio/openai
143 -```
144 -</CodeGroup>
145 -
146 -**Create an Auth Config for Gmail**
147 -
148 -Auth Configs help you define how users should be authenticated.
149 -
150 -<CodeGroup>
151 -```python Python
152 -from composio import Composio
153 -
154 -composio = Composio()
155 -
156 -# Create auth config for Gmail
157 -auth_config = composio.auth_configs.create(
158 - toolkit="gmail",
159 - config={
160 - "client_id": "your_gmail_client_id",
161 - "client_secret": "your_gmail_client_secret",
162 - "scopes": ["https://www.googleapis.com/auth/gmail.send"]
163 - }
164 -)
165 -
166 -print(f"Auth Config ID: {auth_config.id}")
167 -```
168 -```typescript TypeScript
169 -import { Composio } from '@composio/core';
170 -
171 -const composio = new Composio();
172 -
173 -// Create auth config for Gmail
174 -const authConfig = await composio.authConfigs.create({
175 - toolkit: 'gmail',
176 - config: {
177 - clientId: 'your_gmail_client_id',
178 - clientSecret: 'your_gmail_client_secret',
179 - scopes: ['https://www.googleapis.com/auth/gmail.send']
180 - }
181 -});
182 -
183 -console.log(`Auth Config ID: ${authConfig.id}`);
184 -```
185 -</CodeGroup>
186 -
187 -**Connect your users via the auth config**
188 -
189 -Use composio auth links to let your users authenticate their accounts.
190 -
191 -<CodeGroup>
192 -```python Python
193 -# Generate connection request for a user
194 -connection_request = composio.connected_accounts.link(
195 - user_id="user-123",
196 - auth_config_id=auth_config.id
197 -)
198 -
199 -# Redirect user to this URL for authentication
200 -print(f"Please authorize at: {connection_request.redirect_url}")
201 -
202 -# Wait for connection to be established
203 -connection = connection_request.wait_for_connection()
204 -print(f"Connected: {connection.id}")
205 -```
206 -```typescript TypeScript
207 -// Generate connection request for a user
208 -const connectionRequest = await composio.connectedAccounts.link({
209 - userId: 'user-123',
210 - authConfigId: authConfig.id
211 -});
212 -
213 -// Redirect user to this URL for authentication
214 -console.log(`Please authorize at: ${connectionRequest.redirectUrl}`);
215 -
216 -// Wait for connection to be established
217 -const connection = await connectionRequest.waitForConnection();
218 -console.log(`Connected: ${connection.id}`);
219 -```
220 -</CodeGroup>
221 -</Step>
222 -
223 -<Step title="Fetch tools and execute">
224 -Get the tool your agent needs from composio and execute it.
225 -
226 -<CodeGroup>
227 -```python Python
228 -from composio_openai import ComposioToolSet
229 -import openai
230 -
231 -# Initialize
232 -openai_client = openai.Client()
233 -toolset = ComposioToolSet()
234 -
235 -# Fetch tools for the user
236 -tools = toolset.get_tools(
237 - actions=["GMAIL_SEND_EMAIL"],
238 - entity_id="user-123"
239 -)
240 -
241 -# Use with OpenAI
242 -response = openai_client.chat.completions.create(
243 - model="gpt-4",
244 - messages=[{
245 - "role": "user",
246 - "content": "Send an email to john@example.com saying 'Meeting confirmed for 3pm tomorrow'"
247 - }],
248 - tools=tools,
249 - tool_choice="auto"
250 -)
251 -
252 -# Execute the tool call
253 -result = toolset.handle_tool_call(response, entity_id="user-123")
254 -print(f"Email sent successfully: {result}")
255 -```
256 -```typescript TypeScript
257 -import { OpenAIToolSet } from '@composio/openai';
258 -import OpenAI from 'openai';
259 -
260 -// Initialize
261 -const openai = new OpenAI();
262 -const toolset = new OpenAIToolSet({
263 - apiKey: process.env.COMPOSIO_API_KEY
264 -});
265 -
266 -// Fetch tools for the user
267 -const tools = await toolset.getTools({
268 - actions: ['GMAIL_SEND_EMAIL'],
269 - entityId: 'user-123'
270 -});
271 -
272 -// Use with OpenAI
273 -const response = await openai.chat.completions.create({
274 - model: 'gpt-4',
275 - messages: [{
276 - role: 'user',
277 - content: "Send an email to john@example.com saying 'Meeting confirmed for 3pm tomorrow'"
278 - }],
279 - tools: tools,
280 - tool_choice: 'auto'
281 -});
282 -
283 -// Execute the tool call
284 -const result = await toolset.handleToolCall(response, {
285 - entityId: 'user-123'
286 -});
287 -console.log('Email sent successfully:', result);
288 -```
289 -</CodeGroup>
290 -</Step>
291 -
292 -<Step title="Create triggers and listen to events">
293 -Setup triggers to run agents when specific events occur.
294 -
295 -<CodeGroup>
296 -```python Python
297 -# Create a trigger for new Gmail messages
298 -trigger = composio.triggers.create(
299 - user_id="user-123",
300 - toolkit="gmail",
301 - trigger_name="GMAIL_NEW_MESSAGE",
302 - config={
303 - "label_ids": ["INBOX"],
304 - "poll_interval": 60 # Check every 60 seconds
305 - }
306 -)
307 -
308 -print(f"Trigger created: {trigger.id}")
309 -
310 -# Subscribe to trigger events
311 -@composio.triggers.on("GMAIL_NEW_MESSAGE")
312 -def handle_new_email(event):
313 - print(f"New email from: {event['from']}")
314 - print(f"Subject: {event['subject']}")
315 -
316 - # Process with AI
317 - response = openai_client.chat.completions.create(
318 - model="gpt-4",
319 - messages=[{
320 - "role": "user",
321 - "content": f"Summarize this email: {event['body']}"
322 - }]
323 - )
324 -
325 - print(f"Summary: {response.choices[0].message.content}")
326 -
327 -# Start listening for events
328 -composio.triggers.start_listening()
329 -```
330 -```typescript TypeScript
331 -// Create a trigger for new Gmail messages
332 -const trigger = await composio.triggers.create({
333 - userId: 'user-123',
334 - toolkit: 'gmail',
335 - triggerName: 'GMAIL_NEW_MESSAGE',
336 - config: {
337 - labelIds: ['INBOX'],
338 - pollInterval: 60 // Check every 60 seconds
339 - }
340 -});
341 -
342 -console.log(`Trigger created: ${trigger.id}`);
343 -
344 -// Subscribe to trigger events
345 -composio.triggers.subscribe('GMAIL_NEW_MESSAGE', async (event) => {
346 - console.log(`New email from: ${event.from}`);
347 - console.log(`Subject: ${event.subject}`);
348 -
349 - // Process with AI
350 - const response = await openai.chat.completions.create({
351 - model: 'gpt-4',
352 - messages: [{
353 - role: 'user',
354 - content: `Summarize this email: ${event.body}`
355 - }]
356 - });
357 -
358 - console.log(`Summary: ${response.choices[0].message.content}`);
359 -});
360 -
361 -// Start listening for events
362 -await composio.triggers.startListening();
363 -```
364 -</CodeGroup>
365 -
366 -<Note>
367 -For production use, consider using webhooks instead of polling for better performance. See [Triggers documentation](/docs/using-triggers) for more details.
368 -</Note>
369 -</Step>
370 -</Steps>
371 -</Tab>
372 -
373 -<Tab title="Anthropic">
374 -<Steps>
375 -<Step title="Install SDK">
376 -<CodeGroup>
377 -```bash Python
378 -pip install composio composio-anthropic
379 -```
380 -```bash TypeScript
381 -npm install @composio/core @composio/anthropic
382 -```
383 -</CodeGroup>
384 -</Step>
385 -
386 -<Step title="Initialize and authenticate">
387 -<CodeGroup>
388 -```python Python
389 -from composio import Composio
390 -from composio_anthropic import ComposioToolSet
391 -import anthropic
392 -
393 -# Initialize
394 -composio = Composio()
395 -client = anthropic.Anthropic()
396 -toolset = ComposioToolSet()
397 -
398 -# Create auth config for Slack
399 -auth_config = composio.auth_configs.create(
400 - toolkit="slack",
401 - config={"client_id": "your_id", "client_secret": "your_secret"}
402 -)
403 -
404 -# Connect user account
405 -connection = composio.connected_accounts.link(
406 - user_id="user-123",
407 - auth_config_id=auth_config.id
408 -)
409 -print(f"Authorize at: {connection.redirect_url}")
410 -```
411 -```typescript TypeScript
412 -import { Composio } from '@composio/core';
413 -import { AnthropicToolSet } from '@composio/anthropic';
414 -import Anthropic from '@anthropic-ai/sdk';
415 -
416 -// Initialize
417 -const composio = new Composio();
418 -const client = new Anthropic();
419 -const toolset = new AnthropicToolSet({ composio });
420 -
421 -// Create auth config for Slack
422 -const authConfig = await composio.authConfigs.create({
423 - toolkit: 'slack',
424 - config: { clientId: 'your_id', clientSecret: 'your_secret' }
425 -});
426 -
427 -// Connect user account
428 -const connection = await composio.connectedAccounts.link({
429 - userId: 'user-123',
430 - authConfigId: authConfig.id
431 -});
432 -console.log(`Authorize at: ${connection.redirectUrl}`);
433 -```
434 -</CodeGroup>
435 -</Step>
436 -
437 -<Step title="Execute tools">
438 -<CodeGroup>
439 -```python Python
440 -# Get tools for the user
441 -tools = toolset.get_tools(actions=["SLACK_SEND_MESSAGE"])
442 -
443 -# Use with Claude
444 -response = client.messages.create(
445 - model="claude-3-sonnet-20240229",
446 - max_tokens=1024,
447 - messages=[
448 - {"role": "user", "content": "Send a message to #general channel about the standup"}
449 - ],
450 - tools=tools
451 -)
452 -
453 -# Execute the tool call
454 -result = toolset.handle_tool_call(response, entity_id="user-123")
455 -print(f"Message sent: {result}")
456 -```
457 -```typescript TypeScript
458 -// Get tools for the user
459 -const tools = await toolset.getTools({ actions: ['SLACK_SEND_MESSAGE'] });
460 -
461 -// Use with Claude
462 -const response = await client.messages.create({
463 - model: 'claude-3-sonnet-20240229',
464 - max_tokens: 1024,
465 - messages: [
466 - { role: 'user', content: 'Send a message to #general channel about the standup' }
467 - ],
468 - tools: tools
469 -});
470 -
471 -// Execute the tool call
472 -const result = await toolset.handleToolCall(response, { entityId: 'user-123' });
473 -console.log('Message sent:', result);
474 -```
475 -</CodeGroup>
476 -</Step>
477 -</Steps>
478 -</Tab>
479 -
480 -<Tab title="LangChain">
481 -<Steps>
482 -<Step title="Install SDK">
483 -```bash
484 -pip install composio-langchain langchain langchain-openai
485 -```
486 -</Step>
487 -
488 -<Step title="Initialize and authenticate">
489 -```python
490 -from composio_langchain import ComposioToolSet
491 -from langchain.agents import create_openai_functions_agent
492 -from langchain_openai import ChatOpenAI
493 -from langchain.prompts import ChatPromptTemplate
494 -
495 -# Initialize
496 -toolset = ComposioToolSet()
497 -llm = ChatOpenAI(model="gpt-4")
498 -
499 -# Create auth config for GitHub
500 -auth_config = toolset.client.auth_configs.create(
501 - toolkit="github",
502 - config={"client_id": "your_id", "client_secret": "your_secret"}
503 -)
504 -
505 -# Connect user account
506 -connection = toolset.client.connected_accounts.link(
507 - user_id="user-123",
508 - auth_config_id=auth_config.id
509 -)
510 -print(f"Authorize at: {connection.redirect_url}")
511 -```
512 -</Step>
513 -
514 -<Step title="Execute tools">
515 -```python
516 -# Get tools for the user
517 -tools = toolset.get_tools(actions=["GITHUB_CREATE_ISSUE"])
518 -
519 -# Create agent
520 -prompt = ChatPromptTemplate.from_messages([
521 - ("system", "You are a helpful assistant that can interact with GitHub."),
522 - ("human", "{input}"),
523 - ("placeholder", "{agent_scratchpad}")
524 -])
525 -
526 -agent = create_openai_functions_agent(llm, tools, prompt)
527 -from langchain.agents import AgentExecutor
528 -agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
529 -
530 -# Execute
531 -result = agent_executor.invoke({
532 - "input": "Create a new issue in the main repo about the bug we found"
533 -}, config={"metadata": {"entity_id": "user-123"}})
534 -
535 -print(f"Issue created: {result['output']}")
536 -```
537 -</Step>
538 -</Steps>
539 -</Tab>
540 -
541 -<Tab title="Vercel AI SDK">
542 -<Steps>
543 -<Step title="Install SDK">
544 -```bash
545 -npm install @composio/vercel ai
546 -```
547 -</Step>
548 -
549 -<Step title="Initialize and authenticate">
550 -```typescript
551 -import { Composio } from '@composio/core';
552 -import { VercelAIToolSet } from '@composio/vercel';
553 -import { openai } from '@ai-sdk/openai';
554 -
555 -// Initialize
556 -const composio = new Composio();
557 -const toolset = new VercelAIToolSet({ composio });
558 -
559 -// Create auth config for Notion
560 -const authConfig = await composio.authConfigs.create({
561 - toolkit: 'notion',
562 - config: { clientId: 'your_id', clientSecret: 'your_secret' }
563 -});
564 -
565 -// Connect user account
566 -const connection = await composio.connectedAccounts.link({
567 - userId: 'user-123',
568 - authConfigId: authConfig.id
569 -});
570 -console.log(`Authorize at: ${connection.redirectUrl}`);
571 -```
572 -</Step>
573 -
574 -<Step title="Execute tools">
575 -```typescript
576 -import { generateText } from 'ai';
577 -
578 -// Get tools for the user
579 -const tools = await toolset.getTools({
580 - actions: ['NOTION_CREATE_PAGE'],
581 - entityId: 'user-123'
582 -});
583 -
584 -// Use with Vercel AI SDK
585 -const { text } = await generateText({
586 - model: openai('gpt-4'),
587 - prompt: 'Create a new Notion page for the Q4 planning',
588 - tools: tools,
589 -});
590 -
591 -console.log('Page created:', text);
592 -```
593 -</Step>
594 -</Steps>
595 -</Tab>
596 -</Tabs>
597 -
598 -<AccordionGroup>
599 -<Accordion title="Supported frameworks">
600 -- OpenAI (GPT-4, GPT-3.5)
601 -- Anthropic (Claude 3.5)
602 -- Google (Gemini)
603 -- Vercel AI SDK
604 -- LangChain
605 -- LlamaIndex
606 -- CrewAI
607 -- Autogen
608 -</Accordion>
609 -
610 -<Accordion title="Advanced features">
611 -- Custom tool creation
612 -- Response modifiers
613 -- Error handling
614 -- Rate limiting
615 -- Webhook triggers
616 -</Accordion>
617 -</AccordionGroup>
618 -
619 -</Tab>
620 -
621 -<Tab title="MCP Server">
622 -Use Model Context Protocol to connect tools with any MCP-compatible AI client.
623 -
624 -<Tabs>
625 -<Tab title="Anthropic">
626 -<Steps>
627 -<Step title="Install SDK and create MCP server">
628 -<CodeGroup>
629 -```bash Python
630 -pip install composio anthropic
631 -```
632 -```bash TypeScript
633 -npm install @composio/core @anthropic-ai/sdk
634 -```
635 -</CodeGroup>
636 -
637 -Set up MCP server with your tools:
638 -
639 -<CodeGroup>
640 -```python Python
641 -from composio import Composio
642 -from anthropic import Anthropic
643 -
644 -# Initialize clients
645 -composio = Composio()
646 -anthropic = Anthropic()
647 -
648 -# Create MCP server config
649 -mcp_config = composio.mcp.create(
650 - name="dev-workflow-server",
651 - toolkits=[
652 - {"toolkit": "github", "auth_config": "ac_github_123"},
653 - {"toolkit": "linear", "auth_config": "ac_linear_456"}
654 - ],
655 - allowed_tools=["GITHUB_LIST_PRS", "GITHUB_CREATE_COMMENT", "LINEAR_CREATE_ISSUE"]
656 -)
657 -
658 -print(f"MCP Config created: {mcp_config.id}")
659 -```
660 -```typescript TypeScript
661 -import { Composio } from '@composio/core';
662 -import Anthropic from '@anthropic-ai/sdk';
663 -
664 -// Initialize clients
665 -const composio = new Composio();
666 -const anthropic = new Anthropic();
667 -
668 -// Create MCP server config
669 -const mcpConfig = await composio.mcp.create({
670 - name: 'dev-workflow-server',
671 - toolkits: [
672 - { toolkit: 'github', authConfig: 'ac_github_123' },
673 - { toolkit: 'linear', authConfig: 'ac_linear_456' }
674 - ],
675 - allowedTools: ['GITHUB_LIST_PRS', 'GITHUB_CREATE_COMMENT', 'LINEAR_CREATE_ISSUE']
676 -});
677 -
678 -console.log(`MCP Config created: ${mcpConfig.id}`);
679 -```
680 -</CodeGroup>
681 -</Step>
682 -
683 -<Step title="Generate user URL and use with Anthropic">
684 -Get user-specific URL and connect to Claude:
685 -
686 -<CodeGroup>
687 -```python Python
688 -# Generate MCP instance for user
689 -instance = mcp_config.generate("user-123")
690 -
691 -# Use MCP with Anthropic to manage development workflow
692 -response = anthropic.beta.messages.create(
693 - model="claude-3-5-sonnet-20241022",
694 - system="You are a helpful assistant with access to GitHub and Linear tools.",
695 - max_tokens=1000,
696 - messages=[{
697 - "role": "user",
698 - "content": "Check my GitHub PRs for review comments and create Linear tasks for any requested changes"
699 - }],
700 - mcp_servers=[{
701 - "type": "url",
702 - "url": instance['url'],
703 - "name": "composio-mcp-server"
704 - }],
705 - betas=["mcp-client-2025-04-04"] # Enable MCP beta
706 -)
707 -
708 -print(response.content)
709 -```
710 -```typescript TypeScript
711 -// Generate MCP instance for user
712 -const instance = await mcpConfig.generate('user-123');
713 -
714 -// Use MCP with Anthropic to manage development workflow
715 -const response = await anthropic.beta.messages.create({
716 - model: 'claude-3-5-sonnet-20241022',
717 - system: 'You are a helpful assistant with access to GitHub and Linear tools.',
718 - maxTokens: 1000,
719 - messages: [{
720 - role: 'user',
721 - content: 'Check my GitHub PRs for review comments and create Linear tasks for any requested changes'
722 - }],
723 - mcpServers: [{
724 - type: 'url',
725 - url: instance.url,
726 - name: 'composio-mcp-server'
727 - }],
728 - betas: ['mcp-client-2025-04-04'] // Enable MCP beta
729 -});
730 -
731 -console.log(response.content);
732 -```
733 -</CodeGroup>
734 -</Step>
735 -</Steps>
736 -</Tab>
737 -
738 -<Tab title="OpenAI">
739 -<Steps>
740 -<Step title="Install SDK and create MCP server">
741 -<CodeGroup>
742 -```bash Python
743 -pip install composio openai
744 -```
745 -```bash TypeScript
746 -npm install @composio/core openai
747 -```
748 -</CodeGroup>
749 -
750 -Set up MCP server with your tools:
751 -
752 -<CodeGroup>
753 -```python Python
754 -from composio import Composio
755 -from openai import OpenAI
756 -
757 -# Initialize clients
758 -composio = Composio()
759 -openai = OpenAI()
760 -
761 -# Create MCP server config
762 -mcp_config = composio.mcp.create(
763 - name="data-docs-server",
764 - toolkits=[
765 - {"toolkit": "googlesheets", "auth_config": "ac_sheets_123"},
766 - {"toolkit": "notion", "auth_config": "ac_notion_456"}
767 - ],
768 - allowed_tools=["GOOGLESHEETS_GET_DATA", "GOOGLESHEETS_UPDATE_DATA", "NOTION_CREATE_PAGE"]
769 -)
770 -
771 -print(f"MCP Config created: {mcp_config.id}")
772 -```
773 -```typescript TypeScript
774 -import { Composio } from '@composio/core';
775 -import OpenAI from 'openai';
776 -
777 -// Initialize clients
778 -const composio = new Composio();
779 -const openai = new OpenAI();
780 -
781 -// Create MCP server config
782 -const mcpConfig = await composio.mcp.create({
783 - name: 'data-docs-server',
784 - toolkits: [
785 - { toolkit: 'googlesheets', authConfig: 'ac_sheets_123' },
786 - { toolkit: 'notion', authConfig: 'ac_notion_456' }
787 - ],
788 - allowedTools: ['GOOGLESHEETS_GET_DATA', 'GOOGLESHEETS_UPDATE_DATA', 'NOTION_CREATE_PAGE']
789 -});
790 -
791 -console.log(`MCP Config created: ${mcpConfig.id}`);
792 -```
793 -</CodeGroup>
794 -</Step>
795 -
796 -<Step title="Generate user URL and use with OpenAI">
797 -Get user-specific URL and use with GPT:
798 -
799 -<CodeGroup>
800 -```python Python
801 -# Generate MCP instance for user
802 -instance = mcp_config.generate("user-123")
803 -
804 -# Use MCP with OpenAI for data management
805 -response = openai.responses.create(
806 - model="gpt-4",
807 - tools=[{
808 - "type": "mcp",
809 - "server_label": "composio-server",
810 - "server_description": "Composio MCP server with Google Sheets and Notion integrations",
811 - "server_url": instance['url'],
812 - "require_approval": "never",
813 - }],
814 - input="Export the Q4 metrics from Google Sheets and create a comprehensive Notion page with analysis"
815 -)
816 -
817 -print("Response:", response.output_text)
818 -```
819 -```typescript TypeScript
820 -// Generate MCP instance for user
821 -const instance = await mcpConfig.generate('user-123');
822 -
823 -// Use MCP with OpenAI for data management
824 -const response = await openai.responses.create({
825 - model: 'gpt-4',
826 - tools: [{
827 - type: 'mcp',
828 - serverLabel: 'composio-server',
829 - serverDescription: 'Composio MCP server with Google Sheets and Notion integrations',
830 - serverUrl: instance.url,
831 - requireApproval: 'never'
832 - }],
833 - input: 'Export the Q4 metrics from Google Sheets and create a comprehensive Notion page with analysis'
834 -});
835 -
836 -console.log('Response:', response.outputText);
837 -```
838 -</CodeGroup>
839 -</Step>
840 -</Steps>
841 -</Tab>
842 -
843 -<Tab title="Mastra">
844 -<Steps>
845 -<Step title="Install SDK and create MCP server">
846 -```bash
847 -npm install @composio/core @mastra/core
848 -```
849 -
850 -Set up MCP server with your tools:
851 -
852 -```typescript
853 -import { Composio } from '@composio/core';
854 -import { Mastra } from '@mastra/core';
855 -
856 -// Initialize clients
857 -const composio = new Composio();
858 -
859 -// Create MCP server config
860 -const mcpConfig = await composio.mcp.create({
861 - name: 'automation-server',
862 - toolkits: [
863 - { toolkit: 'slack', authConfig: 'ac_slack_123' },
864 - { toolkit: 'jira', authConfig: 'ac_jira_456' }
865 - ]
866 -});
867 -
868 -console.log(`MCP Config created: ${mcpConfig.id}`);
869 -```
870 -</Step>
871 -
872 -<Step title="Use with Mastra framework">
873 -```typescript
874 -// Generate MCP instance for user
875 -const instance = await mcpConfig.generate('user-123');
876 -
877 -// Configure Mastra with MCP
878 -const mastra = new Mastra({
879 - mcp: {
880 - servers: [{
881 - name: 'composio-mcp',
882 - url: instance.url
883 - }]
884 - }
885 -});
886 -
887 -// Use in Mastra workflow
888 -const workflow = mastra.createWorkflow({
889 - id: 'issue-tracker',
890 - execute: async (context) => {
891 - const tools = await context.mcp.getTools('composio-mcp');
892 -
893 - // Use Slack and Jira tools
894 - const result = await tools.execute('SLACK_SEND_MESSAGE', {
895 - channel: '#dev-team',
896 - text: 'New Jira ticket created'
897 - });
898 -
899 - return result;
900 - }
901 -});
902 -
903 -await workflow.run();
904 -```
905 -</Step>
906 -</Steps>
907 -</Tab>
908 -</Tabs>
909 -
910 -</Tab>
911 -</Tabs>
912 -
913 -## Real-world examples
914 -
915 -See Composio in action with these practical examples:
916 -
917 -<CardGroup cols={3}>
918 -<Card title="AI Research Assistant" icon="magnifying-glass">
919 -Perplexity + Notion + Gmail
920 -
921 -Researches topics and organizes findings
922 -</Card>
923 -
924 -<Card title="DevOps Agent" icon="code-branch">
925 -GitHub + Slack + PagerDuty
926 -
927 -Manages deployments and incidents
928 -</Card>
929 -
930 -<Card title="Sales Automation" icon="chart-line">
931 -Salesforce + Calendar + Email
932 -
933 -Automates CRM and follow-ups
934 -</Card>
935 -</CardGroup>
936 -
937 -## Next steps
938 -
939 -<CardGroup cols={2}>
940 -<Card title="Explore providers" icon="plug" href="/providers">
941 -Deep dive into framework-specific integrations
942 -</Card>
943 -
944 -<Card title="Browse tools" icon="toolbox" href="/tools">
945 -Discover all 500+ available integrations
946 -</Card>
947 -
948 -<Card title="Authentication guide" icon="key" href="/docs/authenticating-tools">
949 -Master user authentication flows
950 -</Card>
951 -
952 -<Card title="Build custom tools" icon="hammer" href="/docs/custom-tools">
953 -Create your own tool integrations
954 -</Card>
955 -</CardGroup>
956 -
957 -<Tip>
958 -**Need help?** Join our [Discord community](https://discord.com/invite/composio)
959 -</Tip>
\ No newline at end of file
fern/pages/src/tool-router/configuring-workbench.mdx deleted
-7
@@ -1,7 +0,0 @@
1 ----
2 -title: Configuring Workbench
3 -image: "https://og.composio.dev/api/og?title=Configuring%20Workbench"
4 -description: "Control workbench behavior and context management"
5 -keywords: "tool router"
6 ----
7 -
fern/pages/src/tool-router/file-upload-download.mdx deleted
-9
@@ -1,9 +0,0 @@
1 ----
2 -title: Handling files
3 -image: "https://og.composio.dev/api/og?title=Handling%20Files"
4 -description: "Handle file uploads and downloads with Tool Router"
5 -keywords: "file upload, file download, tool router"
6 -hide-nav-links: false
7 ----
8 -
9 -Coming soon.
fern/pages/src/tool-router/tool-execution-and-workbench.mdx deleted
-7
@@ -1,7 +0,0 @@
1 ----
2 -title: Tool Execution and Workbench
3 -image: "https://og.composio.dev/api/og?title=Tool%20Execution%20and%20Workbench"
4 -description: "Execute tools and manage context with the workbench"
5 -keywords: "tool router"
6 ----
7 -
fern/pages/src/tool-router/tool-search.mdx deleted
-7
@@ -1,7 +0,0 @@
1 ----
2 -title: Tool Search
3 -image: "https://og.composio.dev/api/og?title=Tool%20Search"
4 -description: "Discover the right tools for your agent"
5 -keywords: "tool router"
6 ----
7 -
fern/snippets/tool-router/python/anthropic-mcp.py deleted
-18
@@ -1,18 +0,0 @@
1 -from composio import Composio
2 -from anthropic_agents import Agent, run
3 -
4 -composio = Composio(api_key="your-api-key")
5 -
6 -session = composio.create(user_id="pg-user-550e8400-e29b-41d4")
7 -
8 -agent = Agent(
9 - name="Personal Assistant",
10 - instructions="You are a helpful personal assistant.",
11 - mcp_servers=[session.mcp.url]
12 -)
13 -
14 -result = run(
15 - agent,
16 - "Summarize all the emails in my Gmail inbox today"
17 -)
18 -print(result.final_output)
fern/snippets/tool-router/python/in-chat-auth.py deleted
-38
@@ -1,38 +0,0 @@
1 -import os
2 -from composio import Composio
3 -from agents import Agent, Runner, HostedMCPTool, ModelSettings
4 -
5 -composio_api_key = os.environ.get("COMPOSIO_API_KEY")
6 -user_id = "user_123" # Your user's unique identifier
7 -
8 -composio = Composio(api_key=composio_api_key)
9 -session = composio.create(user_id=user_id)
10 -
11 -agent = Agent(
12 - name="Personal Assistant",
13 - instructions="You are a helpful personal assistant. Use Composio tools to take action.",
14 - model="gpt-5.1",
15 - model_settings= ModelSettings(
16 - reasoning={"effort": "low"},
17 - ),
18 - tools=[
19 - HostedMCPTool(
20 - tool_config={
21 - "type": "mcp",
22 - "server_label": "composio",
23 - "server_url": session.mcp.url,
24 - "require_approval": "never",
25 - "headers": {"x-api-key": composio_api_key},
26 - }
27 - )
28 - ],
29 -)
30 -
31 -print("Assistant: What would you like me to do today?\n")
32 -
33 -while True:
34 - user_input = input("> ")
35 - if user_input == "exit":
36 - break
37 - result = Runner.run_sync(starting_agent=agent, input=user_input)
38 - print(f"Assistant: {result.final_output}\n")
fern/snippets/tool-router/python/mcp-claude.py
+1 -1
@@ -32,7 +32,7 @@ async def main():
32
33 async with ClaudeSDKClient(options) as client:
34 # Initial task
35 - query = ("Fetch all open issues from the composio/composio GitHub repository "
35 + query = ("Fetch all open issues from the composio GitHub repository "
36 "and create a Google Sheet with issue number, title, labels, and author")
37
38 print(f"Task: {query}\n")
fern/snippets/tool-router/python/mcp-openai.py
+1 -1
@@ -50,7 +50,7 @@ print("Running the OpenAI agent to fetch GitHub issues...\n")
50 # Execute a task that requires GitHub access
51 result = Runner.run_sync(
52 starting_agent=agent,
53 - input=("Fetch all the open GitHub issues on the composio/composio repository "
53 + input=("Fetch all the open GitHub issues on the composio repository "
54 "and group them by bugs/features/docs.")
55 )
56 print(f"Result: {result.final_output}")
\ No newline at end of file
fern/snippets/tool-router/python/native-tools-openai.py
+2 -2
@@ -29,7 +29,7 @@ response = client.chat.completions.create(
29 {
30 "role": "user",
31 "content": (
32 - "Fetch all open issues from the composio/composio GitHub repository "
32 + "Fetch all open issues from the composio GitHub repository "
33 "and create a summary of the top 5 by priority"
34 )
35 }
@@ -57,7 +57,7 @@ if tool_calls:
57 {
58 "role": "user",
59 "content": (
60 - "Fetch all open issues from the composio/composio GitHub repository "
60 + "Fetch all open issues from the composio GitHub repository "
61 "and create a summary of the top 5 by priority"
62 )
63 },
fern/snippets/tool-router/python/openai-agents.py deleted
-22
@@ -1,22 +0,0 @@
1 -from composio import Composio
2 -from composio_openai_agents import OpenAIAgentsProvider
3 -from agents import Agent, Runner
4 -
5 -composio = Composio(
6 - api_key="your-api-key",
7 - provider=OpenAIAgentsProvider()
8 -)
9 -
10 -session = composio.create(user_id="pg-user-550e8400-e29b-41d4")
11 -
12 -agent = Agent(
13 - name="Personal Assistant",
14 - instructions="You are a helpful personal assistant.",
15 - tools=session.tools()
16 -)
17 -
18 -result = Runner.run_sync(
19 - agent,
20 - "Summarize all the emails in my Gmail inbox today"
21 -)
22 -print(result.final_output)
fern/snippets/tool-router/python/quickstart-native-openai.py
+2 -2
@@ -29,7 +29,7 @@ response = client.chat.completions.create(
29 {
30 "role": "user",
31 "content": (
32 - "Fetch all open issues from the composio/composio GitHub repository "
32 + "Fetch all open issues from the composio GitHub repository "
33 "and create a summary of the top 5 by priority"
34 )
35 }
@@ -57,7 +57,7 @@ if tool_calls:
57 {
58 "role": "user",
59 "content": (
60 - "Fetch all open issues from the composio/composio GitHub repository "
60 + "Fetch all open issues from the composio GitHub repository "
61 "and create a summary of the top 5 by priority"
62 )
63 },
fern/snippets/tool-router/python/quickstart.py deleted
-33
@@ -1,33 +0,0 @@
1 -from composio import Composio
2 -from agents import Agent, Runner, HostedMCPTool
3 -
4 -composio = Composio(api_key="your-composio-api-key")
5 -
6 -print("Creating Tool Router session...")
7 -session = composio.create("pg-user-550e8400-e29b-41d4")
8 -print(f"Tool Router session created: {session.mcp.url}")
9 -
10 -agent = Agent(
11 - name="Personal Assistant",
12 - instructions="You are a helpful personal assistant.",
13 - tools=[
14 - HostedMCPTool(
15 - tool_config={
16 - "type": "mcp",
17 - "server_label": "composio",
18 - "server_url": session.mcp.url,
19 - "require_approval": "never",
20 - "headers": {
21 - "x-api-key": "your-composio-api-key",
22 - },
23 - }
24 - )
25 - ],
26 -)
27 -
28 -print("Running the OpenAI agent to fetch gmail inbox")
29 -result = Runner.run_sync(
30 - agent,
31 - "Summarize all the emails in my Gmail inbox today"
32 -)
33 -print(result.final_output)
fern/snippets/tool-router/typescript/anthropic-mcp.ts deleted
-18
@@ -1,18 +0,0 @@
1 -import { Composio } from "@composio/core";
2 -import { Agent, run } from "@anthropic-ai/agent";
3 -
4 -const composio = new Composio({ apiKey: "your-api-key" });
5 -
6 -const { mcp } = await composio.create("pg-user-550e8400-e29b-41d4");
7 -
8 -const agent = new Agent({
9 - name: "Personal Assistant",
10 - instructions: "You are a helpful personal assistant.",
11 - mcpServers: [mcp.url],
12 -});
13 -
14 -const result = await run(
15 - agent,
16 - "Summarize all the emails in my Gmail inbox today"
17 -);
18 -console.log(result.finalOutput);
fern/snippets/tool-router/typescript/in-chat-auth.ts deleted
-37
@@ -1,37 +0,0 @@
1 -import { Composio } from "@composio/core";
2 -import { Agent, run, hostedMcpTool } from "@openai/agents";
3 -import { createInterface } from "readline/promises";
4 -
5 -const composioApiKey = process.env.COMPOSIO_API_KEY;
6 -const userId = "user-1234"; // Your user's unique identifier
7 -
8 -const composio = new Composio({ apiKey: composioApiKey });
9 -const { mcp } = await composio.create(userId);
10 -
11 -const agent = new Agent({
12 - name: "Personal Assistant",
13 - instructions: "You are a helpful personal assistant. Use Composio tools to take action.",
14 - model: "gpt-5.1",
15 - modelSettings: {
16 - reasoning: { effort: "low" },
17 - },
18 - tools: [
19 - hostedMcpTool({
20 - serverLabel: "composio",
21 - serverUrl: mcp.url,
22 - headers: {
23 - "x-api-key": composioApiKey,
24 - },
25 - }),
26 - ],
27 -});
28 -
29 -const rl = createInterface({ input: process.stdin, output: process.stdout });
30 -console.log("Assistant: What would you like me to do today?\n");
31 -while (true) {
32 - const input = await rl.question("> ");
33 - if (input === "exit") break;
34 - const result = await run(agent, input);
35 - console.log(`Assistant: ${result.finalOutput}\n`);
36 -}
37 -rl.close();
fern/snippets/tool-router/typescript/mcp-claude.ts
+1 -1
@@ -34,7 +34,7 @@ async function main() {
34 const rl = createInterface({ input: process.stdin, output: process.stdout });
35
36 // Initial task
37 - const task = "Fetch all open issues from the composio/composio GitHub repository " +
37 + const task = "Fetch all open issues from the composio GitHub repository " +
38 "and create a Google Sheet with issue number, title, labels, and author";
39
40 console.log(`Task: ${task}\n`);
fern/snippets/tool-router/typescript/mcp-openai.ts
+1 -1
@@ -35,7 +35,7 @@ const agent = new Agent({
35 // Execute a task that requires GitHub access
36 const result = await run(
37 agent,
38 - "Fetch all the open GitHub issues on the composio/composio repository " +
38 + "Fetch all the open GitHub issues on the composio repository " +
39 "and group them by bugs/features/docs."
40 );
41
fern/snippets/tool-router/typescript/native-tools-openai.ts
+2 -2
@@ -23,7 +23,7 @@ const response = await openai.chat.completions.create({
23 messages: [
24 {
25 role: "user",
26 - content: "Fetch all open issues from the composio/composio GitHub repository " +
26 + content: "Fetch all open issues from the composio GitHub repository " +
27 "and create a summary of the top 5 by priority",
28 },
29 ],
@@ -49,7 +49,7 @@ if (toolCalls && toolCalls.length > 0) {
49 messages: [
50 {
51 role: "user",
52 - content: "Fetch all open issues from the composio/composio GitHub repository " +
52 + content: "Fetch all open issues from the composio GitHub repository " +
53 "and create a summary of the top 5 by priority",
54 },
55 response.choices[0].message,
fern/snippets/tool-router/typescript/native-tools-vercel.ts
+1 -1
@@ -16,7 +16,7 @@ const toolRouter = await session.getToolRouter();
16 // Use with Vercel AI SDK
17 const { text, toolCalls, toolResults } = await generateText({
18 model: openai("gpt-4-turbo"),
19 - prompt: "Fetch all open issues from the composio/composio GitHub repository " +
19 + prompt: "Fetch all open issues from the composio GitHub repository " +
20 "and create a summary of the top 5 by priority",
21 tools: {
22 composio_tool_router: toolRouter.tool,
fern/snippets/tool-router/typescript/openai-agents.ts deleted
-22
@@ -1,22 +0,0 @@
1 -import { Composio } from "@composio/core";
2 -import { OpenAIAgentsProvider } from "@composio/openai-agents";
3 -import { Agent, run } from "@openai/agents";
4 -
5 -const composio = new Composio({
6 - apiKey: "your-api-key",
7 - provider: new OpenAIAgentsProvider(),
8 -});
9 -
10 -const { tools } = await composio.create("pg-user-550e8400-e29b-41d4");
11 -
12 -const agent = new Agent({
13 - name: "Personal Assistant",
14 - instructions: "You are a helpful personal assistant.",
15 - tools: await tools(),
16 -});
17 -
18 -const result = await run(
19 - agent,
20 - "Summarize all the emails in my Gmail inbox today"
21 -);
22 -console.log(result.finalOutput);
fern/snippets/tool-router/typescript/quickstart.ts deleted
-29
@@ -1,29 +0,0 @@
1 -import { Composio } from "@composio/core";
2 -import { Agent, hostedMcpTool, run } from "@openai/agents";
3 -
4 -const composio = new Composio({ apiKey: "your-composio-api-key" });
5 -
6 -console.log("Creating Tool Router session...");
7 -const { mcp } = await composio.create("pg-user-550e8400-e29b-41d4");
8 -console.log(`Tool Router session created: ${mcp.url}`);
9 -
10 -const agent = new Agent({
11 - name: "Personal Assistant",
12 - instructions: "You are a helpful personal assistant.",
13 - tools: [
14 - hostedMcpTool({
15 - serverLabel: "composio",
16 - serverUrl: mcp.url,
17 - headers: {
18 - "x-api-key": "your-composio-api-key",
19 - },
20 - }),
21 - ],
22 -});
23 -
24 -console.log("Running the OpenAI agent to fetch gmail inbox");
25 -const result = await run(
26 - agent,
27 - "Summarize all the emails in my Gmail inbox today"
28 -);
29 -console.log(result.finalOutput);
fern/snippets/tool-router/typescript/vercel.ts deleted
-40
@@ -1,40 +0,0 @@
1 -import { openai } from "@ai-sdk/openai";
2 -import { experimental_createMCPClient as createMCPClient } from "@ai-sdk/mcp";
3 -import { Composio } from "@composio/core";
4 -import { stepCountIs, streamText } from "ai";
5 -
6 -const composio = new Composio({ apiKey: "your-composio-api-key" });
7 -
8 -console.log("Creating Tool Router session...");
9 -const { mcp } = await composio.create("pg-user-550e8400-e29b-41d4");
10 -console.log(`Tool Router session created: ${mcp.url}`);
11 -
12 -const client = await createMCPClient({
13 - transport: {
14 - type: "http",
15 - url: mcp.url,
16 - headers: {
17 - "x-api-key": "your-composio-api-key",
18 - },
19 - },
20 -});
21 -
22 -const tools = await client.tools();
23 -
24 -const stream = await streamText({
25 - model: openai("gpt-4o"),
26 - prompt: "Summarize all the emails in my Gmail inbox today",
27 - stopWhen: stepCountIs(10),
28 - onStepFinish: (step) => {
29 - if (step.toolCalls.length > 0) {
30 - for (const toolCall of step.toolCalls) {
31 - console.log(`Executed ${toolCall.toolName}`);
32 - }
33 - }
34 - },
35 - tools,
36 -});
37 -
38 -for await (const textPart of stream.textStream) {
39 - process.stdout.write(textPart);
40 -}