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
docs(strict-mode): correct provider support details
jkomynof37c6fbec3ad
diff --git a/docs/content/docs/providers/openai.mdx b/docs/content/docs/providers/openai.mdxindex 4c2b09825..4b5484978 100644--- a/docs/content/docs/providers/openai.mdx+++ b/docs/content/docs/providers/openai.mdx@@ -406,9 +406,17 @@ The OpenAI integration ships three providers, one per API surface:- **`OpenAIProvider`** for the Chat Completions API. This is the SDK default, so `new Composio()` with no provider uses it. You keep the full message list and append each assistant message plus its `tool` results yourself.- **`OpenAIAgentsProvider`** for the Agents SDK. Tools come with execution wired in, so the SDK runs the loop for you.-**Strict mode.** Pass `strict: true` or `strict=True` to `OpenAIResponsesProvider`, or pass `strict: true` to `OpenAIAgentsProvider`, to normalize each tool's input schema for [structured outputs](https://platform.openai.com/docs/guides/structured-outputs). Every object lists all of its properties in `required` and is closed, while optional properties stay available but accept `null`. A `null` is dropped before the tool runs unless the tool's own schema accepts `null` for that parameter. Tools whose schema strict mode cannot express, such as objects that accept arbitrary keys, `allOf`, `prefixItems`, or unresolved `$ref`s, are sent without strict mode and log a warning.+**Strict mode.** Pass `strict: true` or `strict=True` to `OpenAIResponsesProvider`, or pass `strict: true` to the TypeScript `OpenAIAgentsProvider`, to normalize each tool's input schema for [structured outputs](https://platform.openai.com/docs/guides/structured-outputs). The Python Agents SDK provider does not support strict mode yet. Every object lists all of its properties in `required` and is closed, while optional properties stay available but accept `null`. A `null` is dropped before the tool runs unless the tool's own schema accepts `null` for that parameter. Tools whose schema strict mode cannot express, such as objects that accept arbitrary keys, `allOf`, `prefixItems`, or unresolved `$ref`s, are sent without strict mode and log a warning.-<Tabs items={["TypeScript", "Python"]}>+<Tabs groupId="language" items={["Python", "TypeScript"]} persist>+<Tab value="Python">+```python+from composio import Composio+from composio_openai import OpenAIResponsesProvider++composio = Composio(provider=OpenAIResponsesProvider(strict=True))+```+</Tab><Tab value="TypeScript">```typescript// @noErrors@@ -420,14 +428,6 @@ const composio = new Composio({});```</Tab>-<Tab value="Python">-```python-from composio import Composio-from composio_openai import OpenAIResponsesProvider--composio = Composio(provider=OpenAIResponsesProvider(strict=True))-```-</Tab></Tabs><Callout type="info">diff --git a/python/composio/core/provider/_openai_responses.py b/python/composio/core/provider/_openai_responses.pyindex 1f4a53ec9..ad2290b60 100644--- a/python/composio/core/provider/_openai_responses.py+++ b/python/composio/core/provider/_openai_responses.py@@ -43,15 +43,15 @@ class OpenAIResponsesProvider(:param strict: Emit wrapped tools with ``strict: true`` and normalizetheir parameter schemas for OpenAI structured outputs (every objectfully required and closed, optional properties widened to accept- ``null``, ``$ref``/``$defs`` inlined). Mirrors the TypeScript+ ``null``, local ``$ref``/``$defs`` kept). Mirrors the TypeScript``OpenAIResponsesProvider({ strict })`` option. Defaults to``False``."""super().__init__(**kwargs)self.strict = strict- # Dereferenced parameter schemas of the tools wrapped under strict- # mode, keyed by slug, so tool-call arguments can be reconciled- # against the schema the model actually saw.+ # Parameter schemas of the tools wrapped under strict mode, keyed by+ # slug, so tool-call arguments can be reconciled against the schema+ # the model actually saw.self._strict_input_schemas: dict[str, dict[str, t.Any]] = {}def wrap_tool(self, tool: Tool) -> ResponsesTool:diff --git a/python/composio/utils/strict_schema.py b/python/composio/utils/strict_schema.pyindex 48a7a453f..86c98f4a6 100644--- a/python/composio/utils/strict_schema.py+++ b/python/composio/utils/strict_schema.py@@ -360,10 +360,11 @@ def to_strict_json_schema(schema: t.Any) -> StrictJsonSchemaResult:Applies the strict contract at every depth: every object lists all of itsproperties in ``required`` and is closed; optional properties are widenedto accept ``null`` instead of being dropped; ``oneOf`` becomes ``anyOf``;- ``default`` and ``examples`` are stripped; internal ``$ref`` pointers are- inlined first and ``required`` arrays are de-duplicated last. Constructs- strict mode cannot express are listed in ``unsupported``; when that list- is non-empty the returned ``schema`` must not be sent as strict.+ ``default`` and ``examples`` are stripped; local ``$ref`` pointers into+ ``$defs`` or ``definitions`` are kept and the definitions are normalized+ where they are declared; ``required`` arrays are de-duplicated last.+ Constructs strict mode cannot express are listed in ``unsupported``; when+ that list is non-empty the returned ``schema`` must not be sent as strict.:param schema: The JSON schema to normalize; never mutated.:return: A :class:`StrictJsonSchemaResult`.diff --git a/ts/packages/providers/openai/src/OpenAIResponsesProvider.ts b/ts/packages/providers/openai/src/OpenAIResponsesProvider.tsindex ea540229f..66adf58fd 100644--- a/ts/packages/providers/openai/src/OpenAIResponsesProvider.ts+++ b/ts/packages/providers/openai/src/OpenAIResponsesProvider.ts@@ -55,9 +55,9 @@ export class OpenAIResponsesProvider extends BaseNonAgenticProvider<readonly name = 'openai';private strict: boolean | null;/**- * Dereferenced parameter schemas of the tools wrapped under strict mode,- * keyed by slug, so tool-call arguments can be reconciled against the- * schema the model actually saw.+ * Parameter schemas of the tools wrapped under strict mode, keyed by slug,+ * so tool-call arguments can be reconciled against the schema the model+ * actually saw.*/private readonly strictInputSchemas = new Map<string, Record<string, unknown>>();