Skip to content

fix(bedrock_mantle): stop dropping the web_search tool on /v1/responses - #35987

Open
devin-ai-integration[bot] wants to merge 1 commit into
litellm_internal_stagingfrom
litellm_bedrock_mantle_web_search
Open

fix(bedrock_mantle): stop dropping the web_search tool on /v1/responses#35987
devin-ai-integration[bot] wants to merge 1 commit into
litellm_internal_stagingfrom
litellm_bedrock_mantle_web_search

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • Bedrock Web Search never ran through /v1/responses
  • bedrock_mantle silently dropped the web_search tool
  • Callers got ungrounded answers with no citations

How it solves it:

  • Allow web_search through the Mantle tool filter
  • Mark the GPT-5.4/5.5/5.6 Mantle entries as web search capable
  • Regression tests pin the tool surviving both entry paths

Relevant issues

Linear ticket

Resolves LIT-5224

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Live proxy against real Bedrock Mantle in us-east-1, same request both times, only the checked out commit differs

model_list:
  - model_name: bedrock-gpt-5-6-sol
    litellm_params:
      model: bedrock_mantle/openai.gpt-5.6-sol
      aws_access_key_id: os.environ/AWS_ACCESS_KEY_ID
      aws_secret_access_key: os.environ/AWS_SECRET_ACCESS_KEY
      aws_region_name: us-east-1

general_settings:
  master_key: sk-1234
python litellm/proxy/proxy_cli.py --config mantle.yaml --detailed_debug --port 4000

curl -sS -X POST http://localhost:4000/v1/responses \
  -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" \
  -d '{"model":"bedrock-gpt-5-6-sol","input":"What did AWS announce about Web Search on Amazon Bedrock on August 4 2026?","tools":[{"type":"web_search","external_web_access":false}]}'

Before, on litellm_internal_staging at 2a9843e649, HTTP 200 and an ungrounded answer:

output item types: ['reasoning', 'reasoning', 'message']
echoed tools: []
answer: August 4, 2026 has not occurred yet, so AWS has not made a verifiable announcement on that date.
        The year may be a typo, if you meant August 4, 2025 or have an AWS link, I can summarize the announcement.
citations: 0

with the proxy log confirming the drop:

18:05:30 - LiteLLM:WARNING: transformation.py:119 - Bedrock Mantle Responses API: dropping unsupported tool type(s) ['web_search'] (supported: ['custom', 'function', 'mcp', 'namespace', 'tool_search']).

After, on this branch at 26805f75fe, Bedrock runs the searches server side:

output item types: ['reasoning', 'web_search_call', 'reasoning', 'web_search_call', 'reasoning', 'web_search_call', 'reasoning', 'web_search_call', 'reasoning', 'message']
echoed tools: [{"type": "web_search", "filters": null, "search_context_size": null, "user_location": null}]
web_search_call: {"query": "AWS Web Search Amazon Bedrock August 4 2026", "type": "search", ...}
web_search_call: {"type": "open_page", "url": "https://aws.amazon.com/about-aws/whats-new/2026/08/amazon-bedrock-web-search/"}
answer: AWS announced the general availability of Web Search for Amazon Bedrock, enabling Bedrock-powered
        applications and agents to search the public web for current information and use the results,
        including source citations, in generated responses ...

and the outbound body keeps the tool with its option intact:

18:07:49 - LiteLLM:DEBUG: -d '{'model': 'openai.gpt-5.6-sol', 'input': 'What did AWS announce about Web Search on Amazon Bedrock on August 4 2026?', 'tools': [{'type': 'web_search', 'external_web_access': False}]}'

Only /v1/responses is in scope here, Bedrock exposes Web Search as a Responses built-in tool and bedrock_mantle gpt-5.x is Responses only

Type

🐛 Bug Fix

Changes

BedrockMantleResponsesAPIConfig filters the Responses tools array against an allowlist of tool types Mantle accepts, and web_search predates AWS shipping it, so map_openai_params dropped it before the request went out. Web Search on Amazon Bedrock went GA on 2026-08-04 as a server-side built-in tool on the OpenAI Responses path for GPT-5.4, GPT-5.5 and GPT-5.6 Sol/Terra/Luna, so the tool now stays in the payload with its external_web_access field untouched, both for a top-level tools entry and for one hoisted out of a Codex additional_tools input item

-_BEDROCK_MANTLE_SUPPORTED_RESPONSE_TOOL_TYPES = frozenset({"function", "mcp", "custom", "namespace", "tool_search"})
+_BEDROCK_MANTLE_SUPPORTED_RESPONSE_TOOL_TYPES: Final = frozenset(
+    {"function", "mcp", "custom", "namespace", "tool_search", "web_search"}
+)

