Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 22, 13:15 UTC
docs(openai-agents): Add Native Tools code examples
- Remove intro sentence and Usage heading for cleaner layout - Add Python and TypeScript code for Native Tools section Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sushmithamallesh committed
Jan 23, 2026 at 17:22 UTC
b57370e37211384605b4ccd03c9c4137223bd4fd
1 file changed
+74
-7
docs/content/docs/providers/openai-agents.mdx
+74
-7
@@ -4,10 +4,6 @@ description: Use Composio with OpenAI's Agents SDK
4
keywords: [agents sdk]
5
---
6
7
-OpenAI Agents SDK is a lightweight framework for building agentic AI apps with minimal abstractions.
8
-
9
-## Usage
10
-
7
<ToolTypeFlow>
8
9
<ToolTypeOption id="native" name="Native Tools" icon="native">
@@ -23,7 +19,7 @@ pip install composio composio-openai-agents openai-agents
19
</Tab>
20
<Tab value="TypeScript">
21
```bash
26
-npm install @composio/core @composio/openai-agents @openai/agents
22
+npm install dotenv @composio/core @composio/openai-agents @openai/agents
23
```
24
</Tab>
25
</Tabs>
@@ -48,12 +44,83 @@ OPENAI_API_KEY=xxxxxxxxx
44
<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
45
<Tab value="Python">
46
```python
51
-# TODO: Native tools Python code
47
+import asyncio
48
+from dotenv import load_dotenv
49
+load_dotenv()
50
+
51
+from composio import Composio
52
+from agents import Agent, Runner
53
+from composio_openai_agents import OpenAIAgentsProvider
54
+
55
+# Initialize Composio with OpenAI Agents provider
56
+composio = Composio(provider=OpenAIAgentsProvider())
57
+
58
+external_user_id = "user_2nFh83Hde"
59
+recipient_email = "soham.g@composio.dev"
60
+
61
+# Create a session
62
+session = composio.create(user_id=external_user_id)
63
+
64
+# Get tools from the session
65
+tools = session.tools()
66
+
67
+# Create agent with tools
68
+agent = Agent(
69
+ name="Email Manager",
70
+ instructions="You are a helpful assistant.",
71
+ tools=tools,
72
+)
73
+
74
+# Run the agent
75
+async def main():
76
+ result = await Runner.run(
77
+ starting_agent=agent,
78
+ input=f"Send an email to {recipient_email} with the subject 'Hello from Composio' and the body 'Hello from the other side!'",
79
+ )
80
+ print(result.final_output)
81
+
82
+asyncio.run(main())
83
```
84
</Tab>
85
<Tab value="TypeScript">
86
```typescript
56
-// TODO: Native tools TypeScript code
87
+import "dotenv/config";
88
+import { Composio } from "@composio/core";
89
+import { Agent, run } from "@openai/agents";
90
+import { OpenAIAgentsProvider } from "@composio/openai-agents";
91
+
92
+// Initialize Composio with OpenAI Agents provider
93
+const composio = new Composio({
94
+ provider: new OpenAIAgentsProvider(),
95
+});
96
+
97
+const externalUserId = "user_2nFh83Hde";
98
+const recipientEmail = "soham.g@composio.dev";
99
+
100
+// Create a session
101
+const session = await composio.create(externalUserId);
102
+
103
+// Get tools from the session
104
+const tools = await session.tools();
105
+
106
+// Create agent with tools
107
+const agent = new Agent({
108
+ name: "Email Manager",
109
+ instructions: "You are a helpful assistant.",
110
+ tools: tools,
111
+});
112
+
113
+// Run the agent
114
+console.log("Running agent...");
115
+const result = await run(
116
+ agent,
117
+ `Send an email to ${recipientEmail} with the subject 'Hello from Composio' and the body 'This is a test email!'`
118
+);
119
+
120
+console.log("Received response from agent");
121
+if (result.finalOutput) {
122
+ console.log(result.finalOutput);
123
+}
124
```
125
</Tab>
126
</Tabs>