@devries-cameron20 / composio-1 / commits / c8146a9dc
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.

docs: Revamp provider pages — session pattern, tested code, no direct execution

- Rewrite OpenAI page with Responses API / Chat Completions toggle using IntegrationTabs, tested all 4 code blocks (Python + TS) with gpt-5.2 - Remove "Direct Tool Execution" sections from all provider pages - Convert all providers to session paradigm (composio.create → session.tools) - Make IntegrationTabs configurable with custom tabs prop - Fix LLM markdown export for custom IntegrationTabs values - Use `client = OpenAI()` (matches OpenAI convention), enumerate over zip - Add groupId="language" + persist to sync tab switching across steps Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Sushmithamallesh committed Feb 16, 2026 at 18:52 UTC c8146a9dc20266174ab20cdd2d343db02bbb49e7
11 files changed +349 -664
docs/components/quickstart/integration-tabs.tsx
+40 -42
@@ -4,54 +4,52 @@ import Image from 'next/image';
4 import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
5 import { ReactNode } from 'react';
6
7 +interface TabConfig {
8 + value: string;
9 + label: string;
10 + icon?: string;
11 + iconDark?: string;
12 +}
13 +
14 +const defaultTabs: TabConfig[] = [
15 + { value: 'native', label: 'Native Tools', icon: '/images/providers/native-tools-logo.svg', iconDark: '/images/providers/native-tools-logo-dark.svg' },
16 + { value: 'mcp', label: 'MCP', icon: '/images/mcp-logo.svg', iconDark: '/images/mcp-logo-dark.svg' },
17 +];
18 +
19 interface IntegrationTabsProps {
20 children: ReactNode;
9 - defaultValue?: 'native' | 'mcp';
21 + defaultValue?: string;
22 + tabs?: TabConfig[];
23 }
24
12 -export function IntegrationTabs({ children, defaultValue = 'native' }: IntegrationTabsProps) {
25 +export function IntegrationTabs({ children, defaultValue, tabs = defaultTabs }: IntegrationTabsProps) {
26 return (
14 - <Tabs defaultValue={defaultValue} className="not-prose -mt-2">
27 + <Tabs defaultValue={defaultValue ?? tabs[0]?.value ?? 'native'} className="not-prose -mt-2">
28 <div className="mb-5 flex justify-start">
29 <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>
30 + {tabs.map((tab) => (
31 + <TabsTrigger key={tab.value} value={tab.value} className="gap-2">
32 + {tab.icon && tab.iconDark && (
33 + <div className="flex h-4 w-4 shrink-0 items-center justify-center">
34 + <Image
35 + src={tab.icon}
36 + alt={tab.label}
37 + width={16}
38 + height={16}
39 + className="h-4 w-4 dark:hidden"
40 + />
41 + <Image
42 + src={tab.iconDark}
43 + alt={tab.label}
44 + width={16}
45 + height={16}
46 + className="hidden h-4 w-4 dark:block"
47 + />
48 + </div>
49 + )}
50 + {tab.label}
51 + </TabsTrigger>
52 + ))}
53 </TabsList>
54 </div>
55 {children}
@@ -63,7 +61,7 @@ export function IntegrationContent({
61 value,
62 children
63 }: {
66 - value: 'native' | 'mcp';
64 + value: string;
65 children: ReactNode;
66 }) {
67 return <TabsContent value={value}>{children}</TabsContent>;
docs/content/docs/providers/anthropic.mdx
-90
@@ -371,93 +371,3 @@ console.log(result);
371 </Step>
372 </Steps>
373
374 -<Accordions>
375 -<Accordion title="Direct tool usage">
376 -<Callout type="info">
377 -Only use this if you want to use a single, direct tool with your AI Agent.
378 -</Callout>
379 -
380 -**Install**
381 -
382 -<Tabs items={["Python", "TypeScript"]}>
383 -<Tab value="Python">
384 -```bash
385 -pip install composio composio-anthropic anthropic
386 -```
387 -</Tab>
388 -<Tab value="TypeScript">
389 -```bash
390 -npm install @composio/core @composio/anthropic @anthropic-ai/sdk
391 -```
392 -</Tab>
393 -</Tabs>
394 -
395 -**Usage**
396 -
397 -<Tabs items={["Python", "TypeScript"]}>
398 -<Tab value="Python">
399 -```python
400 -import anthropic
401 -from composio import Composio
402 -from composio_anthropic import AnthropicProvider
403 -
404 -anthropic_client = anthropic.Anthropic()
405 -composio = Composio(provider=AnthropicProvider())
406 -
407 -external_user_id = "user_2nFh83Hde"
408 -recipient_email = "soham.g@composio.dev"
409 -
410 -# Get a specific tool
411 -tools = composio.tools.get(user_id=external_user_id, tools=["GMAIL_SEND_EMAIL"])
412 -
413 -response = anthropic_client.messages.create(
414 - model="claude-sonnet-4-5",
415 - max_tokens=1024,
416 - tools=tools,
417 - messages=[
418 - {"role": "user", "content": f"Send an email to {recipient_email} with the subject 'Hello from Composio' and the body 'This is a test email!'"},
419 - ],
420 -)
421 -
422 -result = composio.provider.handle_tool_calls(user_id=external_user_id, response=response)
423 -print(result)
424 -```
425 -</Tab>
426 -<Tab value="TypeScript">
427 -```typescript
428 -import { Composio } from "@composio/core";
429 -import { AnthropicProvider } from "@composio/anthropic";
430 -import Anthropic from "@anthropic-ai/sdk";
431 -
432 -const composio = new Composio({
433 - provider: new AnthropicProvider(),
434 -});
435 -const anthropic = new Anthropic();
436 -
437 -const externalUserId = "user_2nFh83Hde";
438 -const recipientEmail = "soham.g@composio.dev";
439 -
440 -// Get a specific tool
441 -const tools = await composio.tools.get(externalUserId, {
442 - tools: ["GMAIL_SEND_EMAIL"],
443 -});
444 -
445 -const msg = await anthropic.messages.create({
446 - model: "claude-sonnet-4-5",
447 - messages: [
448 - {
449 - role: "user",
450 - content: `Send an email to ${recipientEmail} with the subject 'Hello from Composio' and the body 'This is a test email!'`,
451 - },
452 - ],
453 - tools: tools,
454 - max_tokens: 1000,
455 -});
456 -
457 -const result = await composio.provider.handleToolCalls(externalUserId, msg);
458 -console.log(result);
459 -```
460 -</Tab>
461 -</Tabs>
462 -</Accordion>
463 -</Accordions>
docs/content/docs/providers/crewai.mdx
+9 -17
@@ -4,14 +4,14 @@ description: Build an agent with CrewAI and enable it to use 800+ tools with Com
4 keywords: [crew]
5 ---
6
7 -The CrewAI Provider formats the Composio tools into an object compatible with CrewAI's tool calling capabilities. Agents and LLM workflows built with this can call and execute the Composio tools.
7 +The CrewAI Provider formats Composio tools into an object compatible with CrewAI's tool calling capabilities.
8
9 ## Setup
10
11 The CrewAI provider is available for only the Python SDK.
12
13 ```bash
14 -pip install composio_crewai==0.8.0
14 +pip install composio composio_crewai crewai langchain_openai
15 ```
16
17 ## Usage
@@ -23,34 +23,26 @@ from langchain_openai import ChatOpenAI
23 from composio import Composio
24 from composio_crewai import CrewAIProvider
25
26 -# Initialize tools.
26 openai_client = ChatOpenAI()
27 composio = Composio(provider=CrewAIProvider())
28
30 -# Get All the tools
31 -tools = composio.tools.get(user_id="default", toolkits=["GITHUB"])
29 +# Create a session for your user
30 +session = composio.create(user_id="user_123")
31 +tools = session.tools()
32
33 -# Define agent
33 crewai_agent = Agent(
34 role="Github Agent",
36 - goal="""You take action on Github using Github APIs""",
37 - backstory=(
38 - "You are AI agent that is responsible for taking actions on Github "
39 - "on users' behalf. You need to take action on Github using Github APIs"
40 - ),
35 + goal="You take action on Github using Github APIs",
36 + backstory="You are an AI agent that takes actions on Github on users' behalf.",
37 verbose=True,
38 tools=tools,
39 llm=openai_client,
40 )
41
46 -# Define task
42 task = Task(
48 - description=(
49 - "Star a repo composiohq/composio on GitHub, if the action is successful "
50 - "include Action executed successfully"
51 - ),
43 + description="Star the composiohq/composio repository on GitHub",
44 agent=crewai_agent,
53 - expected_output="if the star happened",
45 + expected_output="Whether the star action succeeded",
46 )
47
48 my_crew = Crew(agents=[crewai_agent], tasks=[task])
docs/content/docs/providers/google.mdx
+25 -52
@@ -4,105 +4,78 @@ description: Build an agent with Gemini and enable it to use 800+ tools with Com
4 keywords: [gemini]
5 ---
6
7 -The Google provider transforms Composio tools into a format compatible with Gemini's function calling capabilities through it's API
7 +The Google provider transforms Composio tools into a format compatible with Gemini's function calling capabilities through its API.
8
9 ## Setup
10
11 <Tabs items={["Python", "TypeScript"]}>
12 <Tab value="Python">
13 ```bash
14 -pip install google-genai composio_google
14 +pip install composio composio_google google-genai
15 ```
16 </Tab>
17 <Tab value="TypeScript">
18 ```bash
19 -npm install @google/genai
20 -npm i @composio/core @composio/gemini
19 +npm install @composio/core @composio/google @google/genai
20 ```
21 </Tab>
22 </Tabs>
23
24 +## Usage
25 +
26 <Tabs items={["Python", "TypeScript"]}>
27 <Tab value="Python">
28 ```python
29 from composio import Composio
29 -from composio_gemini import GeminiProvider
30 +from composio_google import GoogleProvider
31 from google import genai
32 from google.genai import types
33
33 -# Create composio client
34 -composio = Composio(provider=GeminiProvider())
35 -# Create google client
34 +composio = Composio(provider=GoogleProvider())
35 client = genai.Client()
37 -```
38 -</Tab>
39 -<Tab value="TypeScript">
40 -```typescript
41 -import {Composio} from '@composio/core';
42 -import {GoogleProvider} from '@composio/google'
43 -import {GoogleGenAI} from '@google/genai'
44 -
45 -const composio = new Composio({
46 - apiKey: "your-composio-api-key",
47 - provider: new GoogleProvider()
48 -})
49 -
50 -const ai = new GoogleGenAI({
51 - apiKey: "your-gemini-api-key"
52 -})
53 -```
54 -</Tab>
55 -</Tabs>
36
57 -## Usage
58 -
59 -<Tabs items={["Python", "TypeScript"]}>
60 -<Tab value="Python">
61 -```python
62 -user_id = "0000-1111-2222"
63 -tools = composio.tools.get(user_id, tools=["COMPOSIO_SEARCH_DUCK_DUCK_GO_SEARCH"])
37 +# Create a session for your user
38 +session = composio.create(user_id="user_123")
39 +tools = session.tools()
40
65 -# Create genai client config
41 config = types.GenerateContentConfig(tools=tools)
42
68 -# # Use the chat interface.
43 chat = client.chats.create(model="gemini-2.0-flash", config=config)
70 -response = chat.send_message("search about the latest info on windsurf acquisition.")
44 +response = chat.send_message("Star the composiohq/composio repository on github")
45 print(response.text)
46 ```
47 </Tab>
48 <Tab value="TypeScript">
49 ```typescript
76 -import {Composio} from '@composio/core';
77 -import {GoogleProvider} from '@composio/google'
78 -import {GoogleGenAI} from '@google/genai'
79 -const composio = new Composio({ apiKey: "key", provider: new GoogleProvider() });
80 -const ai = new GoogleGenAI({ apiKey: "key" });
81 -// ---cut---
82 -// Use a unique identifier for each user in your application
83 -const user_id = "your-external-user-id"
50 +import { Composio } from '@composio/core';
51 +import { GoogleProvider } from '@composio/google';
52 +import { GoogleGenAI } from '@google/genai';
53 +
54 +const composio = new Composio({
55 + provider: new GoogleProvider(),
56 +});
57 +const ai = new GoogleGenAI({ apiKey: process.env.GOOGLE_API_KEY! });
58
85 -// Get tools - this returns already wrapped tools when using GoogleProvider
86 -const tools = await composio.tools.get(user_id, 'HACKERNEWS_GET_USER')
59 +// Create a session for your user
60 +const session = await composio.create("user_123");
61 +const tools = await session.tools();
62
63 const response = await ai.models.generateContent({
64 model: 'gemini-2.0-flash-001',
90 - contents: "Search for the user 'pg's",
65 + contents: "Star the composiohq/composio repository on github",
66 config: {
67 tools: [{ functionDeclarations: tools }],
68 },
69 });
70
71 if (response.functionCalls && response.functionCalls.length > 0) {
97 - console.log(`Calling tool ${response.functionCalls[0].name}`);
72 const functionCall = {
73 name: response.functionCalls[0].name || '',
74 args: response.functionCalls[0].args || {},
75 };
102 - const result = await composio.provider.executeToolCall(user_id, functionCall);
103 - console.log(`Result: ${result}`);
76 + const result = await composio.provider.executeToolCall("user_123", functionCall);
77 + console.log(result);
78 } else {
105 - console.log('No function calls in the response');
79 console.log(response.text);
80 }
81 ```
docs/content/docs/providers/langchain.mdx
+11 -42
@@ -11,12 +11,12 @@ The LangChain Provider transforms Composio tools into a format compatible with L
11 <Tabs items={["Python", "TypeScript"]}>
12 <Tab value="Python">
13 ```bash
14 -pip install composio_langchain==0.8.0 langchain
14 +pip install composio composio_langchain langchain langchain_openai
15 ```
16 </Tab>
17 <Tab value="TypeScript">
18 ```bash
19 -npm install @composio/langchain
19 +npm install @composio/core @composio/langchain @langchain/openai @langchain/langgraph @langchain/core
20 ```
21 </Tab>
22 </Tabs>
@@ -32,26 +32,19 @@ from langchain import hub # type: ignore
32 from langchain.agents import AgentExecutor, create_openai_functions_agent
33 from langchain_openai import ChatOpenAI
34
35 -# Pull relevant agent model.
35 prompt = hub.pull("hwchase17/openai-functions-agent")
37 -
38 -# Initialize tools.
36 openai_client = ChatOpenAI(model="gpt-5")
37
38 composio = Composio(provider=LangchainProvider())
39
43 -# Get All the tools
44 -tools = composio.tools.get(user_id="default", toolkits=["GITHUB"])
45 -
46 -# Define task
47 -task = "Star a repo composiohq/composio on GitHub"
40 +# Create a session for your user
41 +session = composio.create(user_id="user_123")
42 +tools = session.tools()
43
49 -# Define agent
44 agent = create_openai_functions_agent(openai_client, tools, prompt)
45 agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
46
53 -# Execute using agent_executor
54 -agent_executor.invoke({"input": task})
47 +agent_executor.invoke({"input": "Star the composiohq/composio repository on GitHub"})
48 ```
49 </Tab>
50 <Tab value="TypeScript">
@@ -63,71 +56,47 @@ import { StateGraph, MessagesAnnotation } from '@langchain/langgraph';
56 import { Composio } from '@composio/core';
57 import { LangchainProvider } from '@composio/langchain';
58
66 -// initiate composio
59 const composio = new Composio({
68 - apiKey: process.env.COMPOSIO_API_KEY,
60 provider: new LangchainProvider(),
61 });
62
72 -// fetch the tool
73 -console.log(`🔄 Fetching the tool...`);
74 -const tools = await composio.tools.get('default', 'HACKERNEWS_GET_USER');
63 +// Create a session for your user
64 +const session = await composio.create("user_123");
65 +const tools = await session.tools();
66
76 -// Define the tools for the agent to use
67 const toolNode = new ToolNode(tools);
68
79 -// Create a model and give it access to the tools
69 const model = new ChatOpenAI({
70 model: 'gpt-4o-mini',
71 temperature: 0,
72 }).bindTools(tools);
73
85 -// Define the function that determines whether to continue or not
74 function shouldContinue({ messages }: typeof MessagesAnnotation.State) {
75 const lastMessage = messages[messages.length - 1] as AIMessage;
88 -
89 - // If the LLM makes a tool call, then we route to the "tools" node
76 if (lastMessage.tool_calls?.length) {
77 return 'tools';
78 }
93 - // Otherwise, we stop (reply to the user) using the special "__end__" node
79 return '__end__';
80 }
81
97 -// Define the function that calls the model
82 async function callModel(state: typeof MessagesAnnotation.State) {
99 - console.log(`🔄 Calling the model...`);
83 const response = await model.invoke(state.messages);
101 -
102 - // We return a list, because this will get added to the existing list
84 return { messages: [response] };
85 }
86
106 -// Define a new graph
87 const workflow = new StateGraph(MessagesAnnotation)
88 .addNode('agent', callModel)
109 - .addEdge('__start__', 'agent') // __start__ is a special name for the entrypoint
89 + .addEdge('__start__', 'agent')
90 .addNode('tools', toolNode)
91 .addEdge('tools', 'agent')
92 .addConditionalEdges('agent', shouldContinue);
93
114 -// Finally, we compile it into a LangChain Runnable.
94 const app = workflow.compile();
95
117 -// Use the agent
96 const finalState = await app.invoke({
119 - messages: [new HumanMessage('Find the details of the user `pg` on HackerNews')],
97 + messages: [new HumanMessage('Star the composiohq/composio repository on GitHub')],
98 });
121 -console.log(`✅ Message recieved from the model`);
99 console.log(finalState.messages[finalState.messages.length - 1].content);
123 -
124 -const nextState = await app.invoke({
125 - // Including the messages from the previous run gives the LLM context.
126 - // This way it knows we're asking about the weather in NY
127 - messages: [...finalState.messages, new HumanMessage('what about haxzie')],
128 -});
129 -console.log(`✅ Message recieved from the model`);
130 -console.log(nextState.messages[nextState.messages.length - 1].content);
100 ```
101 </Tab>
102 </Tabs>
docs/content/docs/providers/llamaindex.mdx
+26 -99
@@ -11,12 +11,12 @@ The LlamaIndex Provider transforms Composio tools into a format compatible with
11 <Tabs items={["Python", "TypeScript"]}>
12 <Tab value="Python">
13 ```bash
14 -pip install composio_llamaindex==0.8.0 llama-index
14 +pip install composio composio_llamaindex llama-index
15 ```
16 </Tab>
17 <Tab value="TypeScript">
18 ```bash
19 -npm install @composio/llamaindex @llamaindex/openai @llamaindex/workflow
19 +npm install @composio/core @composio/llamaindex @llamaindex/openai @llamaindex/workflow
20 ```
21 </Tab>
22 </Tabs>
@@ -27,24 +27,20 @@ npm install @composio/llamaindex @llamaindex/openai @llamaindex/workflow
27 <Tab value="Python">
28 ```python
29 import asyncio
30 -import dotenv
30 +from dotenv import load_dotenv
31 +from composio import Composio
32 from composio_llamaindex import LlamaIndexProvider
33 from llama_index.core.agent.workflow import FunctionAgent
34 from llama_index.llms.openai import OpenAI
35
35 -from composio import Composio
36 -
37 -# Load environment variables from .env
38 -dotenv.load_dotenv()
36 +load_dotenv()
37
40 -# Setup client
38 llm = OpenAI(model="gpt-5")
39 composio = Composio(provider=LlamaIndexProvider())
40
44 -tools = composio.tools.get(
45 - user_id="user@acme.com",
46 - tools=["GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER"],
47 -)
41 +# Create a session for your user
42 +session = composio.create(user_id="user_123")
43 +tools = session.tools()
44
45 workflow = FunctionAgent(
46 tools=tools,
@@ -55,7 +51,7 @@ workflow = FunctionAgent(
51
52 async def main():
53 result = await workflow.run(
58 - user_msg="Hello! I would like to star a repo composiohq/composio on GitHub"
54 + user_msg="Star the composiohq/composio repository on GitHub"
55 )
56 print(result)
57
@@ -66,102 +62,33 @@ if __name__ == "__main__":
62 </Tab>
63 <Tab value="TypeScript">
64 ```typescript
65 +import 'dotenv/config';
66 import { Composio } from '@composio/core';
67 import { LlamaindexProvider } from '@composio/llamaindex';
68 import { openai } from '@llamaindex/openai';
69 import { agent } from '@llamaindex/workflow';
73 -import 'dotenv/config';
70
75 -// Initialize Composio with LlamaIndex provider
71 const composio = new Composio({
77 - apiKey: process.env.COMPOSIO_API_KEY,
72 provider: new LlamaindexProvider(),
73 });
74
81 -async function main() {
82 - // Get tools
83 - const tools = await composio.tools.get('user@acme.com', {
84 - tools: ['GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER'],
85 - });
86 -
87 - // Create LlamaIndex agent with Composio tools
88 - const githubAgent = agent({
89 - name: 'GitHub Agent',
90 - description: 'An agent that performs GitHub actions',
91 - llm: openai({ model: 'gpt-4o-mini' }),
92 - systemPrompt: 'You are an agent that performs github actions.',
93 - tools,
94 - });
95 -
96 - // Run the agent
97 - const result = await githubAgent.run(
98 - 'Hello! I would like to star a repo composiohq/composio on GitHub'
99 - );
100 -
101 - console.log(result);
102 -}
103 -
104 -main().catch(console.error);
105 -```
106 -</Tab>
107 -</Tabs>
108 -
109 -## Advanced Usage
110 -
111 -### Streaming Agent with Multiple Toolkits
75 +// Create a session for your user
76 +const session = await composio.create("user_123");
77 +const tools = await session.tools();
78
113 -```typescript
114 -import { Composio } from '@composio/core';
115 -import { LlamaindexProvider } from '@composio/llamaindex';
116 -import { openai } from '@llamaindex/openai';
117 -import { agent, agentStreamEvent } from '@llamaindex/workflow';
118 -import 'dotenv/config';
119 -
120 -const composio = new Composio({
121 - apiKey: process.env.COMPOSIO_API_KEY,
122 - provider: new LlamaindexProvider(),
79 +const githubAgent = agent({
80 + name: 'GitHub Agent',
81 + description: 'An agent that performs GitHub actions',
82 + llm: openai({ model: 'gpt-4o-mini' }),
83 + systemPrompt: 'You are an agent that performs github actions.',
84 + tools,
85 });
86
125 -async function streamingExample() {
126 - // Get tools from multiple toolkits with execution modifiers
127 - const tools = await composio.tools.get(
128 - 'default',
129 - {
130 - toolkits: ['gmail', 'googlecalendar', 'slack'],
131 - limit: 20,
132 - },
133 - {
134 - beforeExecute: ({ toolSlug, params }) => {
135 - console.log(`🔄 Executing ${toolSlug} with:`, params);
136 - return params;
137 - },
138 - afterExecute: ({ toolSlug, result }) => {
139 - console.log(`✅ ${toolSlug} completed:`, result);
140 - return result;
141 - },
142 - }
143 - );
144 -
145 - // Create streaming agent
146 - const assistantAgent = agent({
147 - name: 'Personal Assistant',
148 - description: 'A helpful personal assistant',
149 - llm: openai({ model: 'gpt-4o-mini' }),
150 - systemPrompt: 'You are a helpful personal assistant that can manage emails, calendar events, and slack messages.',
151 - tools,
152 - });
153 -
154 - // Stream the response
155 - const stream = await assistantAgent.runStream(
156 - 'Schedule a meeting for tomorrow at 2 PM and send a slack message about it'
157 - );
158 -
159 - for await (const event of stream) {
160 - if (agentStreamEvent.include(event)) {
161 - process.stdout.write(event.data.delta);
162 - }
163 - }
164 -}
165 -
166 -streamingExample().catch(console.error);
87 +const result = await githubAgent.run(
88 + 'Star the composiohq/composio repository on GitHub'
89 +);
90 +
91 +console.log(result);
92 ```
93 +</Tab>
94 +</Tabs>
docs/content/docs/providers/mastra.mdx
+21 -70
@@ -4,23 +4,15 @@ description: Build an agent with Mastra and enable it to use 800+ tools with Com
4 keywords: [mastra]
5 ---
6
7 -Mastra is a TypeScript native framework for building agents with tools and MCPs. It expects tools to be in the following format:
8 -- Inputs: What information the tool needs to run (defined with an `inputSchema`, often using Zod).
9 -- Outputs: The structure of the data the tool returns (defined with an `outputSchema`).
10 -- Execution Logic: The code that performs the tool's action.
11 -- Description: Text that helps the agent understand what the tool does and when to use it.
12 -
13 -More documentation [here](https://mastra.ai/en/docs/tools-mcp/overview#creating-tools)
14 -
15 -The Mastra provider formats the Composio tools into this format along with the execution logic so that agents can call and execute the Composio tools.
7 +The Mastra provider formats Composio tools into a format compatible with [Mastra](https://mastra.ai/en/docs/tools-mcp/overview#creating-tools)'s tool calling capabilities, including input schemas, execution logic, and descriptions.
8
9 ## Setup
10
11 ```bash
20 -npm install @composio/mastra
12 +npm install @composio/core @composio/mastra @mastra/core @ai-sdk/openai
13 ```
14
23 -You can specify the provider in the constructor.
15 +## Usage
16
17 ```typescript
18 import { Composio } from "@composio/core";
@@ -31,45 +23,27 @@ import { openai } from "@ai-sdk/openai";
23 const composio = new Composio({
24 provider: new MastraProvider(),
25 });
34 -```
35 -
36 -## Usage
26
38 -The tools are passed to the agent as a parameter.
39 -
40 -```typescript
41 -import { Composio } from "@composio/core";
42 -import { MastraProvider } from "@composio/mastra";
43 -import { Agent } from "@mastra/core/agent";
44 -import { openai } from "@ai-sdk/openai";
45 -const composio = new Composio({ provider: new MastraProvider() });
46 -// ---cut---
47 -const userId = "john doe";
48 -
49 -const tools = await composio.tools.get(
50 - userId,
51 - {
52 - toolkits: ["SUPABASE"],
53 - }
54 -);
27 +// Create a session for your user
28 +const session = await composio.create("user_123");
29 +const tools = await session.tools();
30
31 const agent = new Agent({
57 - id: "supabase-agent",
58 - name: "Supabase Agent",
59 - instructions: "You think therefore you are.",
32 + id: "github-agent",
33 + name: "GitHub Agent",
34 + instructions: "You are a helpful assistant that can perform GitHub actions.",
35 model: openai("gpt-4.1"),
36 tools: tools,
37 });
38
39 const { text } = await agent.generate([
65 - { role: "user", content: "Tell me about my Supabase project" },
40 + { role: "user", content: "Star the composiohq/composio repository on GitHub" },
41 ]);
42
68 -console.log("\n🤖 Agent Response:\n");
43 console.log(text);
44 ```
45
72 -## Usage: Direct MCP Servers
46 +## Usage with MCP
47
48 You can also use Composio MCP servers directly with Mastra's MCPClient.
49
@@ -84,52 +58,29 @@ import { openai } from "@ai-sdk/openai";
58 import { Agent } from "@mastra/core/agent";
59 import { Composio } from "@composio/core";
60
87 -// Initialize Composio
61 const composio = new Composio();
62
90 -// Create MCP server with GitHub, Linear, and Notion tools
91 -const server = await composio.mcp.create(
92 - "dev-automation-server",
93 - {
94 - toolkits: [
95 - { toolkit: "github", authConfigId: "ac_github_id" },
96 - { toolkit: "linear", authConfigId: "ac_linear_id" },
97 - { toolkit: "notion", authConfigId: "ac_notion_id" }
98 - ],
99 - allowedTools: [
100 - "GITHUB_LIST_ISSUES", "GITHUB_CREATE_ISSUE",
101 - "LINEAR_CREATE_ISSUE", "LINEAR_UPDATE_ISSUE",
102 - "NOTION_CREATE_PAGE", "NOTION_UPDATE_PAGE"
103 - ]
104 - }
105 -);
106 -
107 -// Generate MCP instance for user
108 -const instance = await server.generate("user@example.com");
63 +// Create a session for your user
64 +const session = await composio.create("user_123");
65
110 -// Create MCP client with Composio server
111 -export const mcpClient = new MCPClient({
66 +// Create MCP client with the session's MCP server
67 +const mcpClient = new MCPClient({
68 id: "composio-mcp-client",
69 servers: {
114 - composio: { url: new URL(instance.url) },
70 + composio: { url: new URL(session.mcp.url) },
71 }
72 });
73
118 -// Create a development workflow agent
119 -export const devAgent = new Agent({
74 +const agent = new Agent({
75 id: "dev-assistant",
76 name: "Dev Assistant",
122 - description: "AI assistant for development workflow automation",
77 instructions: "Help manage GitHub repos, Linear issues, and Notion documentation.",
78 model: openai("gpt-4-turbo"),
79 tools: await mcpClient.getTools()
80 });
81
128 -// Example: Automate development workflow
129 -(async () => {
130 - const response = await devAgent.generate(
131 - "Review open GitHub issues, create Linear tasks for bugs labeled 'priority', and update the Notion roadmap page"
132 - );
133 - console.log(response.text);
134 -})();
82 +const response = await agent.generate(
83 + "Star the composiohq/composio repository on GitHub"
84 +);
85 +console.log(response.text);
86 ```
docs/content/docs/providers/openai-agents.mdx
-95
@@ -259,98 +259,3 @@ if (result.finalOutput) {
259
260 </ToolTypeFlow>
261
262 -<Accordions>
263 -<Accordion title="Direct tool usage">
264 -<Callout type="info">
265 -Only use this if you want to use a single, direct tool with your AI Agent.
266 -</Callout>
267 -
268 -**Install**
269 -
270 -<Tabs items={["Python", "TypeScript"]}>
271 -<Tab value="Python">
272 -```bash
273 -pip install composio openai-agents composio-openai-agents
274 -```
275 -</Tab>
276 -<Tab value="TypeScript">
277 -```bash
278 -npm install @composio/core @openai/agents @composio/openai-agents
279 -```
280 -</Tab>
281 -</Tabs>
282 -
283 -**Usage**
284 -
285 -<Tabs items={["Python", "TypeScript"]}>
286 -<Tab value="Python">
287 -```python
288 -import asyncio
289 -from composio import Composio
290 -from agents import Agent, Runner
291 -from composio_openai_agents import OpenAIAgentsProvider
292 -
293 -composio = Composio(provider=OpenAIAgentsProvider())
294 -
295 -external_user_id = "user_2nFh83Hde"
296 -recipient_email = "soham.g@composio.dev"
297 -
298 -# Get a specific tool
299 -tools = composio.tools.get(user_id=external_user_id, tools=["GMAIL_SEND_EMAIL"])
300 -
301 -agent = Agent(
302 - name="Email Manager",
303 - instructions="You are a helpful assistant.",
304 - tools=tools,
305 -)
306 -
307 -async def main():
308 - result = await Runner.run(
309 - starting_agent=agent,
310 - input=f"Send an email to {recipient_email} with the subject 'Hello from Composio' and the body 'This is a test email!'",
311 - )
312 - print(result.final_output)
313 -
314 -asyncio.run(main())
315 -```
316 -</Tab>
317 -<Tab value="TypeScript">
318 -```typescript
319 -import { Composio } from "@composio/core";
320 -import { Agent, run } from "@openai/agents";
321 -import { OpenAIAgentsProvider } from "@composio/openai-agents";
322 -
323 -const composio = new Composio({
324 - provider: new OpenAIAgentsProvider(),
325 -});
326 -
327 -const externalUserId = "user_2nFh83Hde";
328 -const recipientEmail = "soham.g@composio.dev";
329 -
330 -// Get a specific tool
331 -const tools = await composio.tools.get(externalUserId, {
332 - tools: ["GMAIL_SEND_EMAIL"],
333 -});
334 -
335 -const agent = new Agent({
336 - name: "Email Manager",
337 - instructions: "You are a helpful assistant.",
338 - tools: tools,
339 -});
340 -
341 -console.log("Running agent...");
342 -const result = await run(
343 - agent,
344 - `Send an email to ${recipientEmail} with the subject 'Hello from Composio' and the body 'This is a test email!'`
345 -);
346 -
347 -console.log("Received response from agent");
348 -if (result.finalOutput) {
349 - console.log(result.finalOutput);
350 -}
351 -```
352 -</Tab>
353 -</Tabs>
354 -</Accordion>
355 -
356 -</Accordions>
docs/content/docs/providers/openai.mdx
+201 -104
@@ -6,65 +6,94 @@ keywords: [gpt, responses api, chat completions]
6
7 The OpenAI Provider is the default provider for the Composio SDK. It transforms Composio tools into a format compatible with OpenAI's function calling capabilities through both the Responses and Chat Completion APIs.
8
9 -## Setup
9 +<IntegrationTabs tabs={[
10 + { value: "responses", label: "Responses API" },
11 + { value: "chat", label: "Chat Completions" },
12 +]}>
13
11 -By default, the OpenAI Provider is installed when you install the Composio SDK. You can also install it manually:
14 +<IntegrationContent value="responses">
15 +<Steps>
16 +<Step>
17 +**Install**
18
13 -<Tabs items={["Python", "TypeScript"]}>
19 +<Tabs groupId="language" items={["Python", "TypeScript"]} persist>
20 <Tab value="Python">
21 ```bash
16 -pip install composio_openai
22 +pip install composio composio_openai openai
23 ```
24 </Tab>
25 <Tab value="TypeScript">
26 ```bash
21 -npm install @composio/openai
27 +npm install @composio/core @composio/openai openai
28 ```
29 </Tab>
30 </Tabs>
31 +</Step>
32
26 -## Responses API
33 +<Step>
34 +**Configure API Keys**
35
28 -The Responses API is the recommended way to build more agentic flows with the OpenAI API.
29 -Read more about it in the [OpenAI documentation](https://platform.openai.com/docs/api-reference/responses)
30 -
31 -<Callout>
32 -Before executing any tools that require authentication (like Gmail), you'll need to:
33 -1. [Create an Auth Configuration](/docs/tools-direct/authenticating-tools#creating-an-auth-config) for your app
34 -2. [Set up a Connected Account](/docs/tools-direct/authenticating-tools#connecting-an-account) for the user.
36 +<Callout type="info">
37 +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 </Callout>
39
37 -<Tabs items={["Python", "TypeScript"]}>
40 +```txt title=".env"
41 +COMPOSIO_API_KEY=xxxxxxxxx
42 +OPENAI_API_KEY=xxxxxxxxx
43 +```
44 +</Step>
45 +
46 +<Step>
47 +**Create session and run**
48 +
49 +The [Responses API](https://platform.openai.com/docs/api-reference/responses) is the recommended way to build agentic flows with OpenAI.
50 +
51 +<Tabs groupId="language" items={["Python", "TypeScript"]} persist>
52 <Tab value="Python">
53 ```python
54 +import json
55 from openai import OpenAI
56 from composio import Composio
57 from composio_openai import OpenAIResponsesProvider
58
44 -# Initialize Composio client with OpenAI Provider
59 composio = Composio(provider=OpenAIResponsesProvider())
46 -openai = OpenAI()
60 +client = OpenAI()
61
48 -# Make sure to create an auth config and a connected account for the user with gmail toolkit
49 -# Make sure to replace "your-user-id" with the actual user ID
50 -user_id = "your-user-id"
62 +# Create a session for your user
63 +session = composio.create(user_id="user_123")
64 +tools = session.tools()
65
52 -tools = composio.tools.get(user_id=user_id, tools=["GMAIL_SEND_EMAIL"])
53 -
54 -response = openai.responses.create(
55 - model="gpt-5",
66 +response = client.responses.create(
67 + model="gpt-5.2",
68 tools=tools,
69 input=[
70 {
71 "role": "user",
60 - "content": "Send an email to soham.g@composio.dev with the subject 'Running OpenAI Provider snippet' and body 'Hello from the code snippet in openai docs'"
72 + "content": "Send an email to john@example.com with the subject 'Hello' and body 'Hello from Composio!'"
73 }
74 ]
75 )
76
65 -# Execute the function calls
66 -result = composio.provider.handle_tool_calls(response=response, user_id=user_id)
67 -print(result)
77 +# Agentic loop — keep executing tool calls until the model responds with text
78 +while True:
79 + tool_calls = [o for o in response.output if o.type == "function_call"]
80 + if not tool_calls:
81 + break
82 + results = composio.provider.handle_tool_calls(response=response, user_id="user_123")
83 + response = client.responses.create(
84 + model="gpt-5.2",
85 + tools=tools,
86 + previous_response_id=response.id,
87 + input=[
88 + {"type": "function_call_output", "call_id": tool_calls[i].call_id, "output": json.dumps(result)}
89 + for i, result in enumerate(results)
90 + ]
91 + )
92 +
93 +# Print final response
94 +for item in response.output:
95 + if item.type == "message":
96 + print(item.content[0].text)
97 ```
98 </Tab>
99 <Tab value="TypeScript">
@@ -73,83 +102,140 @@ import OpenAI from 'openai';
102 import { Composio } from '@composio/core';
103 import { OpenAIResponsesProvider } from '@composio/openai';
104
76 -// Initialize Composio client with OpenAI Provider
105 const composio = new Composio({
106 provider: new OpenAIResponsesProvider(),
107 });
80 -const openai = new OpenAI({});
81 -
82 -// Make sure to create an auth config and a connected account for the user with gmail toolkit
83 -// Make sure to replace "your-user-id" with the actual user ID
84 -const userId = "your-user-id";
85 -
86 -async function main() {
87 - try {
88 - const tools = await composio.tools.get(userId, {tools: ["GMAIL_SEND_EMAIL"]});
89 -
90 - const response = await openai.responses.create({
91 - model: "gpt-5",
92 - tools: tools,
93 - input: [
94 - {
95 - role: "user",
96 - content: "Send an email to soham.g@composio.dev with the subject 'Running OpenAI Provider snippet' and body 'Hello from the code snippet in openai docs'"
97 - },
98 - ],
99 - });
108 +const client = new OpenAI();
109
101 - // Execute the function calls
102 - const result = await composio.provider.handleToolCalls(userId, response.output);
103 - console.log(result);
104 - } catch (error) {
105 - console.error('Error:', error);
106 - }
110 +// Create a session for your user
111 +const session = await composio.create("user_123");
112 +const tools = await session.tools();
113 +
114 +let response = await client.responses.create({
115 + model: "gpt-5.2",
116 + tools: tools,
117 + input: [
118 + {
119 + role: "user",
120 + content: "Send an email to john@example.com with the subject 'Hello' and body 'Hello from Composio!'"
121 + },
122 + ],
123 +});
124 +
125 +// Agentic loop — keep executing tool calls until the model responds with text
126 +while (true) {
127 + const toolCalls = response.output.filter((o) => o.type === "function_call");
128 + if (toolCalls.length === 0) break;
129 +
130 + const results = await composio.provider.handleToolCalls("user_123", response.output);
131 + response = await client.responses.create({
132 + model: "gpt-5.2",
133 + tools: tools,
134 + previous_response_id: response.id,
135 + input: results.map((result, i) => ({
136 + type: "function_call_output" as const,
137 + call_id: toolCalls[i].call_id,
138 + output: JSON.stringify(result),
139 + })),
140 + });
141 }
142
109 -main();
143 +// Print final response
144 +for (const item of response.output) {
145 + if (item.type === "message") {
146 + const block = item.content[0];
147 + if (block.type === "output_text") {
148 + console.log(block.text);
149 + }
150 + }
151 +}
152 ```
153 </Tab>
154 </Tabs>
155 +</Step>
156 +</Steps>
157 +</IntegrationContent>
158 +
159 +<IntegrationContent value="chat">
160 +<Steps>
161 +<Step>
162 +**Install**
163
114 -## Chat Completion API
164 +<Tabs groupId="language" items={["Python", "TypeScript"]} persist>
165 +<Tab value="Python">
166 +```bash
167 +pip install composio composio_openai openai
168 +```
169 +</Tab>
170 +<Tab value="TypeScript">
171 +```bash
172 +npm install @composio/core @composio/openai openai
173 +```
174 +</Tab>
175 +</Tabs>
176 +</Step>
177
116 -The Chat Completion API generates a model response from a list of messages. Read more about it in the [OpenAI documentation](https://platform.openai.com/docs/api-reference/chat).
117 -The OpenAI Chat Provider is the default provider used by Composio SDK, but you can also explicitly initialise it.
178 +<Step>
179 +**Configure API Keys**
180
119 -<Callout>
120 -Before executing any tools that require authentication (like Gmail), you'll need to:
121 -1. [Create an Auth Configuration](/docs/tools-direct/authenticating-tools#creating-an-auth-config) for your app
122 -2. [Set up a Connected Account](/docs/tools-direct/authenticating-tools#connecting-an-account) for the user.
181 +<Callout type="info">
182 +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).
183 </Callout>
184
125 -<Tabs items={["Python", "TypeScript"]}>
185 +```txt title=".env"
186 +COMPOSIO_API_KEY=xxxxxxxxx
187 +OPENAI_API_KEY=xxxxxxxxx
188 +```
189 +</Step>
190 +
191 +<Step>
192 +**Create session and run**
193 +
194 +The [Chat Completions API](https://platform.openai.com/docs/api-reference/chat) generates a model response from a list of messages.
195 +The `OpenAIProvider` (Chat Completions) is the default provider used by Composio SDK.
196 +
197 +<Tabs groupId="language" items={["Python", "TypeScript"]} persist>
198 <Tab value="Python">
199 ```python
200 +import json
201 from openai import OpenAI
202 from composio import Composio
203 from composio_openai import OpenAIProvider
204
132 -# Initialize Composio client with OpenAI Provider
205 composio = Composio(provider=OpenAIProvider())
134 -openai = OpenAI()
206 +client = OpenAI()
207
136 -# Make sure to create an auth config and a connected account for the user with gmail toolkit
137 -# Make sure to replace "your-user-id" with the actual user ID
138 -user_id = "your-user-id"
208 +# Create a session for your user
209 +session = composio.create(user_id="user_123")
210 +tools = session.tools()
211
140 -tools = composio.tools.get(user_id=user_id, tools=["GMAIL_SEND_EMAIL"])
212 +messages = [
213 + {"role": "user", "content": "Send an email to john@example.com with the subject 'Hello' and body 'Hello from Composio!'"}
214 +]
215
142 -response = openai.chat.completions.create(
143 - model="gpt-5",
216 +response = client.chat.completions.create(
217 + model="gpt-5.2",
218 tools=tools,
145 - messages=[
146 - {"role": "user", "content": "Send an email to soham.g@composio.dev with the subject 'Running OpenAI Provider snippet' and body 'Hello from the code snippet in openai docs'"},
147 - ],
219 + messages=messages,
220 )
221
150 -# Execute the function calls
151 -result = composio.provider.handle_tool_calls(response=response, user_id=user_id)
152 -print(result)
222 +# Agentic loop — keep executing tool calls until the model responds with text
223 +while response.choices[0].message.tool_calls:
224 + results = composio.provider.handle_tool_calls(response=response, user_id="user_123")
225 + messages.append(response.choices[0].message)
226 + for i, tc in enumerate(response.choices[0].message.tool_calls):
227 + messages.append({
228 + "role": "tool",
229 + "tool_call_id": tc.id,
230 + "content": json.dumps(results[i]),
231 + })
232 + response = client.chat.completions.create(
233 + model="gpt-5.2",
234 + tools=tools,
235 + messages=messages,
236 + )
237 +
238 +print(response.choices[0].message.content)
239 ```
240 </Tab>
241 <Tab value="TypeScript">
@@ -158,41 +244,52 @@ import OpenAI from 'openai';
244 import { Composio } from '@composio/core';
245 import { OpenAIProvider } from '@composio/openai';
246
161 -// Initialize Composio client with OpenAI Provider
247 const composio = new Composio({
248 provider: new OpenAIProvider(),
249 });
250 +const client = new OpenAI();
251 +
252 +// Create a session for your user
253 +const session = await composio.create("user_123");
254 +const tools = await session.tools();
255 +
256 +const messages: OpenAI.Chat.ChatCompletionMessageParam[] = [
257 + {
258 + role: "user",
259 + content: "Send an email to john@example.com with the subject 'Hello' and body 'Hello from Composio!'"
260 + },
261 +];
262 +
263 +let response = await client.chat.completions.create({
264 + model: "gpt-5.2",
265 + tools: tools,
266 + messages: messages,
267 +});
268
166 -const openai = new OpenAI();
167 -
168 -// Make sure to create an auth config and a connected account for the user with gmail toolkit
169 -// Make sure to replace "your-user-id" with the actual user ID
170 -const userId = "your-user-id";
171 -
172 -async function main() {
173 - try {
174 - const tools = await composio.tools.get(userId, {tools: ["GMAIL_SEND_EMAIL"]});
175 -
176 - const response = await openai.chat.completions.create({
177 - model: "gpt-5",
178 - tools: tools,
179 - messages: [
180 - {
181 - role: "user",
182 - content: "Send an email to soham.g@composio.dev with the subject 'Running OpenAI Provider snippet' and body 'Hello from the code snippet in openai docs'"
183 - },
184 - ],
269 +// Agentic loop — keep executing tool calls until the model responds with text
270 +while (response.choices[0].message.tool_calls) {
271 + const results = await composio.provider.handleToolCalls("user_123", response);
272 + messages.push(response.choices[0].message);
273 + for (const [i, tc] of response.choices[0].message.tool_calls.entries()) {
274 + messages.push({
275 + role: "tool",
276 + tool_call_id: tc.id,
277 + content: JSON.stringify(results[i]),
278 });
186 -
187 - // Execute the function calls
188 - const result = await composio.provider.handleToolCalls(userId, response);
189 - console.log(result);
190 - } catch (error) {
191 - console.error('Error:', error);
279 }
280 + response = await client.chat.completions.create({
281 + model: "gpt-5.2",
282 + tools: tools,
283 + messages: messages,
284 + });
285 }
286
195 -main();
287 +console.log(response.choices[0].message.content);
288 ```
289 </Tab>
290 </Tabs>
291 +</Step>
292 +</Steps>
293 +</IntegrationContent>
294 +
295 +</IntegrationTabs>
docs/content/docs/providers/vercel.mdx
-51
@@ -138,54 +138,3 @@ console.log("\n\n---");
138 console.log("Tip: If prompted to authenticate, complete the auth flow and run again.")
139 ```
140
141 -## Usage with direct tools
142 -
143 -### Setup
144 -
145 -Vercel AI SDK and the provider are only available for the TypeScript SDK.
146 -
147 -```bash
148 -npm install @composio/vercel
149 -```
150 -
151 -You can specify and import the provider in the constructor.
152 -
153 -```typescript
154 -import { Composio } from '@composio/core';
155 -import { VercelProvider } from '@composio/vercel';
156 -import { generateText } from 'ai';
157 -import { openai } from "@ai-sdk/openai";
158 -
159 -const composio = new Composio({
160 - provider: new VercelProvider(),
161 -});
162 -```
163 -
164 -### Usage
165 -
166 -```typescript
167 -import { Composio } from '@composio/core';
168 -import { VercelProvider } from '@composio/vercel';
169 -import { generateText } from 'ai';
170 -import { openai } from "@ai-sdk/openai";
171 -const composio = new Composio({ provider: new VercelProvider() });
172 -// ---cut---
173 -// create an auth config for gmail
174 -// then create a connected account with an external user id that identifies the user
175 -const externalUserId = "your-external-user-id";
176 -const tools = await composio.tools.get(externalUserId, "GMAIL_SEND_EMAIL");
177 -
178 -// env: OPENAI_API_KEY
179 -const { text } = await generateText({
180 - model: openai("gpt-5"),
181 - messages: [
182 - {
183 - role: "user",
184 - content: `Send an email to soham.g@composio.dev with the subject 'Hello from composio' and the body 'Congratulations on sending your first email using AI Agents and Composio!'`,
185 - },
186 - ],
187 - tools,
188 -});
189 -
190 -console.log("Email sent successfully!", { text });
191 -```
docs/lib/source.ts
+16 -2
@@ -171,10 +171,24 @@ export function mdxToCleanMarkdown(content: string): string {
171 );
172 result = result.replace(/<\/FrameworkOption>/g, '');
173
174 - // Convert IntegrationContent to labeled section (Native Tools / MCP)
174 + // Convert IntegrationTabs — extract label from tabs prop if present
175 + const tabLabelMap: Record<string, string> = { native: 'Native Tools', mcp: 'MCP' };
176 + result = result.replace(
177 + /<IntegrationTabs[\s\S]*?tabs=\{\[([\s\S]*?)\]\}[\s\S]*?>/g,
178 + (_, tabsContent: string) => {
179 + const labelRegex = /value:\s*"([^"]+)"[\s\S]*?label:\s*"([^"]+)"/g;
180 + let match;
181 + while ((match = labelRegex.exec(tabsContent)) !== null) {
182 + tabLabelMap[match[1]] = match[2];
183 + }
184 + return '';
185 + }
186 + );
187 +
188 + // Convert IntegrationContent to labeled section
189 result = result.replace(
190 /<IntegrationContent[\s\S]*?value="([^"]*)"[\s\S]*?>/g,
177 - (_, value) => `\n### ${value === 'native' ? 'Native Tools' : 'MCP'}\n`
191 + (_, value: string) => `\n### ${tabLabelMap[value] || value}\n`
192 );
193 result = result.replace(/<\/IntegrationContent>/g, '');
194