The five GPT entries in the cost map also gain supports_web_search: true so litellm.supports_web_search() and the router's web-search-aware filtering see the capability. Nothing else in the Mantle lineup gets the flag, since AWS scopes Web Search to those models

Four existing tests used web_search as their stand-in for an unsupported tool type, so they now use file_search, which Mantle really does reject and which this config already declares unsupported

Not in this PR: cost tracking for the searches AWS bills at $12 per 1,000 queries. The run above issued four web_search_call items in one response, and the generic built-in tool path prices a response off search_context_cost_per_query once, not per query, so metering this properly needs its own change

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

Link to Devin session: https://app.devin.ai/sessions/56ac33bc3eb44a15a96c7022683ff161
Requested by: @mateo-berri

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@mateo-berri mateo-berri self-assigned this Aug 5, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@greptile-apps

greptile-apps Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR enables Bedrock Mantle web search on the Responses API and advertises that capability for five GPT models.

  • Adds web_search to Mantle’s forwarded Responses tool types.
  • Adds supports_web_search metadata for GPT-5.4, GPT-5.5, and GPT-5.6 Sol/Terra/Luna in both model maps.
  • Adds regression coverage for direct and Codex-hoisted web-search tools.

Confidence Score: 4/5

The model-specific forwarding gap should be fixed before merging because unsupported Mantle models can now receive web-search tools.

The transformation promotes web_search into a provider-wide allowlist even though the accompanying metadata and PR contract restrict support to five models, and no model-level capability check occurs before forwarding.

Files Needing Attention: litellm/llms/bedrock_mantle/responses/transformation.py

Important Files Changed

Filename Overview
litellm/llms/bedrock_mantle/responses/transformation.py Enables web_search globally in the Mantle adapter, but does not restrict forwarding to models whose metadata advertises the capability.
model_prices_and_context_window.json Correctly advertises web-search support on the five intended Mantle GPT entries.
litellm/model_prices_and_context_window_backup.json Mirrors the capability metadata changes in the packaged fallback model map.
tests/test_litellm/llms/bedrock_mantle/test_bedrock_mantle_responses_transformation.py Covers supported models and both forwarding paths, but does not cover retaining rejection for a Responses-capable unsupported model.

Reviews (1): Last reviewed commit: "fix(bedrock_mantle): stop dropping the w..." | Re-trigger Greptile

Comment on lines +47 to +49
_BEDROCK_MANTLE_SUPPORTED_RESPONSE_TOOL_TYPES: Final = frozenset(
{"function", "mcp", "custom", "namespace", "tool_search", "web_search"}
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Web search bypasses model capability

When a Responses-capable Mantle model outside the five flagged GPT models receives a web_search tool, this provider-wide allowlist forwards it without checking supports_web_search, causing Mantle to reject the unsupported request instead of filtering the tool.

Rule Used: What: Do not hardcode model-specific flags in the ... (source)

Knowledge Base Used: LLM Provider Adapters

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried that: the remote cost map lags releases, so gating on supports_web_search silently disabled Web Search live. Mantle itself 400s with "Tool type 'web_search' is not supported for model".

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a fair point. The failure mode split here is:

  • Gating on supports_web_search: cost-map lag silently drops web_search on newly-supported models until the JSON is updated — same broken-but-quiet behavior as before this PR.
  • Allowlist approach (this PR): unsupported Mantle models get an explicit 400 from the server, which is noisier but honest.

A server-side 400 is strictly better UX than an ungrounded answer with no error, so the trade-off is reasonable.

I withdraw the concern.

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed-hq

codspeed-hq Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_bedrock_mantle_web_search (26805f7) with litellm_internal_staging (2792887)1

Open in CodSpeed

Footnotes

  1. No successful run was found on litellm_internal_staging (332ec6c) during the generation of this report, so 2792887 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@CLAassistant

CLAassistant commented Aug 6, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@devin-ai-integration
devin-ai-integration Bot force-pushed the litellm_bedrock_mantle_web_search branch from c50debd to 26805f7 Compare August 6, 2026 18:52
@pseudorm

Copy link
Copy Markdown

@mateo-berri curious on any ETA on when this PR will be merged?

@kalynnrhew77

Copy link
Copy Markdown

@mateo-berri curious on any ETA on when this PR will be merged?

^ My team wants to use Litellm but we are waiting for this change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants