Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
Fix: use non strict schema for openai agents sdk (#1919)
Musthaq Ahamad0a61cbef8ecc
diff --git a/.changeset/tame-corners-mate.md b/.changeset/tame-corners-mate.mdnew file mode 100644index 000000000..484fda4a0--- /dev/null+++ b/.changeset/tame-corners-mate.md@@ -0,0 +1,5 @@+---+'@composio/openai-agents': patch+---++Use non strict schema for tools and bump @openai/agents sdk versiondiff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 9aacbf6f5..73fabea22 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -423,8 +423,8 @@ importers:specifier: workspace:*version: link:../../packages/providers/openai-agents'@openai/agents':- specifier: ^0.0.17- version: 0.0.17([email protected])([email protected])+ specifier: ^0.1.1+ version: 0.1.1([email protected])([email protected])dotenv:specifier: ^16.4.1version: 16.5.0@@ -434,6 +434,9 @@ importers:zod:specifier: ^3.24.2version: 3.25.67+ zod-to-json-schema:+ specifier: ^3.24.5+ version: 3.24.5([email protected])devDependencies:'@types/bun':specifier: ^1.2.9@@ -828,8 +831,8 @@ importers:ts/packages/providers/openai-agents:dependencies:'@openai/agents':- specifier: ^0.0.17- version: 0.0.17([email protected])([email protected])+ specifier: ^0.1.1+ version: 0.1.1([email protected])([email protected])devDependencies:'@composio/core':specifier: workspace:*@@ -2328,26 +2331,26 @@ packages:resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}engines: {node: '>= 8'}- '@openai/[email protected]':- resolution: {integrity: sha512-+V8rtwq8OtvCvXIVN/8ZFJNfQXLeCpeaBuFwJY7QBa44lIdMSB3vULcUVm1L7bTGKeVKpdB8GDky64hOFG4w7Q==}+ '@openai/[email protected]':+ resolution: {integrity: sha512-u/PjlmCz2UGheJ3apbB5utdBdGGQD5PS4JSX+MsH/Inb291dEnNbf3hA1GcM2RKHCJrpaQNofcNcNuEW1uophQ==}peerDependencies:zod: ^3.25.40peerDependenciesMeta:zod:optional: true- '@openai/[email protected]':- resolution: {integrity: sha512-gGpcAWXh858HiNI51Nhl0MxM66asG0mv1LGASwB4jfzP7/GjM9k0on/ZlMBffM+6HID1zuDDYPbETD2y4XTY4w==}+ '@openai/[email protected]':+ resolution: {integrity: sha512-l7xj/9P3cEbA30qwSsSyO0hlxXdKJo63BtRlsmnF7HIUQpAz5sWsVeBB3rbmOXJNAz8hK6yMsjoaL+qsy0HCZg==}peerDependencies:zod: ^3.25.40- '@openai/[email protected]':- resolution: {integrity: sha512-9yxe93XKuy/pMhFMSrqAu0GlB3mpHh6J9ZGv6PdVpgQyc8uTmujJakMTsYBlogWHJNmGlWIRgf0+x8jIVoTv4A==}+ '@openai/[email protected]':+ resolution: {integrity: sha512-VjepFe80A3z37HWHjc5PI9q0vPSq3s+zTlxKZ0mrFrvdH1hd2wK3XYSgvhZe/ROQ85iBMmyP9h1+DB69qob7Dw==}peerDependencies:zod: ^3.25.40- '@openai/[email protected]':- resolution: {integrity: sha512-3tkN03WRLTTqcuzkopf37rAF6WtX0js3ciOqFn+EC1873J04Yf2m4xTYkYKT4RkwbOZh620+sIMPNKiUhW2rMg==}+ '@openai/[email protected]':+ resolution: {integrity: sha512-2nAjIltQ691Nzlh/+XxbQxuGDtIouk7bvb3EmrObIHiK+5F2nG0PU6xEx34D6DtpiocJtuDWpGkYdixK/FvPnw==}peerDependencies:zod: ^3.25.40@@ -8995,10 +8998,10 @@ snapshots:'@nodelib/fs.scandir': 2.1.5fastq: 1.19.1dependencies:debug: 4.4.1([email protected])- openai: 5.16.0([email protected])([email protected])+ openai: 5.19.1([email protected])([email protected])optionalDependencies:'@modelcontextprotocol/sdk': 1.17.4zod: 3.25.67@@ -9006,19 +9009,19 @@ snapshots:- supports-color- wsdependencies:- '@openai/agents-core': 0.0.17([email protected])([email protected])+ '@openai/agents-core': 0.1.1([email protected])([email protected])debug: 4.4.1([email protected])- openai: 5.16.0([email protected])([email protected])+ openai: 5.19.1([email protected])([email protected])zod: 3.25.67transitivePeerDependencies:- supports-color- ws- '@openai/[email protected]([email protected])':+ '@openai/[email protected]([email protected])':dependencies:- '@openai/agents-core': 0.0.17([email protected])([email protected])+ '@openai/agents-core': 0.1.1([email protected])([email protected])'@types/ws': 8.18.1debug: 4.4.1([email protected])ws: 8.18.2@@ -9028,13 +9031,13 @@ snapshots:- supports-color- utf-8-validatedependencies:- '@openai/agents-core': 0.0.17([email protected])([email protected])- '@openai/agents-openai': 0.0.17([email protected])([email protected])- '@openai/agents-realtime': 0.0.17([email protected])+ '@openai/agents-core': 0.1.1([email protected])([email protected])+ '@openai/agents-openai': 0.1.1([email protected])([email protected])+ '@openai/agents-realtime': 0.1.1([email protected])debug: 4.4.1([email protected])- openai: 5.16.0([email protected])([email protected])+ openai: 5.19.1([email protected])([email protected])zod: 3.25.67transitivePeerDependencies:- bufferutil@@ -11185,14 +11188,6 @@ snapshots:chai: 5.2.0tinyrainbow: 2.0.0- '@vitest/[email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected]))':- dependencies:- '@vitest/spy': 3.2.4- estree-walker: 3.0.3- magic-string: 0.30.17- optionalDependencies:-'@vitest/[email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected]))':dependencies:'@vitest/spy': 3.2.4@@ -11201,14 +11196,6 @@ snapshots:optionalDependencies:- '@vitest/[email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected]))':- dependencies:- '@vitest/spy': 3.2.4- estree-walker: 3.0.3- magic-string: 0.30.17- optionalDependencies:-'@vitest/[email protected]':dependencies:tinyrainbow: 2.0.0@@ -11238,7 +11225,7 @@ snapshots:sirv: 3.0.1tinyglobby: 0.2.14tinyrainbow: 2.0.0- vitest: 3.2.4(@types/[email protected])(@vitest/[email protected])([email protected])([email protected])([email protected])+ vitest: 3.2.4(@types/[email protected])(@vitest/[email protected])([email protected])([email protected])([email protected])'@vitest/[email protected]':dependencies:@@ -14405,7 +14392,7 @@ snapshots:dependencies:'@types/chai': 5.2.2'@vitest/expect': 3.2.4- '@vitest/mocker': 3.2.4([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ '@vitest/mocker': 3.2.4([email protected](@types/[email protected])([email protected])([email protected])([email protected]))'@vitest/pretty-format': 3.2.4'@vitest/runner': 3.2.4'@vitest/snapshot': 3.2.4@@ -14489,7 +14476,7 @@ snapshots:dependencies:'@types/chai': 5.2.2'@vitest/expect': 3.2.4- '@vitest/mocker': 3.2.4([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ '@vitest/mocker': 3.2.4([email protected](@types/[email protected])([email protected])([email protected])([email protected]))'@vitest/pretty-format': 3.2.4'@vitest/runner': 3.2.4'@vitest/snapshot': 3.2.4diff --git a/ts/examples/openai/package.json b/ts/examples/openai/package.jsonindex 23b17014d..fae3f000d 100644--- a/ts/examples/openai/package.json+++ b/ts/examples/openai/package.json@@ -22,10 +22,11 @@"@composio/core": "workspace:*","@composio/openai": "workspace:*","@composio/openai-agents": "workspace:*",- "@openai/agents": "^0.0.17",+ "@openai/agents": "^0.1.1","dotenv": "^16.4.1","openai": "^5.16.0",- "zod": "^3.24.2"+ "zod": "^3.24.2",+ "zod-to-json-schema": "^3.24.5"},"devDependencies": {"@types/bun": "^1.2.9",diff --git a/ts/examples/tools/src/tool-conversion.ts b/ts/examples/tools/src/tool-conversion.tsindex 5fdb5db8b..2bc04ab65 100644--- a/ts/examples/tools/src/tool-conversion.ts+++ b/ts/examples/tools/src/tool-conversion.ts@@ -1,15 +1,16 @@import { Composio, jsonSchemaToZodSchema } from '@composio/core';+import { nullable, z } from 'zod';import zodToJsonSchema from 'zod-to-json-schema';const composio = new Composio({apiKey: process.env.COMPOSIO_API_KEY,});-const tool = await composio.tools.getRawComposioToolBySlug('COMPOSIO_MULTI_EXECUTE_TOOL');+const tool = await composio.tools.getRawComposioToolBySlug('SLACK_SEND_MESSAGE');const inputParams = tool.inputParameters;console.log(`---------- Original Input Parameters ----------`);console.log(JSON.stringify(inputParams, null, 2));const zodSchema = jsonSchemaToZodSchema(inputParams ?? {});console.log(`---------- Zod Schema Parsed ----------`);-console.log(JSON.stringify(zodToJsonSchema(zodSchema, { target: "jsonSchema7"}), null, 2));\ No newline at end of file+console.log(JSON.stringify(zodToJsonSchema(zodSchema, { target: "jsonSchema7"}), null, 2));diff --git a/ts/packages/providers/openai-agents/package.json b/ts/packages/providers/openai-agents/package.jsonindex 69c80c7b3..9979b3ae9 100644--- a/ts/packages/providers/openai-agents/package.json+++ b/ts/packages/providers/openai-agents/package.json@@ -31,7 +31,7 @@"packageManager": "[email protected]","peerDependencies": {"@composio/core": "0.1.51",- "@openai/agents": "^0.0.17"+ "@openai/agents": "^0.1.1"},"devDependencies": {"@composio/core": "workspace:*",diff --git a/ts/packages/providers/openai-agents/src/index.ts b/ts/packages/providers/openai-agents/src/index.tsindex c44956389..342aff1dc 100644--- a/ts/packages/providers/openai-agents/src/index.ts+++ b/ts/packages/providers/openai-agents/src/index.ts@@ -14,7 +14,6 @@ import {BaseAgenticProvider,Tool as ComposioTool,ExecuteToolFn,- jsonSchemaToZodSchema,McpUrlResponse,McpServerGetResponse,} from '@composio/core';@@ -124,12 +123,13 @@ export class OpenAIAgentsProvider extends BaseAgenticProvider<return createOpenAIAgentTool({name: composioTool.slug,description: composioTool.description ?? '',- parameters: jsonSchemaToZodSchema(- (composioTool.inputParameters as Record<string, unknown>) ?? {},- {- strict: this.strict ? true : false,- }- ),+ parameters: {+ type: 'object',+ properties: composioTool.inputParameters?.properties || {},+ required: composioTool.inputParameters?.required || [],+ additionalProperties: true,+ },+ strict: false,execute: async params => {const input = typeof params === 'string' ? JSON.parse(params) : params;return await executeTool(composioTool.slug, input);diff --git a/ts/packages/providers/openai-agents/test/openai-agents.test.ts b/ts/packages/providers/openai-agents/test/openai-agents.test.tsindex 0371157f0..615c2b784 100644--- a/ts/packages/providers/openai-agents/test/openai-agents.test.ts+++ b/ts/packages/providers/openai-agents/test/openai-agents.test.ts@@ -84,7 +84,13 @@ describe('OpenAIAgentsProvider', () => {expect(createOpenAIAgentTool).toHaveBeenCalledWith({name: mockTool.slug,description: mockTool.description,- parameters: expect.any(Object),+ parameters: {+ type: 'object',+ properties: mockTool.inputParameters?.properties || {},+ required: mockTool.inputParameters?.required || [],+ additionalProperties: true,+ },+ strict: false,execute: expect.any(Function),});@@ -147,13 +153,25 @@ describe('OpenAIAgentsProvider', () => {expect(createOpenAIAgentTool).toHaveBeenCalledWith({name: mockTool.slug,description: mockTool.description,- parameters: expect.any(Object),+ parameters: {+ type: 'object',+ properties: mockTool.inputParameters?.properties || {},+ required: mockTool.inputParameters?.required || [],+ additionalProperties: true,+ },+ strict: false,execute: expect.any(Function),});expect(createOpenAIAgentTool).toHaveBeenCalledWith({name: anotherTool.slug,description: anotherTool.description,- parameters: expect.any(Object),+ parameters: {+ type: 'object',+ properties: anotherTool.inputParameters?.properties || {},+ required: anotherTool.inputParameters?.required || [],+ additionalProperties: true,+ },+ strict: false,execute: expect.any(Function),});});