Skip to content
TheChatArchiveThe Chat Archive
composer-2.5· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

Bedrock: strict=None auto-promotes many tools to strict and hits provider limit Initial…

  1. User

    Bedrock: strict=None auto-promotes many tools to strict and hits provider limit

    Initial Checks

    Description

    Summary

    pydantic-ai-slim==1.101.0 can now fail Bedrock Claude requests with many tools because ToolDefinition.strict=None is inferred as strict=True for simple schemas. Bedrock/Claude rejects requests with more than 20 strict tools (source):

     ValidationException: Too many strict tools (73). The maximum number of strict tools supported is 20.
    

    This is a behavior regression for callers that did not explicitly opt into strict tool definitions.

    What happened

    A production agent sends 73 function tools to Bedrock. Before 1.101.0 these tools were sent as normal, non-strict Bedrock tools.

    After 1.101.0, these tool definitions have strict=None, and the Bedrock schema transformer infers many/all simple schemas as strict-compatible. _customize_tool_def() then replaces strict=None with strict=True, and BedrockConverseModel._map_tool_definition() sends toolSpec.strict = true. Bedrock rejects the request because it only supports 20 strict tools.

    Disclosure: I authored #4237 ✋ . My tests and vcr cassettes didn't account for the >20-tool case.

    Expected behavior

    For Bedrock, strict=None should not silently turn large toolsets into strict toolsets that violate Bedrock limits.

    Possible fixes:

    Similar to Anthropic, do not auto-promote Bedrock tool definitions from strict=None to strict=True; only send toolSpec.strict = true when the user explicitly set strict=True.

    Workaround

    Callers can explicitly set strict=False on Bedrock tool definitions, but this requires every application with larger Bedrock toolsets to discover and patch the behavior.

    Minimal, Reproducible Example

    Logfire Trace

    No response

    Python, Pydantic AI & LLM client version

    • Python: 3.14
    • Pydantic AI: 1.101.0

    Interface

    No new interfaces are introduced.

  2. Assistant

    I'll investigate how Bedrock and Anthropic handle strict=None on tool definitions, then align Bedrock with the Anthropic behavior so large toolsets aren't auto-promoted to strict.

  3. Assistant

    Implementing the fix: aligning Bedrock with Anthropic so strict=None doesn't auto-promote tools to strict mode.

  4. Assistant

    Fixed the Bedrock regression where strict=None was auto-promoting tools to strict mode, which breaks requests with more than 20 tools.

    Root cause

    BedrockJsonSchemaTransformer treated strict=None as "auto-promote compatible schemas to strict." _customize_tool_def() then set strict=True on those tools, and _map_tool_definition() sent toolSpec.strict = true to Bedrock — hitting the 20 strict-tools limit.

    Fix

    Aligned Bedrock with the Anthropic pattern in BedrockJsonSchemaTransformer:

    1. is_strict_compatible = self.strict is True — only explicit strict=True is promoted
    2. Schema transformation only when strict is True — strict=None/strict=False only strip title/$schema, no additionalProperties: false injection

    strict=True still works as before for callers who opt in. NativeOutput is unaffected — Bedrock's prepare_request() still forces output_object.strict=True for structured output.

    Tests

    • Updated tests/providers/test_bedrock.py strict=None expectations
    • Added test_bedrock_many_tools_strict_none_not_auto_promoted verifying 25 tools with strict=None send no strict field

    All 23 strict-related Bedrock tests pass.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.