AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Responses API Tool Strict Mode Defaults To True, Breaking Non-Strict Schemas

When langchain-openai switches from Chat Completions API to Responses API (e.g., due to reasoning parameters), tools without an explicit 'strict' field inherit the Responses API default of strict=true, causing the model to misinterpret JSON Schema constraints like 'pattern' and generate invalid tool arguments.

highConfidence 95%Langchain-OpenaiChat ModelsAgentslangchain-coreAffected V1.1.9

Origin Analysis

In `_construct_responses_api_payload`, the conversion `new_tools.append({"type": "function", **tool["function"]})` copies tool definitions verbatim. Omitting 'strict' in a Chat Completions tool means non-strict behavior, but the Responses API interprets the absence as strict=true, silently flipping the semantics.
1. Define a StructuredTool with a field that uses a JSON Schema 'pattern' (e.g., fieldSelector with regex). 2. Instantiate ChatOpenAI with model='gpt-5' and reasoning_effort='high' to trigger the Responses API path. 3. Call bind_tools([tool]) without specifying strict. 4. Observe that the model treats the regex pattern as a literal string value instead of generating a matching value.

Fixing Code Block

Edge Case Audit

This fix only applies when 'strict' is absent; if a user explicitly sets strict=True for a Responses API call, it will remain intact. Setting strict=False may disable validation that some users might unknowingly rely on when using the Responses API with reasoning, but it aligns with Chat Completions behavior. If OpenAI changes the default for Responses API in the future, this hardcoded default may need adjustment. Rollback: revert this change and explicitly pass strict=True/False on a per-tool basis if issues arise.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state