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, 15:45 UTC
Add Providers section with all framework integrations
- OpenAI, Anthropic, Google Gen AI, LangChain, LlamaIndex - CrewAI, Vercel AI SDK, OpenAI Agents, Mastra - Custom provider guides for TypeScript and Python 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sushmithamallesh committed
Jan 2, 2026 at 00:05 UTC
2bc2dc18fbbe51532dfd456c1dde2f8a34d4662d
13 files changed
+1594
fumadocs/content/docs/meta.json
+1
@@ -4,6 +4,7 @@
4
"index",
5
"quickstart",
6
"capabilities",
7
+ "providers",
8
"---Tools and Triggers---",
9
"fetching-tools",
10
"authenticating-tools",
fumadocs/content/docs/providers/anthropic.mdx
new
+113
@@ -0,0 +1,113 @@
1
+---
2
+title: Anthropic Provider
3
+description: Use Composio tools with Claude
4
+---
5
+
6
+The Anthropic Provider transforms Composio tools into a format compatible with Anthropic's function calling capabilities through its Messages API.
7
+
8
+## Setup
9
+
10
+The Anthropic provider can be installed for both SDKs.
11
+
12
+<Tabs items={["Python", "TypeScript"]}>
13
+<Tab value="Python">
14
+```bash
15
+pip install composio composio-anthropic
16
+```
17
+</Tab>
18
+<Tab value="TypeScript">
19
+```bash
20
+npm install @composio/anthropic @anthropic-ai/sdk
21
+```
22
+</Tab>
23
+</Tabs>
24
+
25
+You can specify the provider in the constructor. The constructor also takes in an optional `cacheTools` parameter.
26
+
27
+<Tabs items={["Python", "TypeScript"]}>
28
+<Tab value="Python">
29
+```python
30
+import anthropic
31
+
32
+from composio import Composio
33
+from composio_anthropic import AnthropicProvider
34
+
35
+# Initialize tools.
36
+anthropic_client = anthropic.Anthropic()
37
+composio = Composio(provider=AnthropicProvider())
38
+```
39
+</Tab>
40
+<Tab value="TypeScript">
41
+```typescript
42
+import { Composio } from "@composio/core";
43
+import { AnthropicProvider } from "@composio/anthropic";
44
+import Anthropic from '@anthropic-ai/sdk';
45
+
46
+const composio = new Composio({
47
+ provider: new AnthropicProvider({
48
+ cacheTools: false, // default
49
+ }),
50
+});
51
+
52
+const anthropic = new Anthropic();
53
+```
54
+</Tab>
55
+</Tabs>
56
+
57
+## Usage
58
+
59
+<Tabs items={["Python", "TypeScript"]}>
60
+<Tab value="Python">
61
+```python
62
+# Define your user ID
63
+user_id = "your-user-id"
64
+
65
+# Get GitHub tool for listing stargazers
66
+tools = composio.tools.get(user_id=user_id, tools=["GITHUB_LIST_STARGAZERS"])
67
+
68
+# Get response from the LLM
69
+response = anthropic_client.messages.create(
70
+ model="claude-sonnet-4-5",
71
+ max_tokens=1024,
72
+ tools=tools,
73
+ messages=[
74
+ {"role": "user", "content": "List my github stargazers. for the repo composiohq/composio"},
75
+ ],
76
+)
77
+
78
+# Execute the function calls.
79
+result = composio.provider.handle_tool_calls(user_id=user_id, response=response)
80
+print(result)
81
+```
82
+</Tab>
83
+<Tab value="TypeScript">
84
+```typescript
85
+const userId = "your-user-id";
86
+const tools = await composio.tools.get(userId, {
87
+ tools: ["GITHUB_LIST_STARGAZERS"]
88
+})
89
+
90
+const msg = await anthropic.messages.create({
91
+ model: "claude-sonnet-4-5",
92
+ messages: [
93
+ {
94
+ role: "user",
95
+ content: "List my github stargazers. for the repo composiohq/composio",
96
+ },
97
+ ],
98
+ tools: tools,
99
+ max_tokens: 1000,
100
+});
101
+
102
+const res = await composio.provider.handleToolCalls(userId, msg);
103
+
104
+console.log(res[0].content);
105
+```
106
+</Tab>
107
+</Tabs>
108
+
109
+## Modifiers
110
+
111
+Modifiers are functions that can be used to intercept and optionally modify the schema, the tool call request and the response from the tool call.
112
+
113
+Anthropic provider modifiers are the standard framework modifiers. Read more here: [Modifying tool schemas](/docs/modify-tool-behavior/modifying-tool-schemas).
fumadocs/content/docs/providers/crewai.mdx
new
+58
@@ -0,0 +1,58 @@
1
+---
2
+title: CrewAI Provider
3
+description: Use Composio tools with CrewAI agents
4
+---
5
+
6
+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
+
8
+## Setup
9
+
10
+The CrewAI provider is available for only the Python SDK.
11
+
12
+```bash
13
+pip install composio_crewai==0.8.0
14
+```
15
+
16
+## Usage
17
+
18
+```python
19
+from crewai import Agent, Crew, Task
20
+from langchain_openai import ChatOpenAI
21
+
22
+from composio import Composio
23
+from composio_crewai import CrewAIProvider
24
+
25
+# Initialize tools.
26
+openai_client = ChatOpenAI()
27
+composio = Composio(provider=CrewAIProvider())
28
+
29
+# Get All the tools
30
+tools = composio.tools.get(user_id="default", toolkits=["GITHUB"])
31
+
32
+# Define agent
33
+crewai_agent = Agent(
34
+ role="Github Agent",
35
+ goal="""You take action on Github using Github APIs""",
36
+ backstory=(
37
+ "You are AI agent that is responsible for taking actions on Github "
38
+ "on users' behalf. You need to take action on Github using Github APIs"
39
+ ),
40
+ verbose=True,
41
+ tools=tools,
42
+ llm=openai_client,
43
+)
44
+
45
+# Define task
46
+task = Task(
47
+ description=(
48
+ "Star a repo composiohq/composio on GitHub, if the action is successful "
49
+ "include Action executed successfully"
50
+ ),
51
+ agent=crewai_agent,
52
+ expected_output="if the star happened",
53
+)
54
+
55
+my_crew = Crew(agents=[crewai_agent], tasks=[task])
56
+result = my_crew.kickoff()
57
+print(result)
58
+```
fumadocs/content/docs/providers/custom-python.mdx
new
+283
@@ -0,0 +1,283 @@
1
+---
2
+title: Python Custom Provider
3
+description: Learn how to create custom providers for any AI framework in Python
4
+---
5
+
6
+This guide shows how to create custom providers for the Composio Python SDK. Custom providers enable integration with different AI frameworks and platforms.
7
+
8
+## Provider architecture
9
+
10
+The Composio SDK uses a provider architecture to adapt tools for different AI frameworks. The provider handles:
11
+
12
+1. **Tool format transformation**: Converting Composio tools into formats compatible with specific AI platforms
13
+2. **Platform-specific integration**: Providing helper methods for seamless integration
14
+
15
+## Types of providers
16
+
17
+There are two types of providers:
18
+
19
+1. **Non-agentic providers**: Transform tools for platforms that don't have their own agency (e.g., OpenAI, Anthropic)
20
+2. **Agentic providers**: Transform tools for platforms that have their own agency (e.g., LangChain, CrewAI)
21
+
22
+## Provider class hierarchy
23
+
24
+```
25
+BaseProvider (Abstract)
26
+├── NonAgenticProvider (Abstract)
27
+│ └── OpenAIProvider (Concrete)
28
+│ └── AnthropicProvider (Concrete)
29
+│ └── [Your Custom Non-Agentic Provider] (Concrete)
30
+└── AgenticProvider (Abstract)
31
+ └── LangchainProvider (Concrete)
32
+ └── [Your Custom Agentic Provider] (Concrete)
33
+```
34
+
35
+## Quick start
36
+
37
+The fastest way to create a new provider is using the provider scaffolding script:
38
+
39
+```bash
40
+# Create a non-agentic provider
41
+make create-provider name=myprovider
42
+
43
+# Create an agentic provider
44
+make create-provider name=myagent agentic=true
45
+
46
+# Create provider with custom output directory
47
+make create-provider name=myprovider output=/path/to/custom/dir
48
+
49
+# Combine options
50
+make create-provider name=myagent agentic=true output=/my/custom/path
51
+```
52
+
53
+This will create a new provider in the specified directory (default: `python/providers/<provider-name>/`) with:
54
+- Complete package structure with `pyproject.toml`
55
+- Provider implementation template
56
+- Demo script
57
+- README with usage examples
58
+- Type annotations and proper inheritance
59
+
60
+<Callout>
61
+The scaffolding script creates a fully functional provider template. You just need to implement the tool transformation logic specific to your platform. You can maintain your provider implementation in your own repository.
62
+</Callout>
63
+
64
+### Generated structure
65
+
66
+The create-provider script generates the following structure:
67
+
68
+```
69
+python/providers/<provider-name>/
70
+├── README.md # Documentation and usage examples
71
+├── pyproject.toml # Project configuration
72
+├── setup.py # Setup script for pip compatibility
73
+├── <provider-name>_demo.py # Demo script showing usage
74
+└── composio_<provider-name>/ # Package directory
75
+ ├── __init__.py # Package initialization
76
+ ├── provider.py # Provider implementation
77
+ └── py.typed # PEP 561 type marker
78
+```
79
+
80
+After generation, you can:
81
+1. Navigate to the provider directory: `cd python/providers/<provider-name>`
82
+2. Install in development mode: `uv pip install -e .`
83
+3. Implement your provider logic in `composio_<provider-name>/provider.py`
84
+4. Test with the demo script: `python <provider-name>_demo.py`
85
+
86
+## Creating a non-agentic provider
87
+
88
+Non-agentic providers inherit from the `NonAgenticProvider` abstract class:
89
+
90
+```python
91
+from typing import List, Optional, Sequence, TypeAlias
92
+from composio.core.provider import NonAgenticProvider
93
+from composio.types import Tool, Modifiers, ToolExecutionResponse
94
+
95
+# Define your tool format
96
+class MyAITool:
97
+ def __init__(self, name: str, description: str, parameters: dict):
98
+ self.name = name
99
+ self.description = description
100
+ self.parameters = parameters
101
+
102
+# Define your tool collection format
103
+MyAIToolCollection: TypeAlias = List[MyAITool]
104
+
105
+# Create your provider
106
+class MyAIProvider(NonAgenticProvider[MyAITool, MyAIToolCollection], name="my-ai-platform"):
107
+ """Custom provider for My AI Platform"""
108
+
109
+ def wrap_tool(self, tool: Tool) -> MyAITool:
110
+ """Transform a single tool to platform format"""
111
+ return MyAITool(
112
+ name=tool.slug,
113
+ description=tool.description or "",
114
+ parameters={
115
+ "type": "object",
116
+ "properties": tool.input_parameters.get("properties", {}),
117
+ "required": tool.input_parameters.get("required", [])
118
+ }
119
+ )
120
+
121
+ def wrap_tools(self, tools: Sequence[Tool]) -> MyAIToolCollection:
122
+ """Transform a collection of tools"""
123
+ return [self.wrap_tool(tool) for tool in tools]
124
+
125
+ # Optional: Custom helper methods for your AI platform
126
+ def execute_my_ai_tool_call(
127
+ self,
128
+ user_id: str,
129
+ tool_call: dict,
130
+ modifiers: Optional[Modifiers] = None
131
+ ) -> ToolExecutionResponse:
132
+ """Execute a tool call in your platform's format
133
+
134
+ Example usage:
135
+ result = my_provider.execute_my_ai_tool_call(
136
+ user_id="default",
137
+ tool_call={"name": "GITHUB_STAR_REPO", "arguments": {"owner": "composiohq", "repo": "composio"}}
138
+ )
139
+ """
140
+ # Use the built-in execute_tool method
141
+ return self.execute_tool(
142
+ slug=tool_call["name"],
143
+ arguments=tool_call["arguments"],
144
+ modifiers=modifiers,
145
+ user_id=user_id
146
+ )
147
+```
148
+
149
+## Creating an agentic provider
150
+
151
+Agentic providers inherit from the `AgenticProvider` abstract class:
152
+
153
+```python
154
+from typing import Callable, Dict, List, Sequence
155
+from composio.core.provider import AgenticProvider, AgenticProviderExecuteFn
156
+from composio.types import Tool
157
+from my_provider import AgentTool
158
+
159
+# Import the Tool/Function class that represents a callable tool for your framework
160
+# Optionally define your custom tool format below
161
+# class AgentTool:
162
+# def __init__(self, name: str, description: str, execute: Callable, schema: dict):
163
+# self.name = name
164
+# self.description = description
165
+# self.execute = execute
166
+# self.schema = schema
167
+
168
+# Define your tool collection format (typically a List)
169
+AgentToolCollection: TypeAlias = List[AgentTool]
170
+
171
+# Create your provider
172
+class MyAgentProvider(AgenticProvider[AgentTool, List[AgentTool]], name="my-agent-platform"):
173
+ """Custom provider for My Agent Platform"""
174
+
175
+ def wrap_tool(self, tool: Tool, execute_tool: AgenticProviderExecuteFn) -> AgentTool:
176
+ """Transform a single tool with execute function"""
177
+ def execute_wrapper(**kwargs) -> Dict:
178
+ result = execute_tool(tool.slug, kwargs)
179
+ if not result.get("successful", False):
180
+ raise Exception(result.get("error", "Tool execution failed"))
181
+ return result.get("data", {})
182
+
183
+ return AgentTool(
184
+ name=tool.slug,
185
+ description=tool.description or "",
186
+ execute=execute_wrapper,
187
+ schema=tool.input_parameters
188
+ )
189
+
190
+ def wrap_tools(
191
+ self,
192
+ tools: Sequence[Tool],
193
+ execute_tool: AgenticProviderExecuteFn
194
+ ) -> AgentToolCollection:
195
+ """Transform a collection of tools with execute function"""
196
+ return [self.wrap_tool(tool, execute_tool) for tool in tools]
197
+```
198
+
199
+## Using your custom provider
200
+
201
+After creating your provider, use it with the Composio SDK:
202
+
203
+### Non-agentic provider example
204
+
205
+```python
206
+from composio import Composio
207
+from composio_myai import MyAIProvider
208
+from myai import MyAIClient # Your AI platform's client
209
+
210
+# Initialize tools
211
+myai_client = MyAIClient()
212
+composio = Composio(provider=MyAIProvider())
213
+
214
+# Define task
215
+task = "Star a repo composiohq/composio on GitHub"
216
+
217
+# Get GitHub tools that are pre-configured
218
+tools = composio.tools.get(user_id="default", toolkits=["GITHUB"])
219
+
220
+# Get response from your AI platform (example)
221
+response = myai_client.chat.completions.create(
222
+ model="your-model",
223
+ tools=tools, # These are in your platform's format
224
+ messages=[
225
+ {"role": "system", "content": "You are a helpful assistant."},
226
+ {"role": "user", "content": task},
227
+ ],
228
+)
229
+print(response)
230
+
231
+# Execute the function calls
232
+result = composio.provider.handle_tool_calls(response=response, user_id="default")
233
+print(result)
234
+```
235
+
236
+### Agentic provider example
237
+
238
+```python
239
+import asyncio
240
+from agents import Agent, Runner
241
+from composio_myagent import MyAgentProvider
242
+from composio import Composio
243
+
244
+# Initialize Composio toolset
245
+composio = Composio(provider=MyAgentProvider())
246
+
247
+# Get all the tools
248
+tools = composio.tools.get(
249
+ user_id="default",
250
+ tools=["GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER"],
251
+)
252
+
253
+# Create an agent with the tools
254
+agent = Agent(
255
+ name="GitHub Agent",
256
+ instructions="You are a helpful assistant that helps users with GitHub tasks.",
257
+ tools=tools,
258
+)
259
+
260
+# Run the agent
261
+async def main():
262
+ result = await Runner.run(
263
+ starting_agent=agent,
264
+ input=(
265
+ "Star the repository composiohq/composio on GitHub. If done "
266
+ "successfully, respond with 'Action executed successfully'"
267
+ ),
268
+ )
269
+ print(result.final_output)
270
+
271
+asyncio.run(main())
272
+```
273
+
274
+## Best practices
275
+
276
+1. **Keep providers focused**: Each provider should integrate with one specific platform
277
+2. **Handle errors gracefully**: Catch and transform errors from tool execution
278
+3. **Follow platform conventions**: Adopt naming and structural conventions of the target platform
279
+4. **Use type annotations**: Leverage Python's typing system for better IDE support and documentation
280
+5. **Cache transformed tools**: Store transformed tools when appropriate to improve performance
281
+6. **Add helper methods**: Provide convenient methods for common platform-specific operations
282
+7. **Document your provider**: Include docstrings and usage examples
283
+8. **Set meaningful provider names**: Use the name parameter for telemetry and debugging
fumadocs/content/docs/providers/custom-typescript.mdx
new
+303
@@ -0,0 +1,303 @@
1
+---
2
+title: TypeScript Custom Provider
3
+description: Learn how to create custom providers for any AI platform in TypeScript
4
+---
5
+
6
+This guide provides a comprehensive walkthrough of creating custom providers for the Composio TypeScript SDK, enabling integration with different AI frameworks and platforms.
7
+
8
+## Provider Architecture
9
+
10
+The Composio SDK uses a provider architecture to adapt tools for different AI frameworks. The provider handles:
11
+
12
+1. **Tool Format Transformation**: Converting Composio tools into formats compatible with specific AI platforms
13
+2. **Tool Execution**: Managing the flow of tool execution and results
14
+3. **Platform-Specific Integration**: Providing helper methods for seamless integration
15
+
16
+## Types of Providers
17
+
18
+There are two types of providers:
19
+
20
+1. **Non-Agentic Providers**: Transform tools for platforms that don't have their own agency (e.g., OpenAI)
21
+2. **Agentic Providers**: Transform tools for platforms that have their own agency (e.g., LangChain, AutoGPT)
22
+
23
+## Provider Class Hierarchy
24
+
25
+```
26
+BaseProvider (Abstract)
27
+├── BaseNonAgenticProvider (Abstract)
28
+│ └── OpenAIProvider (Concrete)
29
+│ └── [Your Custom Non-Agentic Provider] (Concrete)
30
+└── BaseAgenticProvider (Abstract)
31
+ └── [Your Custom Agentic Provider] (Concrete)
32
+```
33
+
34
+## Creating a Non-Agentic Provider
35
+
36
+Non-agentic providers implement the `BaseNonAgenticProvider` abstract class:
37
+
38
+```typescript
39
+import { BaseNonAgenticProvider, Tool } from '@composio/core';
40
+
41
+// Define your tool format
42
+interface MyAITool {
43
+ name: string;
44
+ description: string;
45
+ parameters: {
46
+ type: string;
47
+ properties: Record<string, unknown>;
48
+ required?: string[];
49
+ };
50
+}
51
+
52
+// Define your tool collection format
53
+type MyAIToolCollection = MyAITool[];
54
+
55
+// Create your provider
56
+export class MyAIProvider extends BaseNonAgenticProvider<MyAIToolCollection, MyAITool> {
57
+ // Required: Unique provider name for telemetry
58
+ readonly name = 'my-ai-platform';
59
+
60
+ // Required: Method to transform a single tool
61
+ override wrapTool(tool: Tool): MyAITool {
62
+ return {
63
+ name: tool.slug,
64
+ description: tool.description || '',
65
+ parameters: {
66
+ type: 'object',
67
+ properties: tool.inputParameters?.properties || {},
68
+ required: tool.inputParameters?.required || [],
69
+ },
70
+ };
71
+ }
72
+
73
+ // Required: Method to transform a collection of tools
74
+ override wrapTools(tools: Tool[]): MyAIToolCollection {
75
+ return tools.map(tool => this.wrapTool(tool));
76
+ }
77
+
78
+ // Optional: Custom helper methods for your AI platform
79
+ async executeMyAIToolCall(
80
+ userId: string,
81
+ toolCall: {
82
+ name: string;
83
+ arguments: Record<string, unknown>;
84
+ }
85
+ ): Promise<string> {
86
+ // Use the built-in executeTool method
87
+ const result = await this.executeTool(toolCall.name, {
88
+ userId,
89
+ arguments: toolCall.arguments,
90
+ });
91
+
92
+ return JSON.stringify(result.data);
93
+ }
94
+}
95
+```
96
+
97
+## Creating an Agentic Provider
98
+
99
+Agentic providers implement the `BaseAgenticProvider` abstract class:
100
+
101
+```typescript
102
+import { BaseAgenticProvider, Tool, ExecuteToolFn } from '@composio/core';
103
+
104
+// Define your tool format
105
+interface AgentTool {
106
+ name: string;
107
+ description: string;
108
+ execute: (args: Record<string, unknown>) => Promise<unknown>;
109
+ schema: Record<string, unknown>;
110
+}
111
+
112
+// Define your tool collection format
113
+interface AgentToolkit {
114
+ tools: AgentTool[];
115
+ createAgent: (config: Record<string, unknown>) => unknown;
116
+}
117
+
118
+// Create your provider
119
+export class MyAgentProvider extends BaseAgenticProvider<AgentToolkit, AgentTool> {
120
+ // Required: Unique provider name for telemetry
121
+ readonly name = 'my-agent-platform';
122
+
123
+ // Required: Method to transform a single tool with execute function
124
+ override wrapTool(tool: Tool, executeToolFn: ExecuteToolFn): AgentTool {
125
+ return {
126
+ name: tool.slug,
127
+ description: tool.description || '',
128
+ schema: tool.inputParameters || {},
129
+ execute: async (args: Record<string, unknown>) => {
130
+ const result = await executeToolFn(tool.slug, args);
131
+ if (!result.successful) {
132
+ throw new Error(result.error || 'Tool execution failed');
133
+ }
134
+ return result.data;
135
+ },
136
+ };
137
+ }
138
+
139
+ // Required: Method to transform a collection of tools with execute function
140
+ override wrapTools(tools: Tool[], executeToolFn: ExecuteToolFn): AgentToolkit {
141
+ const agentTools = tools.map(tool => this.wrapTool(tool, executeToolFn));
142
+
143
+ return {
144
+ tools: agentTools,
145
+ createAgent: config => {
146
+ // Create an agent using the tools
147
+ return {
148
+ run: async (prompt: string) => {
149
+ // Implementation depends on your agent framework
150
+ console.log(`Running agent with prompt: ${prompt}`);
151
+ // The agent would use the tools.execute method to run tools
152
+ },
153
+ };
154
+ },
155
+ };
156
+ }
157
+
158
+ // Optional: Custom helper methods for your agent platform
159
+ async runAgent(agentToolkit: AgentToolkit, prompt: string): Promise<unknown> {
160
+ const agent = agentToolkit.createAgent({});
161
+ return await agent.run(prompt);
162
+ }
163
+}
164
+```
165
+
166
+## Using Your Custom Provider
167
+
168
+After creating your provider, use it with the Composio SDK:
169
+
170
+```typescript
171
+import { Composio } from '@composio/core';
172
+import { MyAIProvider } from './my-ai-provider';
173
+
174
+// Create your provider instance
175
+const myProvider = new MyAIProvider();
176
+
177
+// Initialize Composio with your provider
178
+const composio = new Composio({
179
+ apiKey: 'your-composio-api-key',
180
+ provider: myProvider,
181
+});
182
+
183
+// Get tools - they will be transformed by your provider
184
+const tools = await composio.tools.get('default', {
185
+ toolkits: ['github'],
186
+});
187
+
188
+// Use the tools with your AI platform
189
+console.log(tools); // These will be in your custom format
190
+```
191
+
192
+## Provider State and Context
193
+
194
+Your provider can maintain state and context:
195
+
196
+```typescript
197
+export class StatefulProvider extends BaseNonAgenticProvider<ToolCollection, Tool> {
198
+ readonly name = 'stateful-provider';
199
+
200
+ // Provider state
201
+ private requestCount = 0;
202
+ private toolCache = new Map<string, any>();
203
+ private config: ProviderConfig;
204
+
205
+ constructor(config: ProviderConfig) {
206
+ super();
207
+ this.config = config;
208
+ }
209
+
210
+ override wrapTool(tool: Tool): ProviderTool {
211
+ this.requestCount++;
212
+
213
+ // Use the provider state/config
214
+ const enhancedTool = {
215
+ // Transform the tool
216
+ name: this.config.useUpperCase ? tool.slug.toUpperCase() : tool.slug,
217
+ description: tool.description,
218
+ schema: tool.inputParameters,
219
+ };
220
+
221
+ // Cache the transformed tool
222
+ this.toolCache.set(tool.slug, enhancedTool);
223
+
224
+ return enhancedTool;
225
+ }
226
+
227
+ override wrapTools(tools: Tool[]): ProviderToolCollection {
228
+ return tools.map(tool => this.wrapTool(tool));
229
+ }
230
+
231
+ // Custom methods that use provider state
232
+ getRequestCount(): number {
233
+ return this.requestCount;
234
+ }
235
+
236
+ getCachedTool(slug: string): ProviderTool | undefined {
237
+ return this.toolCache.get(slug);
238
+ }
239
+}
240
+```
241
+
242
+## Advanced: Provider Composition
243
+
244
+You can compose functionality by extending existing providers:
245
+
246
+```typescript
247
+import { OpenAIProvider } from '@composio/openai';
248
+
249
+// Extend the OpenAI provider with custom functionality
250
+export class EnhancedOpenAIProvider extends OpenAIProvider {
251
+ // Add properties
252
+ private analytics = {
253
+ toolCalls: 0,
254
+ errors: 0,
255
+ };
256
+
257
+ // Override methods to add functionality
258
+ override async executeToolCall(userId, tool, options, modifiers) {
259
+ this.analytics.toolCalls++;
260
+
261
+ try {
262
+ // Call the parent implementation
263
+ const result = await super.executeToolCall(userId, tool, options, modifiers);
264
+ return result;
265
+ } catch (error) {
266
+ this.analytics.errors++;
267
+ throw error;
268
+ }
269
+ }
270
+
271
+ // Add new methods
272
+ getAnalytics() {
273
+ return this.analytics;
274
+ }
275
+
276
+ async executeWithRetry(userId, tool, options, modifiers, maxRetries = 3) {
277
+ let attempts = 0;
278
+ let lastError;
279
+
280
+ while (attempts < maxRetries) {
281
+ try {
282
+ return await this.executeToolCall(userId, tool, options, modifiers);
283
+ } catch (error) {
284
+ lastError = error;
285
+ attempts++;
286
+ await new Promise(resolve => setTimeout(resolve, 1000 * attempts));
287
+ }
288
+ }
289
+
290
+ throw lastError;
291
+ }
292
+}
293
+```
294
+
295
+## Best Practices
296
+
297
+1. **Keep providers focused**: Each provider should integrate with one specific platform
298
+2. **Handle errors gracefully**: Catch and transform errors from tool execution
299
+3. **Follow platform conventions**: Adopt naming and structural conventions of the target platform
300
+4. **Optimize for performance**: Cache transformed tools when possible
301
+5. **Add helper methods**: Provide convenient methods for common platform-specific operations
302
+6. **Provide clear documentation**: Document your provider's unique features and usage
303
+7. **Use telemetry**: Set a meaningful provider name for telemetry insights
fumadocs/content/docs/providers/google.mdx
new
+110
@@ -0,0 +1,110 @@
1
+---
2
+title: Google Gen AI Provider
3
+description: Use Composio with Gemini through the Google Gen AI SDK
4
+---
5
+
6
+The Google provider transforms Composio tools into a format compatible with Gemini's function calling capabilities through it's API
7
+
8
+## Setup
9
+
10
+<Tabs items={["Python", "TypeScript"]}>
11
+<Tab value="Python">
12
+```bash
13
+pip install google-genai composio_google
14
+```
15
+</Tab>
16
+<Tab value="TypeScript">
17
+```bash
18
+npm install @google/genai
19
+npm i @composio/core @composio/gemini
20
+```
21
+</Tab>
22
+</Tabs>
23
+
24
+<Tabs items={["Python", "TypeScript"]}>
25
+<Tab value="Python">
26
+```python
27
+from composio import Composio
28
+from composio_gemini import GeminiProvider
29
+from google import genai
30
+from google.genai import types
31
+
32
+# Create composio client
33
+composio = Composio(provider=GeminiProvider())
34
+# Create google client
35
+client = genai.Client()
36
+```
37
+</Tab>
38
+<Tab value="TypeScript">
39
+```typescript
40
+import {Composio} from '@composio/core';
41
+import {GoogleProvider} from '@composio/google'
42
+import {GoogleGenAI} from '@google/genai'
43
+
44
+const composio = new Composio({
45
+ apiKey: "your-composio-api-key",
46
+ provider: new GoogleProvider()
47
+})
48
+
49
+const ai = new GoogleGenAI({
50
+ apiKey: "your-gemini-api-key"
51
+})
52
+```
53
+</Tab>
54
+</Tabs>
55
+
56
+## Usage
57
+
58
+<Tabs items={["Python", "TypeScript"]}>
59
+<Tab value="Python">
60
+```python
61
+user_id = "0000-1111-2222"
62
+tools = composio.tools.get(user_id, tools=["COMPOSIO_SEARCH_DUCK_DUCK_GO_SEARCH"])
63
+
64
+# Create genai client config
65
+config = types.GenerateContentConfig(tools=tools)
66
+
67
+# # Use the chat interface.
68
+chat = client.chats.create(model="gemini-2.0-flash", config=config)
69
+response = chat.send_message("search about the latest info on windsurf acquisition.")
70
+print(response.text)
71
+```
72
+</Tab>
73
+<Tab value="TypeScript">
74
+```typescript
75
+// Use a unique identifier for each user in your application
76
+const user_id = "your-external-user-id"
77
+
78
+// Get tools - this returns already wrapped tools when using GoogleProvider
79
+const tools = await composio.tools.get(user_id, 'HACKERNEWS_GET_USER')
80
+
81
+const response = await ai.models.generateContent({
82
+ model: 'gemini-2.0-flash-001',
83
+ contents: "Search for the user 'pg's",
84
+ config: {
85
+ tools: [{ functionDeclarations: tools }],
86
+ },
87
+});
88
+
89
+if (response.functionCalls && response.functionCalls.length > 0) {
90
+ console.log(`Calling tool ${response.functionCalls[0].name}`);
91
+ const functionCall = {
92
+ name: response.functionCalls[0].name || '',
93
+ args: response.functionCalls[0].args || {},
94
+ };
95
+ const result = await composio.provider.executeToolCall(user_id, functionCall);
96
+ console.log(`Result: ${result}`);
97
+} else {
98
+ console.log('No function calls in the response');
99
+ console.log(response.text);
100
+}
101
+```
102
+</Tab>
103
+</Tabs>
104
+
105
+## Modifiers
106
+
107
+Modifiers are functions that can be used to intercept and optionally **modify** the schema, the tool call request and the response from the tool call.
108
+
109
+OpenAI provider modifiers are the standard framework modifiers.
110
+Read more here: [Modifying tool schemas](/docs/modify-tool-behavior/modifying-tool-schemas)
fumadocs/content/docs/providers/langchain.mdx
new
+132
@@ -0,0 +1,132 @@
1
+---
2
+title: LangChain Provider
3
+description: Use Composio tools with LangChain
4
+---
5
+
6
+The LangChain Provider transforms Composio tools into a format compatible with LangChain's function calling capabilities.
7
+
8
+## Setup
9
+
10
+<Tabs items={["Python", "TypeScript"]}>
11
+<Tab value="Python">
12
+```bash
13
+pip install composio_langchain==0.8.0 langchain
14
+```
15
+</Tab>
16
+<Tab value="TypeScript">
17
+```bash
18
+npm install @composio/langchain
19
+```
20
+</Tab>
21
+</Tabs>
22
+
23
+## Usage
24
+
25
+<Tabs items={["Python", "TypeScript"]}>
26
+<Tab value="Python">
27
+```python
28
+from composio import Composio
29
+from composio_langchain import LangchainProvider
30
+from langchain import hub # type: ignore
31
+from langchain.agents import AgentExecutor, create_openai_functions_agent
32
+from langchain_openai import ChatOpenAI
33
+
34
+# Pull relevant agent model.
35
+prompt = hub.pull("hwchase17/openai-functions-agent")
36
+
37
+# Initialize tools.
38
+openai_client = ChatOpenAI(model="gpt-5")
39
+
40
+composio = Composio(provider=LangchainProvider())
41
+
42
+# Get All the tools
43
+tools = composio.tools.get(user_id="default", toolkits=["GITHUB"])
44
+
45
+# Define task
46
+task = "Star a repo composiohq/composio on GitHub"
47
+
48
+# Define agent
49
+agent = create_openai_functions_agent(openai_client, tools, prompt)
50
+agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
51
+
52
+# Execute using agent_executor
53
+agent_executor.invoke({"input": task})
54
+```
55
+</Tab>
56
+<Tab value="TypeScript">
57
+```typescript
58
+import { ChatOpenAI } from '@langchain/openai';
59
+import { HumanMessage, AIMessage } from '@langchain/core/messages';
60
+import { ToolNode } from '@langchain/langgraph/prebuilt';
61
+import { StateGraph, MessagesAnnotation } from '@langchain/langgraph';
62
+import { Composio } from '@composio/core';
63
+import { LangchainProvider } from '@composio/langchain';
64
+
65
+// initiate composio
66
+const composio = new Composio({
67
+ apiKey: process.env.COMPOSIO_API_KEY,
68
+ provider: new LangchainProvider(),
69
+});
70
+
71
+// fetch the tool
72
+console.log(`🔄 Fetching the tool...`);
73
+const tools = await composio.tools.get('default', 'HACKERNEWS_GET_USER');
74
+
75
+// Define the tools for the agent to use
76
+const toolNode = new ToolNode(tools);
77
+
78
+// Create a model and give it access to the tools
79
+const model = new ChatOpenAI({
80
+ model: 'gpt-4o-mini',
81
+ temperature: 0,
82
+}).bindTools(tools);
83
+
84
+// Define the function that determines whether to continue or not
85
+function shouldContinue({ messages }: typeof MessagesAnnotation.State) {
86
+ const lastMessage = messages[messages.length - 1] as AIMessage;
87
+
88
+ // If the LLM makes a tool call, then we route to the "tools" node
89
+ if (lastMessage.tool_calls?.length) {
90
+ return 'tools';
91
+ }
92
+ // Otherwise, we stop (reply to the user) using the special "__end__" node
93
+ return '__end__';
94
+}
95
+
96
+// Define the function that calls the model
97
+async function callModel(state: typeof MessagesAnnotation.State) {
98
+ console.log(`🔄 Calling the model...`);
99
+ const response = await model.invoke(state.messages);
100
+
101
+ // We return a list, because this will get added to the existing list
102
+ return { messages: [response] };
103
+}
104
+
105
+// Define a new graph
106
+const workflow = new StateGraph(MessagesAnnotation)
107
+ .addNode('agent', callModel)
108
+ .addEdge('__start__', 'agent') // __start__ is a special name for the entrypoint
109
+ .addNode('tools', toolNode)
110
+ .addEdge('tools', 'agent')
111
+ .addConditionalEdges('agent', shouldContinue);
112
+
113
+// Finally, we compile it into a LangChain Runnable.
114
+const app = workflow.compile();
115
+
116
+// Use the agent
117
+const finalState = await app.invoke({
118
+ messages: [new HumanMessage('Find the details of the user `pg` on HackerNews')],
119
+});
120
+console.log(`✅ Message recieved from the model`);
121
+console.log(finalState.messages[finalState.messages.length - 1].content);
122
+
123
+const nextState = await app.invoke({
124
+ // Including the messages from the previous run gives the LLM context.
125
+ // This way it knows we're asking about the weather in NY
126
+ messages: [...finalState.messages, new HumanMessage('what about haxzie')],
127
+});
128
+console.log(`✅ Message recieved from the model`);
129
+console.log(nextState.messages[nextState.messages.length - 1].content);
130
+```
131
+</Tab>
132
+</Tabs>
fumadocs/content/docs/providers/llamaindex.mdx
new
+166
@@ -0,0 +1,166 @@
1
+---
2
+title: LlamaIndex Provider
3
+description: Use Composio tools with LlamaIndex
4
+---
5
+
6
+The LlamaIndex Provider transforms Composio tools into a format compatible with LlamaIndex's function calling capabilities.
7
+
8
+## Setup
9
+
10
+<Tabs items={["Python", "TypeScript"]}>
11
+<Tab value="Python">
12
+```bash
13
+pip install composio_llamaindex==0.8.0 llama-index
14
+```
15
+</Tab>
16
+<Tab value="TypeScript">
17
+```bash
18
+npm install @composio/llamaindex @llamaindex/openai @llamaindex/workflow
19
+```
20
+</Tab>
21
+</Tabs>
22
+
23
+## Usage
24
+
25
+<Tabs items={["Python", "TypeScript"]}>
26
+<Tab value="Python">
27
+```python
28
+import asyncio
29
+import dotenv
30
+from composio_llamaindex import LlamaIndexProvider
31
+from llama_index.core.agent.workflow import FunctionAgent
32
+from llama_index.llms.openai import OpenAI
33
+
34
+from composio import Composio
35
+
36
+# Load environment variables from .env
37
+dotenv.load_dotenv()
38
+
39
+# Setup client
40
+llm = OpenAI(model="gpt-5")
41
+composio = Composio(provider=LlamaIndexProvider())
42
+
43
+tools = composio.tools.get(
44
+ user_id="user@acme.com",
45
+ tools=["GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER"],
46
+)
47
+
48
+workflow = FunctionAgent(
49
+ tools=tools,
50
+ llm=llm,
51
+ system_prompt="You are an agent that performs github actions.",
52
+)
53
+
54
+
55
+async def main():
56
+ result = await workflow.run(
57
+ user_msg="Hello! I would like to star a repo composiohq/composio on GitHub"
58
+ )
59
+ print(result)
60
+
61
+
62
+if __name__ == "__main__":
63
+ asyncio.run(main())
64
+```
65
+</Tab>
66
+<Tab value="TypeScript">
67
+```typescript
68
+import { Composio } from '@composio/core';
69
+import { LlamaindexProvider } from '@composio/llamaindex';
70
+import { openai } from '@llamaindex/openai';
71
+import { agent } from '@llamaindex/workflow';
72
+import 'dotenv/config';
73
+
74
+// Initialize Composio with LlamaIndex provider
75
+const composio = new Composio({
76
+ apiKey: process.env.COMPOSIO_API_KEY,
77
+ provider: new LlamaindexProvider(),
78
+});
79
+
80
+async function main() {
81
+ // Get tools
82
+ const tools = await composio.tools.get('user@acme.com', {
83
+ tools: ['GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER'],
84
+ });
85
+
86
+ // Create LlamaIndex agent with Composio tools
87
+ const githubAgent = agent({
88
+ name: 'GitHub Agent',
89
+ description: 'An agent that performs GitHub actions',
90
+ llm: openai({ model: 'gpt-4o-mini' }),
91
+ systemPrompt: 'You are an agent that performs github actions.',
92
+ tools,
93
+ });
94
+
95
+ // Run the agent
96
+ const result = await githubAgent.run(
97
+ 'Hello! I would like to star a repo composiohq/composio on GitHub'
98
+ );
99
+
100
+ console.log(result);
101
+}
102
+
103
+main().catch(console.error);
104
+```
105
+</Tab>
106
+</Tabs>
107
+
108
+## Advanced Usage
109
+
110
+### Streaming Agent with Multiple Toolkits
111
+
112
+```typescript
113
+import { Composio } from '@composio/core';
114
+import { LlamaindexProvider } from '@composio/llamaindex';
115
+import { openai } from '@llamaindex/openai';
116
+import { agent, agentStreamEvent } from '@llamaindex/workflow';
117
+import 'dotenv/config';
118
+
119
+const composio = new Composio({
120
+ apiKey: process.env.COMPOSIO_API_KEY,
121
+ provider: new LlamaindexProvider(),
122
+});
123
+
124
+async function streamingExample() {
125
+ // Get tools from multiple toolkits with execution modifiers
126
+ const tools = await composio.tools.get(
127
+ 'default',
128
+ {
129
+ toolkits: ['gmail', 'googlecalendar', 'slack'],
130
+ limit: 20,
131
+ },
132
+ {
133
+ beforeExecute: ({ toolSlug, params }) => {
134
+ console.log(`🔄 Executing ${toolSlug} with:`, params);
135
+ return params;
136
+ },
137
+ afterExecute: ({ toolSlug, result }) => {
138
+ console.log(`✅ ${toolSlug} completed:`, result);
139
+ return result;
140
+ },
141
+ }
142
+ );
143
+
144
+ // Create streaming agent
145
+ const assistantAgent = agent({
146
+ name: 'Personal Assistant',
147
+ description: 'A helpful personal assistant',
148
+ llm: openai({ model: 'gpt-4o-mini' }),
149
+ systemPrompt: 'You are a helpful personal assistant that can manage emails, calendar events, and slack messages.',
150
+ tools,
151
+ });
152
+
153
+ // Stream the response
154
+ const stream = await assistantAgent.runStream(
155
+ 'Schedule a meeting for tomorrow at 2 PM and send a slack message about it'
156
+ );
157
+
158
+ for await (const event of stream) {
159
+ if (agentStreamEvent.include(event)) {
160
+ process.stdout.write(event.data.delta);
161
+ }
162
+ }
163
+}
164
+
165
+streamingExample().catch(console.error);
166
+```
fumadocs/content/docs/providers/mastra.mdx
new
+62
@@ -0,0 +1,62 @@
1
+---
2
+title: Mastra Provider
3
+description: Use Composio with Mastra's TypeScript framework
4
+---
5
+
6
+Mastra is a TypeScript native framework for building agents with tools and MCPs. It expects tools to be in the following format:
7
+- Inputs: What information the tool needs to run (defined with an `inputSchema`, often using Zod).
8
+- Outputs: The structure of the data the tool returns (defined with an `outputSchema`).
9
+- Execution Logic: The code that performs the tool's action.
10
+- Description: Text that helps the agent understand what the tool does and when to use it.
11
+
12
+More documentation [here](https://mastra.ai/en/docs/tools-mcp/overview#creating-tools)
13
+
14
+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.
15
+
16
+## Setup
17
+
18
+```bash
19
+npm install @composio/mastra
20
+```
21
+
22
+You can specify the provider in the constructor.
23
+
24
+```typescript
25
+import { Composio } from "@composio/core";
26
+import { MastraProvider } from "@composio/mastra";
27
+import { Agent } from "@mastra/core/agent";
28
+import { openai } from "@ai-sdk/openai";
29
+
30
+const composio = new Composio({
31
+ provider: new MastraProvider(),
32
+});
33
+```
34
+
35
+## Usage
36
+
37
+The tools are passed to the agent as a parameter.
38
+
39
+```typescript
40
+const userId = "john doe";
41
+
42
+const tools = await composio.tools.get(
43
+ userId,
44
+ {
45
+ toolkits: ["SUPABASE"],
46
+ }
47
+);
48
+
49
+const agent = new Agent({
50
+ name: "Supabase Agent",
51
+ instructions: "You think therefore you are.",
52
+ model: openai("gpt-4.1"),
53
+ tools: tools,
54
+});
55
+
56
+const { text } = await agent.generate([
57
+ { role: "user", content: "Tell me about my Supabase project" },
58
+]);
59
+
60
+console.log("\n🤖 Agent Response:\n");
61
+console.log(text);
62
+```
fumadocs/content/docs/providers/meta.json
new
+16
@@ -0,0 +1,16 @@
1
+{
2
+ "title": "Providers",
3
+ "pages": [
4
+ "openai",
5
+ "anthropic",
6
+ "google",
7
+ "langchain",
8
+ "llamaindex",
9
+ "crewai",
10
+ "vercel",
11
+ "openai-agents",
12
+ "mastra",
13
+ "custom-typescript",
14
+ "custom-python"
15
+ ]
16
+}
fumadocs/content/docs/providers/openai-agents.mdx
new
+94
@@ -0,0 +1,94 @@
1
+---
2
+title: OpenAI Agents Provider
3
+description: Use Composio with OpenAI's Agents SDK
4
+---
5
+
6
+The OpenAI Agents Provider is a provider that formats the Composio tools into an object compatible with OpenAI's Agents API.
7
+
8
+OpenAI Agents SDK is different from the OpenAI SDK. It helps build agentic AI apps in a lightweight, easy-to-use package with very few abstractions.
9
+
10
+<Tabs items={["Python", "TypeScript"]}>
11
+<Tab value="Python">
12
+## Setup
13
+
14
+```bash
15
+pip install composio openai-agents composio-openai-agents
16
+```
17
+
18
+## Usage
19
+
20
+```python
21
+import asyncio
22
+from composio import Composio
23
+from agents import Agent, Runner
24
+from composio_openai_agents import OpenAIAgentsProvider
25
+
26
+composio = Composio(api_key="your-api-key", provider=OpenAIAgentsProvider())
27
+
28
+# Create a connected account for the user for the gmail toolkit and replace with your own user id
29
+externalUserId = "your-user-id"
30
+
31
+# Get Gmail tools that are pre-configured
32
+tools = composio.tools.get(user_id=externalUserId, tools=["GMAIL_SEND_EMAIL"])
33
+
34
+agent = Agent(
35
+ name="Email Manager", instructions="You are a helpful assistant", tools=tools
36
+)
37
+
38
+# Run the agent
39
+async def main():
40
+ result = await Runner.run(
41
+ starting_agent=agent,
42
+ input="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!'",
43
+ )
44
+ print(result.final_output)
45
+
46
+asyncio.run(main())
47
+```
48
+</Tab>
49
+<Tab value="TypeScript">
50
+## Setup
51
+
52
+```bash
53
+npm install @composio/core @openai/agents @composio/openai-agents
54
+```
55
+
56
+## Usage
57
+
58
+```typescript
59
+import { Composio } from "@composio/core";
60
+import { Agent, run } from "@openai/agents";
61
+import { OpenAIAgentsProvider } from "@composio/openai-agents";
62
+
63
+// add OPENAI_API_KEY in your .env file
64
+const composio = new Composio({
65
+ apiKey: "your-api-key",
66
+ provider: new OpenAIAgentsProvider(),
67
+});
68
+
69
+// Create a connected account for the user for the gmail toolkit and replace with your own user id
70
+const externalUserId = "your-user-id";
71
+
72
+// Fetch tools for GMAIL toolkit on behalf of the user
73
+const tools = await composio.tools.get(externalUserId, {
74
+ tools: ["GMAIL_SEND_EMAIL"],
75
+ });
76
+
77
+const agent = new Agent({
78
+ name: "Email Manager",
79
+ tools: tools,
80
+});
81
+
82
+console.log(`Running agent...`);
83
+const result = await run(
84
+ agent,
85
+ "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!'"
86
+);
87
+
88
+console.log(`Received response from agent`);
89
+if (result.finalOutput) {
90
+ console.log(JSON.stringify(result.finalOutput, null, 2));
91
+}
92
+```
93
+</Tab>
94
+</Tabs>
fumadocs/content/docs/providers/openai.mdx
new
+204
@@ -0,0 +1,204 @@
1
+---
2
+title: OpenAI Providers
3
+description: Use Composio with OpenAI's Responses and Chat Completion APIs
4
+---
5
+
6
+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.
7
+
8
+## Setup
9
+
10
+By default, the OpenAI Provider is installed when you install the Composio SDK. You can also install it manually:
11
+
12
+<Tabs items={["Python", "TypeScript"]}>
13
+<Tab value="Python">
14
+```bash
15
+pip install composio_openai
16
+```
17
+</Tab>
18
+<Tab value="TypeScript">
19
+```bash
20
+npm install @composio/openai
21
+```
22
+</Tab>
23
+</Tabs>
24
+
25
+## Responses API
26
+
27
+The Responses API is the recommended way to build more agentic flows with the OpenAI API.
28
+Read more about it in the [OpenAI documentation](https://platform.openai.com/docs/api-reference/responses)
29
+
30
+<Callout>
31
+Before executing any tools that require authentication (like Gmail), you'll need to:
32
+1. [Create an Auth Configuration](/docs/authenticating-tools#creating-an-auth-config) for your integration
33
+2. [Set up a Connected Account](/docs/authenticating-tools#connecting-an-account) for the user.
34
+</Callout>
35
+
36
+<Tabs items={["Python", "TypeScript"]}>
37
+<Tab value="Python">
38
+```python
39
+from openai import OpenAI
40
+from composio import Composio
41
+from composio_openai import OpenAIResponsesProvider
42
+
43
+# Initialize Composio client with OpenAI Provider
44
+composio = Composio(provider=OpenAIResponsesProvider())
45
+openai = OpenAI()
46
+
47
+# Make sure to create an auth config and a connected account for the user with gmail toolkit
48
+# Make sure to replace "your-user-id" with the actual user ID
49
+user_id = "your-user-id"
50
+
51
+tools = composio.tools.get(user_id=user_id, tools=["GMAIL_SEND_EMAIL"])
52
+
53
+response = openai.responses.create(
54
+ model="gpt-5",
55
+ tools=tools,
56
+ input=[
57
+ {
58
+ "role": "user",
59
+ "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'"
60
+ }
61
+ ]
62
+)
63
+
64
+# Execute the function calls
65
+result = composio.provider.handle_tool_calls(response=response, user_id=user_id)
66
+print(result)
67
+```
68
+</Tab>
69
+<Tab value="TypeScript">
70
+```typescript
71
+import OpenAI from 'openai';
72
+import { Composio } from '@composio/core';
73
+import { OpenAIResponsesProvider } from '@composio/openai';
74
+
75
+// Initialize Composio client with OpenAI Provider
76
+const composio = new Composio({
77
+ provider: new OpenAIResponsesProvider(),
78
+});
79
+const openai = new OpenAI({});
80
+
81
+// Make sure to create an auth config and a connected account for the user with gmail toolkit
82
+// Make sure to replace "your-user-id" with the actual user ID
83
+const userId = "your-user-id";
84
+
85
+async function main() {
86
+ try {
87
+ const tools = await composio.tools.get(userId, {tools: ["GMAIL_SEND_EMAIL"]});
88
+
89
+ const response = await openai.responses.create({
90
+ model: "gpt-5",
91
+ tools: tools,
92
+ input: [
93
+ {
94
+ role: "user",
95
+ 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'"
96
+ },
97
+ ],
98
+ });
99
+
100
+ // Execute the function calls
101
+ const result = await composio.provider.handleToolCalls(userId, response.output);
102
+ console.log(result);
103
+ } catch (error) {
104
+ console.error('Error:', error);
105
+ }
106
+}
107
+
108
+main();
109
+```
110
+</Tab>
111
+</Tabs>
112
+
113
+## Chat Completion API
114
+
115
+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).
116
+The OpenAI Chat Provider is the default provider used by Composio SDK, but you can also explicitly initialise it.
117
+
118
+<Callout>
119
+Before executing any tools that require authentication (like Gmail), you'll need to:
120
+1. [Create an Auth Configuration](/docs/authenticating-tools#creating-an-auth-config) for your integration
121
+2. [Set up a Connected Account](/docs/authenticating-tools#connecting-an-account) for the user.
122
+</Callout>
123
+
124
+<Tabs items={["Python", "TypeScript"]}>
125
+<Tab value="Python">
126
+```python
127
+from openai import OpenAI
128
+from composio import Composio
129
+from composio_openai import OpenAIProvider
130
+
131
+# Initialize Composio client with OpenAI Provider
132
+composio = Composio(provider=OpenAIProvider())
133
+openai = OpenAI()
134
+
135
+# Make sure to create an auth config and a connected account for the user with gmail toolkit
136
+# Make sure to replace "your-user-id" with the actual user ID
137
+user_id = "your-user-id"
138
+
139
+tools = composio.tools.get(user_id=user_id, tools=["GMAIL_SEND_EMAIL"])
140
+
141
+response = openai.chat.completions.create(
142
+ model="gpt-5",
143
+ tools=tools,
144
+ messages=[
145
+ {"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'"},
146
+ ],
147
+)
148
+
149
+# Execute the function calls
150
+result = composio.provider.handle_tool_calls(response=response, user_id=user_id)
151
+print(result)
152
+```
153
+</Tab>
154
+<Tab value="TypeScript">
155
+```typescript
156
+import OpenAI from 'openai';
157
+import { Composio } from '@composio/core';
158
+import { OpenAIProvider } from '@composio/openai';
159
+
160
+// Initialize Composio client with OpenAI Provider
161
+const composio = new Composio({
162
+ provider: new OpenAIProvider(),
163
+});
164
+
165
+const openai = new OpenAI();
166
+
167
+// Make sure to create an auth config and a connected account for the user with gmail toolkit
168
+// Make sure to replace "your-user-id" with the actual user ID
169
+const userId = "your-user-id";
170
+
171
+async function main() {
172
+ try {
173
+ const tools = await composio.tools.get(userId, {tools: ["GMAIL_SEND_EMAIL"]});
174
+
175
+ const response = await openai.chat.completions.create({
176
+ model: "gpt-5",
177
+ tools: tools,
178
+ messages: [
179
+ {
180
+ role: "user",
181
+ 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'"
182
+ },
183
+ ],
184
+ });
185
+
186
+ // Execute the function calls
187
+ const result = await composio.provider.handleToolCalls(userId, response);
188
+ console.log(result);
189
+ } catch (error) {
190
+ console.error('Error:', error);
191
+ }
192
+}
193
+
194
+main();
195
+```
196
+</Tab>
197
+</Tabs>
198
+
199
+## Modifiers
200
+
201
+Modifiers are functions that can be used to intercept and optionally **modify** the schema, the tool call request and the response from the tool call.
202
+
203
+OpenAI provider modifiers are the standard framework modifiers.
204
+Read more here: [Modifying tool schemas](/docs/modify-tool-behavior/modifying-tool-schemas)
fumadocs/content/docs/providers/vercel.mdx
new
+52
@@ -0,0 +1,52 @@
1
+---
2
+title: Vercel AI SDK Provider
3
+description: Use Composio with Vercel AI SDK
4
+---
5
+
6
+Vercel AI SDK allows you to configure an optional async `execute` function that the framework uses to execute the tool calls.
7
+
8
+The Vercel provider for Composio formats the Composio tools and adds this `execute` function to the tool calls.
9
+
10
+## Setup
11
+
12
+Vercel AI SDK and the provider are only available for the TypeScript SDK.
13
+
14
+```bash
15
+npm install @composio/vercel
16
+```
17
+
18
+You can specify and import the provider in the constructor.
19
+
20
+```typescript
21
+import { Composio } from '@composio/core';
22
+import { VercelProvider } from '@composio/vercel';
23
+import { generateText } from 'ai';
24
+import { openai } from "@ai-sdk/openai";
25
+
26
+const composio = new Composio({
27
+ provider: new VercelProvider(),
28
+});
29
+```
30
+
31
+## Usage
32
+
33
+```typescript
34
+// create an auth config for gmail
35
+// then create a connected account with an external user id that identifies the user
36
+const externalUserId = "your-external-user-id";
37
+const tools = await composio.tools.get(externalUserId, "GMAIL_SEND_EMAIL");
38
+
39
+// env: OPENAI_API_KEY
40
+const { text } = await generateText({
41
+ model: openai("gpt-5"),
42
+ messages: [
43
+ {
44
+ role: "user",
45
+ 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!'`,
46
+ },
47
+ ],
48
+ tools,
49
+});
50
+
51
+console.log("Email sent successfully!", { text });
52
+```