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: Open ai agents provider (#2197)
Sushmitha Mallesh committed
Nov 22, 2025 at 23:23 UTC
b295db47934012efb729cd0b7b5fe07abcc29285
3 files changed
+91
-43
fern/pages/src/providers/openai-agents.mdx
+32
-43
@@ -13,46 +13,35 @@ The OpenAI Agents Provider is a provider that formats the Composio tools into an
13
14
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.
15
16
-## Setup
17
-
18
-```bash
19
-pip install composio_openai_agents==0.8.0 openai-agents
20
-```
21
-
22
-### Usage
23
-```python Python maxLines=60 wordWrap
24
-import asyncio
25
-
26
-from agents import Agent, Runner
27
-
28
-from composio import Composio
29
-from composio_openai_agents import OpenAIAgentsProvider
30
-
31
-# Initialize Composio toolset
32
-composio = Composio(provider=OpenAIAgentsProvider())
33
-
34
-# Get all the tools
35
-tools = composio.tools.get(
36
- user_id="default",
37
- tools=["GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER"],
38
-)
39
-
40
-# Create an agent with the tools
41
-agent = Agent(
42
- name="GitHub Agent",
43
- instructions="You are a helpful assistant.",
44
- tools=tools,
45
-)
46
-
47
-# Run the agent
48
-async def main():
49
- result = await Runner.run(
50
- starting_agent=agent,
51
- input=(
52
- "Star the repository composiohq/composio on GitHub"
53
- ),
54
- )
55
- print(result.final_output)
56
-
57
-asyncio.run(main())
58
-```
\ No newline at end of file
16
+<Tabs>
17
+ <Tab title="Python">
18
+ ### Setup
19
+
20
+ ```bash
21
+ pip install composio openai-agents composio-openai-agents
22
+ ```
23
+
24
+ ### Usage
25
+
26
+ <SnippetCode
27
+ src="fern/snippets/providers/python/openai-agents.py"
28
+ startLine={1}
29
+ endLine={26}
30
+ />
31
+ </Tab>
32
+ <Tab title="TypeScript">
33
+ ### Setup
34
+
35
+ ```bash
36
+ npm install @composio/core @openai/agents @composio/openai-agents
37
+ ```
38
+
39
+ ### Usage
40
+
41
+ <SnippetCode
42
+ src="fern/snippets/providers/typescript/openai-agents.ts"
43
+ startLine={1}
44
+ endLine={33}
45
+ />
46
+ </Tab>
47
+</Tabs>
fern/snippets/providers/python/openai-agents.py
new
+26
@@ -0,0 +1,26 @@
1
+import asyncio
2
+from composio import Composio
3
+from agents import Agent, Runner
4
+from composio_openai_agents import OpenAIAgentsProvider
5
+
6
+composio = Composio(api_key="your-api-key", provider=OpenAIAgentsProvider())
7
+
8
+# Create a connected account for the user for the gmail toolkit and replace with your own user id
9
+externalUserId = "your-user-id"
10
+
11
+# Get Gmail tools that are pre-configured
12
+tools = composio.tools.get(user_id=externalUserId, tools=["GMAIL_SEND_EMAIL"])
13
+
14
+agent = Agent(
15
+ name="Email Manager", instructions="You are a helpful assistant", tools=tools
16
+)
17
+
18
+# Run the agent
19
+async def main():
20
+ result = await Runner.run(
21
+ starting_agent=agent,
22
+ 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!'",
23
+ )
24
+ print(result.final_output)
25
+
26
+asyncio.run(main())
\ No newline at end of file
fern/snippets/providers/typescript/openai-agents.ts
new
+33
@@ -0,0 +1,33 @@
1
+import { Composio } from "@composio/core";
2
+import { Agent, run } from "@openai/agents";
3
+import { OpenAIAgentsProvider } from "@composio/openai-agents";
4
+
5
+// add OPENAI_API_KEY in your .env file
6
+const composio = new Composio({
7
+ apiKey: "your-api-key",
8
+ provider: new OpenAIAgentsProvider(),
9
+});
10
+
11
+// Create a connected account for the user for the gmail toolkit and replace with your own user id
12
+const externalUserId = "your-user-id";
13
+
14
+// Fetch tools for GMAIL toolkit on behalf of the user
15
+const tools = await composio.tools.get(externalUserId, {
16
+ tools: ["GMAIL_SEND_EMAIL"],
17
+ });
18
+
19
+const agent = new Agent({
20
+ name: "Email Manager",
21
+ tools: tools,
22
+});
23
+
24
+console.log(`Running agent...`);
25
+const result = await run(
26
+ agent,
27
+ "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!'"
28
+);
29
+
30
+console.log(`Received response from agent`);
31
+if (result.finalOutput) {
32
+ console.log(JSON.stringify(result.finalOutput, null, 2));
33
+}
\ No newline at end of file