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, 13:15 UTC
feat(docs): Add IntegrationTabs component with Native Tools/MCP toggle
- Create IntegrationTabs component for quickstart page - Add Native Tools and MCP integration options within each framework - Use SVG icons matching provider card style - Merge quickstart content with multi-turn conversation examples - Support light/dark mode for icons Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sushmithamallesh committed
Jan 25, 2026 at 22:30 UTC
4b38decf99c59bd34a403c8154d9dea959ded135
5 files changed
+578
-136
docs/components/quickstart/integration-tabs.tsx
new
+70
@@ -0,0 +1,70 @@
1
+'use client';
2
+
3
+import Image from 'next/image';
4
+import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
5
+import { ReactNode } from 'react';
6
+
7
+interface IntegrationTabsProps {
8
+ children: ReactNode;
9
+ defaultValue?: 'native' | 'mcp';
10
+}
11
+
12
+export function IntegrationTabs({ children, defaultValue = 'native' }: IntegrationTabsProps) {
13
+ return (
14
+ <Tabs defaultValue={defaultValue} className="not-prose -mt-2">
15
+ <div className="mb-5 flex justify-start">
16
+ <TabsList>
17
+ <TabsTrigger value="native" className="gap-2">
18
+ <div className="flex h-4 w-4 shrink-0 items-center justify-center">
19
+ <Image
20
+ src="/images/providers/native-tools-logo.svg"
21
+ alt="Native Tools"
22
+ width={16}
23
+ height={16}
24
+ className="h-4 w-4 dark:hidden"
25
+ />
26
+ <Image
27
+ src="/images/providers/native-tools-logo-dark.svg"
28
+ alt="Native Tools"
29
+ width={16}
30
+ height={16}
31
+ className="hidden h-4 w-4 dark:block"
32
+ />
33
+ </div>
34
+ Native Tools
35
+ </TabsTrigger>
36
+ <TabsTrigger value="mcp" className="gap-2">
37
+ <div className="flex h-4 w-4 shrink-0 items-center justify-center">
38
+ <Image
39
+ src="/images/mcp-logo.svg"
40
+ alt="MCP"
41
+ width={16}
42
+ height={16}
43
+ className="h-4 w-4 dark:hidden"
44
+ />
45
+ <Image
46
+ src="/images/mcp-logo-dark.svg"
47
+ alt="MCP"
48
+ width={16}
49
+ height={16}
50
+ className="hidden h-4 w-4 dark:block"
51
+ />
52
+ </div>
53
+ MCP
54
+ </TabsTrigger>
55
+ </TabsList>
56
+ </div>
57
+ {children}
58
+ </Tabs>
59
+ );
60
+}
61
+
62
+export function IntegrationContent({
63
+ value,
64
+ children
65
+}: {
66
+ value: 'native' | 'mcp';
67
+ children: ReactNode;
68
+}) {
69
+ return <TabsContent value={value}>{children}</TabsContent>;
70
+}
docs/content/docs/quickstart.mdx
+499
-136
@@ -9,12 +9,14 @@ Build your first AI agent with Composio Tools.
9
<QuickstartFlow>
10
11
<FrameworkOption id="openai-agents" name="OpenAI Agents" logo="/images/providers/openai-logo.svg" logoDark="/images/providers/openai-logo-dark.svg">
12
+
13
+<IntegrationTabs>
14
+<IntegrationContent value="native">
15
+
16
<Steps>
17
<Step>
18
### Install
19
16
-Install the Composio SDK and OpenAI Agents SDK.
17
-
20
<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
21
<Tab value="Python">
22
```bash
@@ -33,117 +35,247 @@ npm install @composio/core @composio/openai-agents @openai/agents
35
### Configure API Keys
36
37
<Callout type="info">
36
-Set `COMPOSIO_API_KEY` with your API key from [Settings](https://platform.composio.dev/?next_page=/settings) and `OPENAI_API_KEY` with your [OpenAI API key](https://platform.openai.com/api-keys).
38
+Set `COMPOSIO_API_KEY` from [Settings](https://platform.composio.dev/?next_page=/settings) and `OPENAI_API_KEY` from [OpenAI](https://platform.openai.com/api-keys).
39
</Callout>
40
41
```txt title=".env"
40
-COMPOSIO_API_KEY=xxxxxxxxx
41
-OPENAI_API_KEY=xxxxxxxxx
42
+COMPOSIO_API_KEY=your_composio_api_key
43
+OPENAI_API_KEY=your_openai_api_key
44
```
45
</Step>
46
47
<Step>
48
### Create session and run agent
49
48
-[Sessions](/docs/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
49
-
50
-<Callout type="info">
51
-Replace the sample user ID with your own user's identifier. See [User Management](/docs/user-management) for details.
52
-</Callout>
53
-
50
<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
51
<Tab value="Python">
52
```python
57
-import asyncio
53
+from dotenv import load_dotenv
54
from composio import Composio
59
-from agents import Agent, Runner
55
+from agents import Agent, Runner, SQLiteSession
56
from composio_openai_agents import OpenAIAgentsProvider
57
58
+load_dotenv()
59
+
60
# Initialize Composio with OpenAI Agents provider
61
composio = Composio(provider=OpenAIAgentsProvider())
62
65
-external_user_id = "user_2nFh83Hd"
66
-recipient_email = "soham.g@composio.dev"
67
-
68
-# Create a tool router session
69
-session = composio.create(
70
- user_id=external_user_id,
71
-)
72
-
73
-# Get tools from the session (native)
63
+# Create a session for your user
64
+user_id = "user_123"
65
+session = composio.create(user_id=user_id)
66
tools = session.tools()
67
68
# Create agent with tools
69
agent = Agent(
78
- name="Email Manager",
79
- instructions="You are a helpful assistant that helps users manage their Gmail accounts.",
70
+ name="Personal Assistant",
71
+ instructions="You are a helpful assistant. Use tools to complete tasks.",
72
+ model="gpt-4.1",
73
tools=tools,
74
)
75
83
-# Run the agent
84
-async def main():
85
- result = await Runner.run(
86
- starting_agent=agent,
87
- input=f"Send an email to {recipient_email} with the subject 'Hello from Composio' and the body 'This is a test email!'",
88
- )
89
- print(result.final_output)
76
+# Memory for multi-turn conversation
77
+memory = SQLiteSession("conversation")
78
91
-asyncio.run(main())
79
+print("Assistant ready! Type 'exit' to quit.")
80
+
81
+while True:
82
+ user_input = input("You: ").strip()
83
+ if user_input.lower() == "exit":
84
+ break
85
+
86
+ result = Runner.run_sync(starting_agent=agent, input=user_input, session=memory)
87
+ print(f"Assistant: {result.final_output}\n")
88
```
89
</Tab>
90
<Tab value="TypeScript">
91
```typescript
92
+import "dotenv/config";
93
import { Composio } from "@composio/core";
97
-import { Agent, run } from "@openai/agents";
94
+import { Agent, run, MemorySession } from "@openai/agents";
95
import { OpenAIAgentsProvider } from "@composio/openai-agents";
96
+import { createInterface } from "readline/promises";
97
98
// Initialize Composio with OpenAI Agents provider
101
-const composio = new Composio({
102
- provider: new OpenAIAgentsProvider(),
99
+const composio = new Composio({ provider: new OpenAIAgentsProvider() });
100
+
101
+// Create a session for your user
102
+const userId = "user_123";
103
+const session = await composio.create(userId);
104
+const tools = await session.tools();
105
+
106
+const agent = new Agent({
107
+ name: "Personal Assistant",
108
+ instructions: "You are a helpful assistant. Use tools to complete tasks.",
109
+ model: "gpt-4.1",
110
+ tools,
111
});
112
105
-const externalUserId = "user_2nFh83Hd";
106
-const recipientEmail = "soham.g@composio.dev";
113
+const memory = new MemorySession();
114
+const readline = createInterface({ input: process.stdin, output: process.stdout });
115
108
-// Create a tool router session
109
-const session = await composio.create(externalUserId);
116
+console.log("Assistant ready! Type 'exit' to quit.");
117
111
-// Get tools from the session (native)
112
-const tools = await session.tools();
118
+while (true) {
119
+ const input = (await readline.question("You: ")).trim();
120
+ if (input.toLowerCase() === "exit") break;
121
+
122
+ const result = await run(agent, input, { session: memory });
123
+ console.log(`Assistant: ${result.finalOutput}\n`);
124
+}
125
+
126
+readline.close();
127
+```
128
+</Tab>
129
+</Tabs>
130
+</Step>
131
+</Steps>
132
+
133
+</IntegrationContent>
134
+<IntegrationContent value="mcp">
135
+
136
+<Steps>
137
+<Step>
138
+### Install
139
+
140
+<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
141
+<Tab value="Python">
142
+```bash
143
+pip install composio openai-agents
144
+```
145
+</Tab>
146
+<Tab value="TypeScript">
147
+```bash
148
+npm install @composio/core @openai/agents
149
+```
150
+</Tab>
151
+</Tabs>
152
+</Step>
153
+
154
+<Step>
155
+### Configure API Keys
156
+
157
+<Callout type="info">
158
+Set `COMPOSIO_API_KEY` from [Settings](https://platform.composio.dev/?next_page=/settings) and `OPENAI_API_KEY` from [OpenAI](https://platform.openai.com/api-keys).
159
+</Callout>
160
+
161
+```txt title=".env"
162
+COMPOSIO_API_KEY=your_composio_api_key
163
+OPENAI_API_KEY=your_openai_api_key
164
+```
165
+</Step>
166
+
167
+<Step>
168
+### Create session and run agent
169
+
170
+<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
171
+<Tab value="Python">
172
+```python
173
+from dotenv import load_dotenv
174
+from composio import Composio
175
+from agents import Agent, Runner, HostedMCPTool, SQLiteSession
176
+
177
+load_dotenv()
178
+
179
+# Initialize Composio
180
+composio = Composio()
181
+
182
+# Create a session for your user
183
+user_id = "user_123"
184
+session = composio.create(user_id=user_id)
185
+
186
+# Configure agent with Composio MCP server
187
+agent = Agent(
188
+ name="Personal Assistant",
189
+ instructions="You are a helpful assistant. Use tools to complete tasks.",
190
+ model="gpt-4.1",
191
+ tools=[
192
+ HostedMCPTool(
193
+ tool_config={
194
+ "type": "mcp",
195
+ "server_label": "composio",
196
+ "server_url": session.mcp.url,
197
+ "require_approval": "never",
198
+ "headers": session.mcp.headers,
199
+ }
200
+ )
201
+ ],
202
+)
203
+
204
+# Memory for multi-turn conversation
205
+memory = SQLiteSession(user_id)
206
+
207
+print("Assistant ready! Type 'exit' to quit.")
208
+
209
+while True:
210
+ user_input = input("You: ").strip()
211
+ if user_input.lower() == "exit":
212
+ break
213
+
214
+ result = Runner.run_sync(starting_agent=agent, input=user_input, session=memory)
215
+ print(f"Assistant: {result.final_output}\n")
216
+```
217
+</Tab>
218
+<Tab value="TypeScript">
219
+```typescript
220
+import "dotenv/config";
221
+import { Composio } from "@composio/core";
222
+import { Agent, run, hostedMcpTool, MemorySession } from "@openai/agents";
223
+import { createInterface } from "readline/promises";
224
+
225
+// Initialize Composio
226
+const composio = new Composio();
227
+
228
+// Create a session for your user
229
+const userId = "user_123";
230
+const session = await composio.create(userId);
231
114
-// Create agent with tools
232
const agent = new Agent({
116
- name: "Email Manager",
117
- model: "gpt-4o",
118
- instructions: "You are a helpful assistant. Use Composio tools to execute tasks.",
119
- tools: tools,
233
+ name: "Personal Assistant",
234
+ instructions: "You are a helpful assistant. Use tools to complete tasks.",
235
+ model: "gpt-4.1",
236
+ tools: [
237
+ hostedMcpTool({
238
+ serverLabel: "composio",
239
+ serverUrl: session.mcp.url,
240
+ headers: session.mcp.headers,
241
+ }),
242
+ ],
243
});
244
122
-// Run the agent
123
-console.log(`🔄 Running agent...`);
124
-const result = await run(
125
- agent,
126
- `Send an email to ${recipientEmail} with the subject 'Hello from Composio' and the body 'This is a test email!'`
127
-);
245
+const memory = new MemorySession();
246
+const readline = createInterface({ input: process.stdin, output: process.stdout });
247
+
248
+console.log("Assistant ready! Type 'exit' to quit.");
249
+
250
+while (true) {
251
+ const input = (await readline.question("You: ")).trim();
252
+ if (input.toLowerCase() === "exit") break;
253
129
-console.log(`✅ Received response from agent`);
130
-if (result.finalOutput) {
131
- console.log(result.finalOutput);
254
+ const result = await run(agent, input, { session: memory });
255
+ console.log(`Assistant: ${result.finalOutput}\n`);
256
}
257
+
258
+readline.close();
259
```
260
</Tab>
261
</Tabs>
262
</Step>
263
</Steps>
264
+
265
+</IntegrationContent>
266
+</IntegrationTabs>
267
+
268
</FrameworkOption>
269
140
-<FrameworkOption id="claude-agents" name="Claude Agents" logo="/images/providers/anthropic-logo.svg" logoDark="/images/providers/anthropic-logo-dark.svg">
270
+<FrameworkOption id="claude-agents" name="Claude Agent SDK" logo="/images/providers/anthropic-logo.svg" logoDark="/images/providers/anthropic-logo-dark.svg">
271
+
272
+<IntegrationTabs>
273
+<IntegrationContent value="native">
274
+
275
<Steps>
276
<Step>
277
### Install
278
145
-Install the Composio SDK and Claude Agent SDK.
146
-
279
<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
280
<Tab value="Python">
281
```bash
@@ -162,83 +294,77 @@ npm install @composio/core @composio/claude-agent-sdk @anthropic-ai/claude-agent
294
### Configure API Keys
295
296
<Callout type="info">
165
-Set `COMPOSIO_API_KEY` with your API key from [Settings](https://platform.composio.dev/?next_page=/settings) and `ANTHROPIC_API_KEY` with your [Anthropic API key](https://console.anthropic.com/settings/keys).
297
+Set `COMPOSIO_API_KEY` from [Settings](https://platform.composio.dev/?next_page=/settings) and `ANTHROPIC_API_KEY` from [Anthropic](https://console.anthropic.com/settings/keys).
298
</Callout>
299
300
```txt title=".env"
169
-COMPOSIO_API_KEY=xxxxxxxxx
170
-ANTHROPIC_API_KEY=xxxxxxxxx
301
+COMPOSIO_API_KEY=your_composio_api_key
302
+ANTHROPIC_API_KEY=your_anthropic_api_key
303
```
304
</Step>
305
306
<Step>
307
### Create session and run agent
308
177
-[Sessions](/docs/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
178
-
179
-<Callout type="info">
180
-Replace the sample user ID with your own user's identifier. See [User Management](/docs/user-management) for details.
181
-</Callout>
182
-
309
<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
310
<Tab value="Python">
311
```python
312
import asyncio
313
+from dotenv import load_dotenv
314
from composio import Composio
315
from composio_claude_agent_sdk import ClaudeAgentSDKProvider
316
from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions, create_sdk_mcp_server
317
191
-# Initialize Composio
192
-composio = Composio(provider=ClaudeAgentSDKProvider())
318
+load_dotenv()
319
194
-external_user_id = "user_2nFh83Hd"
195
-recipient_email = "soham.g@composio.dev"
196
-
197
-# Create a tool router session
198
-session = composio.create(
199
- user_id=external_user_id,
200
-)
320
+# Initialize Composio with Claude Agent SDK provider
321
+composio = Composio(provider=ClaudeAgentSDKProvider())
322
202
-# Get tools from the session (native)
323
+# Create a session for your user
324
+user_id = "user_123"
325
+session = composio.create(user_id=user_id)
326
tools = session.tools()
327
+
328
custom_server = create_sdk_mcp_server(name="composio", version="1.0.0", tools=tools)
329
206
-# Query Claude with MCP tools
330
async def main():
331
options = ClaudeAgentOptions(
209
- system_prompt="You are a helpful assistant",
332
+ system_prompt="You are a helpful assistant. Use tools to complete tasks.",
333
permission_mode="bypassPermissions",
211
- mcp_servers={
212
- "composio": custom_server,
213
- },
334
+ mcp_servers={"composio": custom_server},
335
)
336
337
async with ClaudeSDKClient(options=options) as client:
217
- await client.query(f"Send an email to {recipient_email} with the subject 'Hello from Composio' and the body 'This is a test email!'")
218
- # Extract and print response
219
- async for msg in client.receive_response():
220
- print(msg)
338
+ print("Assistant ready! Type 'exit' to quit.")
339
+
340
+ while True:
341
+ user_input = input("You: ").strip()
342
+ if user_input.lower() == "exit":
343
+ break
344
+
345
+ await client.query(user_input)
346
+ print("Claude: ", end="")
347
+ async for msg in client.receive_response():
348
+ print(msg, end="", flush=True)
349
+ print()
350
351
asyncio.run(main())
352
```
353
</Tab>
354
<Tab value="TypeScript">
355
```typescript
356
+import "dotenv/config";
357
import { Composio } from "@composio/core";
228
-import { ClaudeAgentSDKProvider} from "@composio/claude-agent-sdk";
358
+import { ClaudeAgentSDKProvider } from "@composio/claude-agent-sdk";
359
import { createSdkMcpServer, query } from "@anthropic-ai/claude-agent-sdk";
360
+import { createInterface } from "readline/promises";
361
231
-// Initialize Composio
232
-const composio = new Composio({
233
- provider: new ClaudeAgentSDKProvider(),
234
-});
235
-
236
-const externalUserId = "user_2nFh83Hd";
237
-const recipientEmail = "soham.g@composio.dev";
362
+// Initialize Composio with Claude Agent SDK provider
363
+const composio = new Composio({ provider: new ClaudeAgentSDKProvider() });
364
239
-// Create a tool router session
240
-const session = await composio.create(externalUserId);
241
-// Get tools from the session (native)
365
+// Create a session for your user
366
+const userId = "user_123";
367
+const session = await composio.create(userId);
368
const tools = await session.tools();
369
370
const customServer = createSdkMcpServer({
@@ -247,38 +373,59 @@ const customServer = createSdkMcpServer({
373
tools: tools,
374
});
375
250
-// Initialize Claude client
251
-for await (const content of query({
252
- prompt: `Send an email to ${recipientEmail} saying hello`,
253
- options: {
254
- mcpServers: { composio: customServer },
255
- permissionMode: "bypassPermissions",
256
- },
257
-})) {
258
- if (content.type === "assistant") {
259
- console.log("Claude:", content.message);
376
+const readline = createInterface({ input: process.stdin, output: process.stdout });
377
+
378
+console.log("Assistant ready! Type 'exit' to quit.");
379
+
380
+let isFirstQuery = true;
381
+const options = {
382
+ mcpServers: { composio: customServer },
383
+ permissionMode: "bypassPermissions" as const,
384
+};
385
+
386
+while (true) {
387
+ const input = (await readline.question("You: ")).trim();
388
+ if (input.toLowerCase() === "exit") break;
389
+
390
+ process.stdout.write("Claude: ");
391
+ const queryOptions = isFirstQuery ? options : { ...options, continue: true };
392
+ isFirstQuery = false;
393
+
394
+ for await (const stream of query({ prompt: input, options: queryOptions })) {
395
+ if (stream.type === "assistant") {
396
+ for (const block of stream.message.content) {
397
+ if (block.type === "text") {
398
+ process.stdout.write(block.text);
399
+ }
400
+ }
401
+ }
402
}
403
+ console.log();
404
}
405
263
-console.log(`✅ Received response from Claude`);
406
+readline.close();
407
```
408
</Tab>
409
</Tabs>
410
</Step>
411
</Steps>
269
-</FrameworkOption>
412
271
-<FrameworkOption id="vercel-ai" name="Vercel AI" logo="/images/providers/vercel-logo.svg" logoDark="/images/providers/vercel-logo-dark.svg">
413
+</IntegrationContent>
414
+<IntegrationContent value="mcp">
415
+
416
<Steps>
417
<Step>
418
### Install
419
276
-Install the Composio SDK and Vercel AI SDK.
277
-
278
-<Tabs groupId="language" items={['TypeScript']} persist>
420
+<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
421
+<Tab value="Python">
422
+```bash
423
+pip install composio claude-agent-sdk
424
+```
425
+</Tab>
426
<Tab value="TypeScript">
427
```bash
281
-npm install @composio/core @composio/vercel ai @ai-sdk/openai @ai-sdk/mcp
428
+npm install @composio/core @anthropic-ai/claude-agent-sdk
429
```
430
</Tab>
431
</Tabs>
@@ -288,64 +435,280 @@ npm install @composio/core @composio/vercel ai @ai-sdk/openai @ai-sdk/mcp
435
### Configure API Keys
436
437
<Callout type="info">
291
-Set `COMPOSIO_API_KEY` with your API key from [Settings](https://platform.composio.dev/?next_page=/settings) and `OPENAI_API_KEY` with your [OpenAI API key](https://platform.openai.com/api-keys).
438
+Set `COMPOSIO_API_KEY` from [Settings](https://platform.composio.dev/?next_page=/settings) and `ANTHROPIC_API_KEY` from [Anthropic](https://console.anthropic.com/settings/keys).
439
</Callout>
440
441
```txt title=".env"
295
-COMPOSIO_API_KEY=xxxxxxxxx
296
-OPENAI_API_KEY=xxxxxxxxx
442
+COMPOSIO_API_KEY=your_composio_api_key
443
+ANTHROPIC_API_KEY=your_anthropic_api_key
444
```
445
</Step>
446
447
<Step>
448
### Create session and run agent
449
303
-[Sessions](/docs/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
450
+<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
451
+<Tab value="Python">
452
+```python
453
+import asyncio
454
+from dotenv import load_dotenv
455
+from claude_agent_sdk.client import ClaudeSDKClient
456
+from claude_agent_sdk.types import ClaudeAgentOptions, AssistantMessage, TextBlock, ToolUseBlock
457
+from composio import Composio
458
+
459
+load_dotenv()
460
+
461
+# Initialize Composio
462
+composio = Composio()
463
+
464
+# Create a session for your user
465
+user_id = "user_123"
466
+session = composio.create(user_id=user_id)
467
+
468
+# Configure Claude with Composio MCP server
469
+options = ClaudeAgentOptions(
470
+ system_prompt="You are a helpful assistant. Use tools to complete tasks.",
471
+ mcp_servers={
472
+ "composio": {
473
+ "type": "http",
474
+ "url": session.mcp.url,
475
+ "headers": session.mcp.headers,
476
+ }
477
+ },
478
+ permission_mode="bypassPermissions",
479
+)
480
+
481
+async def main():
482
+ async with ClaudeSDKClient(options) as client:
483
+ print("Assistant ready! Type 'exit' to quit.")
484
+
485
+ while True:
486
+ user_input = input("You: ").strip()
487
+ if user_input.lower() == "exit":
488
+ break
489
+
490
+ print("Claude: ", end="", flush=True)
491
+ await client.query(user_input)
492
+ async for msg in client.receive_response():
493
+ if isinstance(msg, AssistantMessage):
494
+ for block in msg.content:
495
+ if isinstance(block, TextBlock):
496
+ print(block.text, end="", flush=True)
497
+ print()
498
+
499
+asyncio.run(main())
500
+```
501
+</Tab>
502
+<Tab value="TypeScript">
503
+```typescript
504
+import "dotenv/config";
505
+import { query, type Options } from "@anthropic-ai/claude-agent-sdk";
506
+import { Composio } from "@composio/core";
507
+import { createInterface } from "readline/promises";
508
+
509
+// Initialize Composio
510
+const composio = new Composio();
511
+
512
+// Create a session for your user
513
+const userId = "user_123";
514
+const session = await composio.create(userId);
515
+
516
+const options: Options = {
517
+ systemPrompt: "You are a helpful assistant. Use tools to complete tasks.",
518
+ mcpServers: {
519
+ composio: {
520
+ type: "http",
521
+ url: session.mcp.url,
522
+ headers: session.mcp.headers,
523
+ },
524
+ },
525
+ permissionMode: "bypassPermissions",
526
+};
527
+
528
+const readline = createInterface({ input: process.stdin, output: process.stdout });
529
+
530
+console.log("Assistant ready! Type 'exit' to quit.");
531
+
532
+let isFirstQuery = true;
533
+
534
+while (true) {
535
+ const input = (await readline.question("You: ")).trim();
536
+ if (input.toLowerCase() === "exit") break;
537
+
538
+ process.stdout.write("Claude: ");
539
+ const queryOptions = isFirstQuery ? options : { ...options, continue: true };
540
+ isFirstQuery = false;
541
+
542
+ for await (const stream of query({ prompt: input, options: queryOptions })) {
543
+ if (stream.type === "assistant") {
544
+ for (const block of stream.message.content) {
545
+ if (block.type === "text") {
546
+ process.stdout.write(block.text);
547
+ }
548
+ }
549
+ }
550
+ }
551
+ console.log();
552
+}
553
+
554
+readline.close();
555
+```
556
+</Tab>
557
+</Tabs>
558
+</Step>
559
+</Steps>
560
+
561
+</IntegrationContent>
562
+</IntegrationTabs>
563
+
564
+</FrameworkOption>
565
+
566
+<FrameworkOption id="vercel-ai" name="Vercel AI" logo="/images/providers/vercel-logo.svg" logoDark="/images/providers/vercel-logo-dark.svg">
567
+
568
+<IntegrationTabs>
569
+<IntegrationContent value="native">
570
+
571
+<Steps>
572
+<Step>
573
+### Install
574
+
575
+```bash
576
+npm install @composio/core @composio/vercel ai @ai-sdk/openai
577
+```
578
+</Step>
579
+
580
+<Step>
581
+### Configure API Keys
582
583
<Callout type="info">
306
-Replace the sample user ID with your own user's identifier. See [User Management](/docs/user-management) for details.
584
+Set `COMPOSIO_API_KEY` from [Settings](https://platform.composio.dev/?next_page=/settings) and `OPENAI_API_KEY` from [OpenAI](https://platform.openai.com/api-keys).
585
</Callout>
586
309
-<Tabs groupId="language" items={['TypeScript']} persist>
310
-<Tab value="TypeScript">
587
+```txt title=".env"
588
+COMPOSIO_API_KEY=your_composio_api_key
589
+OPENAI_API_KEY=your_openai_api_key
590
+```
591
+</Step>
592
+
593
+<Step>
594
+### Create session and run agent
595
+
596
```typescript
597
+import "dotenv/config";
598
import { openai } from "@ai-sdk/openai";
599
import { Composio } from "@composio/core";
600
import { VercelProvider } from "@composio/vercel";
601
import { stepCountIs, streamText } from "ai";
602
603
// Initialize Composio with Vercel provider
318
-const composio = new Composio({
319
- provider: new VercelProvider(),
604
+const composio = new Composio({ provider: new VercelProvider() });
605
+
606
+// Create a session for your user
607
+const userId = "user_123";
608
+const session = await composio.create(userId);
609
+const tools = await session.tools();
610
+
611
+console.log("Summarizing your emails from today...\n");
612
+
613
+const stream = await streamText({
614
+ model: openai("gpt-4.1"),
615
+ system: "You are a helpful assistant. Use tools to complete tasks.",
616
+ prompt: "Summarize my emails from today",
617
+ stopWhen: stepCountIs(10),
618
+ onStepFinish: (step) => {
619
+ for (const toolCall of step.toolCalls) {
620
+ console.log(`[Using tool: ${toolCall.toolName}]`);
621
+ }
622
+ },
623
+ tools,
624
});
625
322
-const externalUserId = "user_2nFh83Hd";
323
-const recipientEmail = "soham.g@composio.dev";
626
+for await (const textPart of stream.textStream) {
627
+ process.stdout.write(textPart);
628
+}
629
+```
630
+</Step>
631
+</Steps>
632
+
633
+</IntegrationContent>
634
+<IntegrationContent value="mcp">
635
325
-// Create a tool router session
326
-const session = await composio.create(externalUserId);
636
+<Steps>
637
+<Step>
638
+### Install
639
328
-// Get tools from the session (native)
329
-const tools = await session.tools();
640
+```bash
641
+npm install @composio/core ai @ai-sdk/anthropic @ai-sdk/mcp
642
+```
643
+</Step>
644
+
645
+<Step>
646
+### Configure API Keys
647
+
648
+<Callout type="info">
649
+Set `COMPOSIO_API_KEY` from [Settings](https://platform.composio.dev/?next_page=/settings) and `ANTHROPIC_API_KEY` from [Anthropic](https://console.anthropic.com/settings/keys).
650
+</Callout>
651
+
652
+```txt title=".env"
653
+COMPOSIO_API_KEY=your_composio_api_key
654
+ANTHROPIC_API_KEY=your_anthropic_api_key
655
+```
656
+</Step>
657
+
658
+<Step>
659
+### Create session and run agent
660
+
661
+```typescript
662
+import "dotenv/config";
663
+import { anthropic } from "@ai-sdk/anthropic";
664
+import { experimental_createMCPClient as createMCPClient } from "@ai-sdk/mcp";
665
+import { Composio } from "@composio/core";
666
+import { stepCountIs, streamText } from "ai";
667
+
668
+// Initialize Composio
669
+const composio = new Composio();
670
+
671
+// Create a session for your user
672
+const userId = "user_123";
673
+const { mcp } = await composio.create(userId);
674
+
675
+// Create an MCP client to connect to Composio
676
+const client = await createMCPClient({
677
+ transport: {
678
+ type: "http",
679
+ url: mcp.url,
680
+ headers: mcp.headers,
681
+ },
682
+});
683
+const tools = await client.tools();
684
+
685
+console.log("Summarizing your emails from today...\n");
686
331
-// Stream text with tools
332
-console.log(`🔄 Running agent...`);
687
const stream = await streamText({
334
- model: openai("gpt-4o-mini"),
335
- prompt: `Send an email to ${recipientEmail} with the subject 'Hello from Composio' and the body 'This is a test email!'`,
688
+ model: anthropic("claude-sonnet-4-5"),
689
+ system: "You are a helpful assistant. Use tools to complete tasks.",
690
+ prompt: "Summarize my emails from today",
691
stopWhen: stepCountIs(10),
692
+ onStepFinish: (step) => {
693
+ for (const toolCall of step.toolCalls) {
694
+ console.log(`[Using tool: ${toolCall.toolName}]`);
695
+ }
696
+ },
697
tools,
698
});
699
340
-// Stream the response
700
for await (const textPart of stream.textStream) {
701
process.stdout.write(textPart);
702
}
703
+
704
+console.log("\n\nTip: If prompted to authenticate, complete the auth flow and run again.");
705
```
345
-</Tab>
346
-</Tabs>
706
</Step>
707
</Steps>
708
+
709
+</IntegrationContent>
710
+</IntegrationTabs>
711
+
712
</FrameworkOption>
713
714
</QuickstartFlow>
docs/mdx-components.tsx
+3
@@ -9,6 +9,7 @@ import { Card, Cards } from 'fumadocs-ui/components/card';
9
import { ImageZoom } from 'fumadocs-ui/components/image-zoom';
10
import { ProviderCard, ProviderGrid } from '@/components/provider-card';
11
import { FrameworkSelector, QuickstartFlow, FrameworkOption } from '@/components/quickstart';
12
+import { IntegrationTabs, IntegrationContent } from '@/components/quickstart/integration-tabs';
13
import { ToolTypeFlow, ToolTypeOption } from '@/components/tool-type-selector';
14
import { Figure } from '@/components/figure';
15
import { Video } from '@/components/video';
@@ -51,6 +52,8 @@ export function getMDXComponents(components?: MDXComponents): MDXComponents {
52
FrameworkSelector,
53
QuickstartFlow,
54
FrameworkOption,
55
+ IntegrationTabs,
56
+ IntegrationContent,
57
ToolTypeFlow,
58
ToolTypeOption,
59
Figure,
docs/public/images/providers/native-tools-logo-dark.svg
new
+3
@@ -0,0 +1,3 @@
1
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
2
+ <path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/>
3
+</svg>
\ No newline at end of file
docs/public/images/providers/native-tools-logo.svg
new
+3
@@ -0,0 +1,3 @@
1
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
2
+ <path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/>
3
+</svg>
\ No newline at end of file