@composio/openai-agents 0.9.3 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -2,7 +2,6 @@ import { BaseAgenticProvider, ExecuteToolFn, McpServerGetResponse, McpUrlRespons
2
2
  import { Tool as Tool$1 } from "@openai/agents";
3
3
 
4
4
  //#region src/index.d.ts
5
-
6
5
  type OpenAIAgentsToolCollection = Array<Tool$1>;
7
6
  declare class OpenAIAgentsProvider extends BaseAgenticProvider<OpenAIAgentsToolCollection, Tool$1, McpServerGetResponse> {
8
7
  readonly name = "openai-agents";
package/dist/index.mjs CHANGED
@@ -161,8 +161,8 @@ var OpenAIAgentsProvider = class extends BaseAgenticProvider {
161
161
  * ```
162
162
  */
163
163
  wrapTools(tools, executeTool) {
164
- return tools.map((tool$1) => {
165
- return this.wrapTool(tool$1, executeTool);
164
+ return tools.map((tool) => {
165
+ return this.wrapTool(tool, executeTool);
166
166
  });
167
167
  }
168
168
  };
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@composio/openai-agents",
3
- "version": "0.9.3",
3
+ "version": "0.10.0",
4
4
  "description": "",
5
5
  "main": "dist/index.mjs",
6
+ "type": "module",
6
7
  "repository": {
7
8
  "type": "git",
8
9
  "url": "https://github.com/ComposioHQ/composio.git",
@@ -17,18 +18,8 @@
17
18
  },
18
19
  "exports": {
19
20
  ".": {
20
- "import": {
21
- "types": "./dist/index.d.mts",
22
- "default": "./dist/index.mjs"
23
- },
24
- "require": {
25
- "types": "./dist/index.d.cts",
26
- "default": "./dist/index.cjs"
27
- },
28
- "default": {
29
- "types": "./dist/index.d.cts",
30
- "default": "./dist/index.cjs"
31
- }
21
+ "types": "./dist/index.d.mts",
22
+ "default": "./dist/index.mjs"
32
23
  }
33
24
  },
34
25
  "files": [
@@ -41,20 +32,20 @@
41
32
  "peerDependencies": {
42
33
  "@composio/core": ">=0.10.0 <1.0.0",
43
34
  "@openai/agents": "^0.1.3",
44
- "zod": "^4.1.0"
35
+ "zod": "^4.4.3"
45
36
  },
46
37
  "devDependencies": {
47
38
  "@openai/agents": "^0.1.3",
48
- "tsdown": "^0.18.4",
49
- "typescript": "^5.9.2",
50
- "zod": "^4.1.0",
51
- "vitest": "^4.1.0",
52
- "@composio/core": "0.11.0"
39
+ "tsdown": "^0.22.3",
40
+ "typescript": "^6.0.3",
41
+ "zod": "^4.4.3",
42
+ "vitest": "^4.1.9",
43
+ "@composio/core": "0.12.0"
53
44
  },
54
45
  "gitHead": "4fae6e54d5c150fba955cc5fa314281da5a1e064",
55
46
  "scripts": {
56
47
  "clean": "git clean -xdf node_modules",
57
- "build": "pnpm exec tsdown",
48
+ "build": "tsdown",
58
49
  "test": "vitest run"
59
50
  },
60
51
  "types": "dist/index.d.mts"
package/dist/index.cjs DELETED
@@ -1,171 +0,0 @@
1
- let _composio_core = require("@composio/core");
2
- let _openai_agents = require("@openai/agents");
3
-
4
- //#region src/index.ts
5
- /**
6
- * OpenAI Agents Provider
7
- * To be used with the @openai/agents package
8
- *
9
- * Author: Musthaq Ahamad <musthaq@composio.dev>
10
- * Reference: https://openai.github.io/openai-agents-js/
11
- *
12
- * This provider provides a set of tools for interacting with OpenAI's Agents API.
13
- *
14
- * @packageDocumentation
15
- * @module providers/openai-agents
16
- */
17
- var OpenAIAgentsProvider = class extends _composio_core.BaseAgenticProvider {
18
- name = "openai-agents";
19
- strict;
20
- /**
21
- * Creates a new instance of the OpenAIAgentsProvider.
22
- *
23
- * This provider enables integration with the @openai/agents package,
24
- * allowing Composio tools to be used with OpenAI Agents.
25
- *
26
- * @example
27
- * ```typescript
28
- * // Initialize the OpenAIAgentsProvider
29
- * const provider = new OpenAIAgentsProvider();
30
- *
31
- * // Use with Composio
32
- * const composio = new Composio({
33
- * apiKey: 'your-api-key',
34
- * provider: new OpenAIAgentsProvider()
35
- * });
36
- *
37
- * // Use the provider to wrap tools for @openai/agents
38
- * const agentTools = provider.wrapTools(composioTools, composio.tools.execute);
39
- * ```
40
- */
41
- constructor(options) {
42
- super();
43
- this.strict = options?.strict ?? false;
44
- }
45
- /**
46
- * Transform MCP URL response into Anthropic-specific format.
47
- * By default, Anthropic uses the standard format (same as default),
48
- * but this method is here to show providers can customize if needed.
49
- *
50
- * @param data - The MCP URL response data
51
- * @returns Standard MCP server response format
52
- */
53
- wrapMcpServerResponse(data) {
54
- return data.map((item) => ({
55
- url: new URL(item.url),
56
- name: item.name
57
- }));
58
- }
59
- /**
60
- * Wraps a Composio tool in a OpenAI Agents tool format.
61
- *
62
- * This method transforms a Composio tool definition into the format
63
- * expected by @openai/agents for function calling.
64
- *
65
- * @param {ComposioTool} composioTool - The Composio tool to wrap
66
- * @param {ExecuteToolFn} executeTool - Function to execute the tool
67
- * @returns {OpenAIAgentsTool} The wrapped OpenAI Agents tool
68
- *
69
- * @example
70
- * ```typescript
71
- * // Wrap a single tool for use with Vercel AI SDK
72
- * const composioTool = {
73
- * slug: 'SEARCH_TOOL',
74
- * description: 'Search for information',
75
- * inputParameters: {
76
- * type: 'object',
77
- * properties: {
78
- * query: { type: 'string' }
79
- * },
80
- * required: ['query']
81
- * }
82
- * };
83
- *
84
- * // Create a Vercel tool using the provider
85
- * const vercelTool = provider.wrapTool(
86
- * composioTool,
87
- * composio.tools.execute
88
- * );
89
- *
90
- * // Use with Vercel AI SDK
91
- * import { StreamingTextResponse, Message } from 'ai';
92
- * import { OpenAI } from 'openai';
93
- *
94
- * export async function POST(req: Request) {
95
- * const { messages } = await req.json();
96
- * const openai = new OpenAI();
97
- *
98
- * const response = await openai.chat.completions.create({
99
- * model: 'gpt-4',
100
- * messages,
101
- * tools: [vercelTool]
102
- * });
103
- *
104
- * return new StreamingTextResponse(response.choices[0].message);
105
- * }
106
- * ```
107
- */
108
- wrapTool(composioTool, executeTool) {
109
- return (0, _openai_agents.tool)({
110
- name: composioTool.slug,
111
- description: composioTool.description ?? "",
112
- parameters: {
113
- type: "object",
114
- properties: composioTool.inputParameters?.properties || {},
115
- required: composioTool.inputParameters?.required || [],
116
- additionalProperties: true
117
- },
118
- strict: false,
119
- execute: async (params) => {
120
- return await executeTool(composioTool.slug, (0, _composio_core.normalizeToolArguments)(params, composioTool.slug));
121
- }
122
- });
123
- }
124
- /**
125
- * Wraps a list of Composio tools as a OpenAI Agents tool collection.
126
- *
127
- * This method transforms multiple Composio tool definitions into the format
128
- * expected by OpenAI Agents for function calling, organizing them
129
- * into a dictionary keyed by tool slug.
130
- *
131
- * @param {ComposioTool[]} tools - Array of Composio tools to wrap
132
- * @param {ExecuteToolFn} executeTool - Function to execute the tools
133
- * @returns {OpenAIAgentsToolCollection} Dictionary of wrapped tools in OpenAI Agents format
134
- *
135
- * @example
136
- * ```typescript
137
- * // Get OpenAI Agents tools from Composio
138
- * const composio = new Composio({
139
- * apiKey: 'your-api-key',
140
- * provider: new OpenAIAgentsProvider()
141
- * });
142
- *
143
- * const tools = await composio.tools.get('default', {
144
- * toolkits: ['github'],
145
- * });
146
- *
147
- * import { OpenAI } from '@openai/agents';
148
- *
149
- * export async function POST(req: Request) {
150
- * const { messages } = await req.json();
151
- * const openai = new OpenAI();
152
- *
153
- * const response = await openai.chat.completions.create({
154
- * model: 'gpt-4',
155
- * messages,
156
- * tools: openaiAgentsTools
157
- * });
158
- *
159
- * return new StreamingTextResponse(response.choices[0].message);
160
- * }
161
- * ```
162
- */
163
- wrapTools(tools, executeTool) {
164
- return tools.map((tool) => {
165
- return this.wrapTool(tool, executeTool);
166
- });
167
- }
168
- };
169
-
170
- //#endregion
171
- exports.OpenAIAgentsProvider = OpenAIAgentsProvider;
package/dist/index.d.cts DELETED
@@ -1,135 +0,0 @@
1
- import { BaseAgenticProvider, ExecuteToolFn, McpServerGetResponse, McpUrlResponse, Tool } from "@composio/core";
2
- import { Tool as Tool$1 } from "@openai/agents";
3
-
4
- //#region src/index.d.ts
5
-
6
- type OpenAIAgentsToolCollection = Array<Tool$1>;
7
- declare class OpenAIAgentsProvider extends BaseAgenticProvider<OpenAIAgentsToolCollection, Tool$1, McpServerGetResponse> {
8
- readonly name = "openai-agents";
9
- private strict;
10
- /**
11
- * Creates a new instance of the OpenAIAgentsProvider.
12
- *
13
- * This provider enables integration with the @openai/agents package,
14
- * allowing Composio tools to be used with OpenAI Agents.
15
- *
16
- * @example
17
- * ```typescript
18
- * // Initialize the OpenAIAgentsProvider
19
- * const provider = new OpenAIAgentsProvider();
20
- *
21
- * // Use with Composio
22
- * const composio = new Composio({
23
- * apiKey: 'your-api-key',
24
- * provider: new OpenAIAgentsProvider()
25
- * });
26
- *
27
- * // Use the provider to wrap tools for @openai/agents
28
- * const agentTools = provider.wrapTools(composioTools, composio.tools.execute);
29
- * ```
30
- */
31
- constructor(options?: {
32
- strict?: boolean;
33
- });
34
- /**
35
- * Transform MCP URL response into Anthropic-specific format.
36
- * By default, Anthropic uses the standard format (same as default),
37
- * but this method is here to show providers can customize if needed.
38
- *
39
- * @param data - The MCP URL response data
40
- * @returns Standard MCP server response format
41
- */
42
- wrapMcpServerResponse(data: McpUrlResponse): McpServerGetResponse;
43
- /**
44
- * Wraps a Composio tool in a OpenAI Agents tool format.
45
- *
46
- * This method transforms a Composio tool definition into the format
47
- * expected by @openai/agents for function calling.
48
- *
49
- * @param {ComposioTool} composioTool - The Composio tool to wrap
50
- * @param {ExecuteToolFn} executeTool - Function to execute the tool
51
- * @returns {OpenAIAgentsTool} The wrapped OpenAI Agents tool
52
- *
53
- * @example
54
- * ```typescript
55
- * // Wrap a single tool for use with Vercel AI SDK
56
- * const composioTool = {
57
- * slug: 'SEARCH_TOOL',
58
- * description: 'Search for information',
59
- * inputParameters: {
60
- * type: 'object',
61
- * properties: {
62
- * query: { type: 'string' }
63
- * },
64
- * required: ['query']
65
- * }
66
- * };
67
- *
68
- * // Create a Vercel tool using the provider
69
- * const vercelTool = provider.wrapTool(
70
- * composioTool,
71
- * composio.tools.execute
72
- * );
73
- *
74
- * // Use with Vercel AI SDK
75
- * import { StreamingTextResponse, Message } from 'ai';
76
- * import { OpenAI } from 'openai';
77
- *
78
- * export async function POST(req: Request) {
79
- * const { messages } = await req.json();
80
- * const openai = new OpenAI();
81
- *
82
- * const response = await openai.chat.completions.create({
83
- * model: 'gpt-4',
84
- * messages,
85
- * tools: [vercelTool]
86
- * });
87
- *
88
- * return new StreamingTextResponse(response.choices[0].message);
89
- * }
90
- * ```
91
- */
92
- wrapTool(composioTool: Tool, executeTool: ExecuteToolFn): Tool$1;
93
- /**
94
- * Wraps a list of Composio tools as a OpenAI Agents tool collection.
95
- *
96
- * This method transforms multiple Composio tool definitions into the format
97
- * expected by OpenAI Agents for function calling, organizing them
98
- * into a dictionary keyed by tool slug.
99
- *
100
- * @param {ComposioTool[]} tools - Array of Composio tools to wrap
101
- * @param {ExecuteToolFn} executeTool - Function to execute the tools
102
- * @returns {OpenAIAgentsToolCollection} Dictionary of wrapped tools in OpenAI Agents format
103
- *
104
- * @example
105
- * ```typescript
106
- * // Get OpenAI Agents tools from Composio
107
- * const composio = new Composio({
108
- * apiKey: 'your-api-key',
109
- * provider: new OpenAIAgentsProvider()
110
- * });
111
- *
112
- * const tools = await composio.tools.get('default', {
113
- * toolkits: ['github'],
114
- * });
115
- *
116
- * import { OpenAI } from '@openai/agents';
117
- *
118
- * export async function POST(req: Request) {
119
- * const { messages } = await req.json();
120
- * const openai = new OpenAI();
121
- *
122
- * const response = await openai.chat.completions.create({
123
- * model: 'gpt-4',
124
- * messages,
125
- * tools: openaiAgentsTools
126
- * });
127
- *
128
- * return new StreamingTextResponse(response.choices[0].message);
129
- * }
130
- * ```
131
- */
132
- wrapTools(tools: Tool[], executeTool: ExecuteToolFn): OpenAIAgentsToolCollection;
133
- }
134
- //#endregion
135
- export { OpenAIAgentsProvider };