@composio/openai-agents 0.9.2 → 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
@@ -1,4 +1,4 @@
1
- import { BaseAgenticProvider } from "@composio/core";
1
+ import { BaseAgenticProvider, normalizeToolArguments } from "@composio/core";
2
2
  import { tool } from "@openai/agents";
3
3
 
4
4
  //#region src/index.ts
@@ -117,8 +117,7 @@ var OpenAIAgentsProvider = class extends BaseAgenticProvider {
117
117
  },
118
118
  strict: false,
119
119
  execute: async (params) => {
120
- const input = typeof params === "string" ? JSON.parse(params) : params;
121
- return await executeTool(composioTool.slug, input);
120
+ return await executeTool(composioTool.slug, normalizeToolArguments(params, composioTool.slug));
122
121
  }
123
122
  });
124
123
  }
@@ -162,8 +161,8 @@ var OpenAIAgentsProvider = class extends BaseAgenticProvider {
162
161
  * ```
163
162
  */
164
163
  wrapTools(tools, executeTool) {
165
- return tools.map((tool$1) => {
166
- return this.wrapTool(tool$1, executeTool);
164
+ return tools.map((tool) => {
165
+ return this.wrapTool(tool, executeTool);
167
166
  });
168
167
  }
169
168
  };
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
1
  {
2
2
  "name": "@composio/openai-agents",
3
- "version": "0.9.2",
3
+ "version": "0.10.0",
4
4
  "description": "",
5
5
  "main": "dist/index.mjs",
6
+ "type": "module",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/ComposioHQ/composio.git",
10
+ "directory": "ts/packages/providers/openai-agents"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/ComposioHQ/composio/issues"
14
+ },
15
+ "homepage": "https://github.com/ComposioHQ/composio/tree/main/ts/packages/providers/openai-agents#readme",
6
16
  "publishConfig": {
7
17
  "access": "public"
8
18
  },
9
19
  "exports": {
10
20
  ".": {
11
- "import": {
12
- "types": "./dist/index.d.mts",
13
- "default": "./dist/index.mjs"
14
- },
15
- "require": {
16
- "types": "./dist/index.d.cts",
17
- "default": "./dist/index.cjs"
18
- },
19
- "default": {
20
- "types": "./dist/index.d.cts",
21
- "default": "./dist/index.cjs"
22
- }
21
+ "types": "./dist/index.d.mts",
22
+ "default": "./dist/index.mjs"
23
23
  }
24
24
  },
25
25
  "files": [
@@ -32,20 +32,20 @@
32
32
  "peerDependencies": {
33
33
  "@composio/core": ">=0.10.0 <1.0.0",
34
34
  "@openai/agents": "^0.1.3",
35
- "zod": "^4.1.0"
35
+ "zod": "^4.4.3"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@openai/agents": "^0.1.3",
39
- "tsdown": "^0.18.4",
40
- "typescript": "^5.9.2",
41
- "zod": "^4.1.0",
42
- "vitest": "^3.2.4",
43
- "@composio/core": "0.10.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"
44
44
  },
45
45
  "gitHead": "4fae6e54d5c150fba955cc5fa314281da5a1e064",
46
46
  "scripts": {
47
47
  "clean": "git clean -xdf node_modules",
48
- "build": "pnpm exec tsdown",
48
+ "build": "tsdown",
49
49
  "test": "vitest run"
50
50
  },
51
51
  "types": "dist/index.d.mts"
package/dist/index.cjs DELETED
@@ -1,172 +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
- const input = typeof params === "string" ? JSON.parse(params) : params;
121
- return await executeTool(composioTool.slug, input);
122
- }
123
- });
124
- }
125
- /**
126
- * Wraps a list of Composio tools as a OpenAI Agents tool collection.
127
- *
128
- * This method transforms multiple Composio tool definitions into the format
129
- * expected by OpenAI Agents for function calling, organizing them
130
- * into a dictionary keyed by tool slug.
131
- *
132
- * @param {ComposioTool[]} tools - Array of Composio tools to wrap
133
- * @param {ExecuteToolFn} executeTool - Function to execute the tools
134
- * @returns {OpenAIAgentsToolCollection} Dictionary of wrapped tools in OpenAI Agents format
135
- *
136
- * @example
137
- * ```typescript
138
- * // Get OpenAI Agents tools from Composio
139
- * const composio = new Composio({
140
- * apiKey: 'your-api-key',
141
- * provider: new OpenAIAgentsProvider()
142
- * });
143
- *
144
- * const tools = await composio.tools.get('default', {
145
- * toolkits: ['github'],
146
- * });
147
- *
148
- * import { OpenAI } from '@openai/agents';
149
- *
150
- * export async function POST(req: Request) {
151
- * const { messages } = await req.json();
152
- * const openai = new OpenAI();
153
- *
154
- * const response = await openai.chat.completions.create({
155
- * model: 'gpt-4',
156
- * messages,
157
- * tools: openaiAgentsTools
158
- * });
159
- *
160
- * return new StreamingTextResponse(response.choices[0].message);
161
- * }
162
- * ```
163
- */
164
- wrapTools(tools, executeTool) {
165
- return tools.map((tool) => {
166
- return this.wrapTool(tool, executeTool);
167
- });
168
- }
169
- };
170
-
171
- //#endregion
172
- 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 };