Skip to content

fix(bedrock_mantle): stop dropping web search tools on /responses - #37375

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

fix(bedrock_mantle): stop dropping web search tools on /responses#37375
devin-ai-integration[bot] wants to merge 1 commit into
litellm_internal_stagingfrom
litellm_1787092214_mantle_web_search

Conversation

@devin-ai-integration

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

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • Mantle /responses accepts web_search, LiteLLM silently dropped it
  • Users got a plain answer with no search, no error
  • Cost map claimed no web search on Mantle models

How it solves it:

  • Keep every web_search* tool variant in the request
  • Still drop what Mantle rejects: file_search, image_generation, code_interpreter
  • Mark supports_web_search on the 5 Mantle models that accept it

User Flow

Before: a developer asking a Mantle model to search the web gets an answer from model memory, with no sign the tool was ignored

  1. They send POST https://litellm-domain/v1/responses with "model": "bedrock_mantle/openai.gpt-5.6-sol" and "tools": [{"type": "web_search"}]
  2. A 200 comes back, but the output has no web_search_call item, so the model answered without searching
  3. Nothing in the response says the tool was removed, so stale answers look like normal answers

After: the same request runs a real search server side

  1. They send the same POST https://litellm-domain/v1/responses with "tools": [{"type": "web_search"}]
  2. The 200 response now carries web_search_call items alongside the message, showing the queries the model ran
  3. bedrock_mantle/openai.gpt-5.6-sol reports supports_web_search: true on https://litellm-domain/model/info

Relevant issues

Linear ticket

Pre-Submission checklist

  • 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 LiteLLM proxy on localhost:4000 against real Bedrock Mantle (https://bedrock-mantle.us-east-1.api.aws, us-east-1), no mocks. Same config and same curl in both runs, only the checked out commit differs

Proxy config used in both runs (mantle_web_search_config.yaml):

model_list:
  - model_name: mantle-sol
    litellm_params:
      model: bedrock_mantle/openai.gpt-5.6-sol
      aws_region_name: us-east-1
      aws_access_key_id: os.environ/AWS_BEDROCK_MANTLE_ACCESS_KEY_ID
      aws_secret_access_key: os.environ/AWS_BEDROCK_MANTLE_SECRET_ACCESS_KEY

general_settings:
  master_key: sk-1234

Note on the search backend: our AWS test account's search egress returns 403, so each web_search_call item comes back with "status": "failed". The point of the before/after is that the tool now reaches Mantle and gets executed server-side at all, instead of being stripped by LiteLLM before the request leaves

Before (merge base 9c38d6d002cf663c41985be62b51bf3ebc5a9279)

  1. Start the proxy on the merge base commit
git worktree add /home/ubuntu/mantle_before 9c38d6d002cf663c41985be62b51bf3ebc5a9279
cd /home/ubuntu/mantle_before
uv run --no-sync litellm --config mantle_web_search_config.yaml --detailed_debug --port 4000
  1. Send a /v1/responses request with a web_search tool
curl -s -X POST http://localhost:4000/v1/responses \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer sk-1234' \
  -d '{"model":"mantle-sol","input":"Search the web: what is the newest LiteLLM release version?","tools":[{"type":"web_search"}]}'

HTTP 200, and the tool is gone. output has no web_search_call item and the echoed tools is empty:

{
  "id": "resp_sNzjXjEvdtXftPDKLPq8fFyVryJGZADM...",
  "model": "mantle-sol",
  "status": "completed",
  "tools": [],
  "output": [
    { "type": "reasoning", "id": "rs_6781c756d1e55ec69e58cc95b233663b" },
    { "type": "reasoning", "id": "rs_..." },
    { "type": "message", "role": "assistant", "content": [{ "type": "output_text",
      "text": "I can\u2019t access the live web from this environment, so I can\u2019t reliably identify the newest LiteLLM release.\n\nCheck the current version here:\n\n- PyPI: https://pypi.org/project/litellm/\n- GitHub releases: https://github.com/BerriAI/litellm/releases" }] }
  ]
}

output item types: ['reasoning', 'reasoning', 'message']

  1. The proxy log shows LiteLLM dropping it before the call
22:39:32 - LiteLLM:WARNING: transformation.py:119 - Bedrock Mantle Responses API: dropping unsupported tool type(s) ['web_search'] (supported: ['custom', 'function', 'mcp', 'namespace', 'tool_search']).

After (branch tip 4859f53bb0be6f30c96b051d1c2031c108320afe)

  1. Start the proxy on the PR branch, same config
cd /home/ubuntu/repos/litellm   # litellm_1787092214_mantle_web_search @ 4859f53bb0
LITELLM_LOCAL_MODEL_COST_MAP=True uv run --no-sync litellm --config mantle_web_search_config.yaml --detailed_debug --port 4000
  1. Same curl as before
curl -s -X POST http://localhost:4000/v1/responses \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer sk-1234' \
  -d '{"model":"mantle-sol","input":"Search the web: what is the newest LiteLLM release version?","tools":[{"type":"web_search"}]}'

HTTP 200, and Mantle now runs the search server-side: web_search_call items are present, with real action payloads, and the tool is echoed back in tools:

{
  "id": "resp_Gbx1Dc44LL0iHdJ5oLyJzjHc4tc...",
  "model": "mantle-sol",
  "status": "completed",
  "tools": [{ "type": "web_search", "filters": null, "search_context_size": null, "user_location": null }],
  "output": [
    { "type": "web_search_call", "id": "ws_19d7fe0b31be53d8871f475bb627ab8e", "status": "failed",
      "action": { "type": "search",
                  "query": "site:github.com/BerriAI/litellm releases latest LiteLLM",
                  "queries": ["site:github.com/BerriAI/litellm releases latest LiteLLM", "PyPI LiteLLM latest version"] } },
    { "type": "reasoning", "id": "rs_..." },
    { "type": "web_search_call", "id": "ws_6543216809535dc0bc1fae6cfb9b9e74", "status": "failed",
      "action": { "type": "open_page", "url": "https://api.github.com/repos/BerriAI/litellm/releases/latest" } },
    { "type": "reasoning", "id": "rs_..." },
    { "type": "message", "role": "assistant", "content": [{ "type": "output_text",
      "text": "I couldn\u2019t verify the newest LiteLLM release because web access returned a 403 error.\n\nYou can check the current version with:\n\n```bash\npip index versions litellm\n```" }] }
  ]
}

output item types: ['web_search_call', 'reasoning', 'web_search_call', 'reasoning', 'message'], and the proxy log has zero dropping unsupported tool type(s) lines for these requests. The "status": "failed" on each call is our account's search egress returning 403, not LiteLLM: the model itself says "web access returned a 403 error". An earlier identical run on the same tip produced three web_search_call items (search, then two open_page fetches of the GitHub releases URLs), same shape

  1. Unsupported tool types are still filtered instead of blowing up. image_generation still gets dropped, request still succeeds
curl -s -X POST http://localhost:4000/v1/responses \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer sk-1234' \
  -d '{"model":"mantle-sol","input":"Say hi in 3 words.","tools":[{"type":"image_generation"}]}'

HTTP 200, tools: [], output item types ['reasoning', 'message'] with text Hi there, friend!, and the log line:

22:56:37 - LiteLLM:WARNING: transformation.py:123 - Bedrock Mantle Responses API: dropping unsupported tool type(s) ['image_generation'] (supported: ['custom', 'function', 'mcp', 'namespace', 'tool_search']).

file_search also still returns HTTP 200 ({"type":"file_search","vector_store_ids":["vs_fake"]} -> status: completed, output item types ['file_search_call', 'message']), served by LiteLLM's emulated file-search handler rather than being sent to Mantle, so no Mantle 400

  1. The cost map change is visible on the proxy
curl -s http://localhost:4000/model/info -H 'Authorization: Bearer sk-1234'
model_name: mantle-sol | model: bedrock_mantle/openai.gpt-5.6-sol
supports_web_search: True

This needs LITELLM_LOCAL_MODEL_COST_MAP=True, otherwise the proxy pulls the published cost map from the network and reports supports_web_search: null until this PR's model_prices_and_context_window.json is released

Type

🐛 Bug Fix

Caveats (if any)

  • Chat Completions unchanged: Mantle rejects web_search there
  • Mantle's own error message omits web search from its supported list
  • Capability flags were set from live per-model probes, not AWS docs
  • Test account's search egress 403s, so calls run but fail

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/f751987e5dab49f7b560e50acd9927ee
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 18, 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 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR preserves web-search tools in Bedrock Mantle Responses requests and advertises that capability for five Mantle Responses models

  • Allows web_search-prefixed tools through Mantle Responses parameter filtering
  • Keeps unsupported file, image-generation, and code-interpreter tools filtered out
  • Synchronizes supports_web_search metadata across the primary and backup model maps
  • Adds direct parameter-mapping and request-transformation regression tests

Confidence Score: 4/5

The PR appears safe to merge, with one non-blocking regression-test gap for web-search tools supplied through additional_tools

The production change consistently preserves web-search tools across both filtering entry points, while tests cover the main request path but not the separate hoisting path

Files Needing Attention: tests/test_litellm/llms/bedrock_mantle/test_bedrock_mantle_responses_transformation.py

Important Files Changed

Filename Overview
litellm/llms/bedrock_mantle/responses/transformation.py Preserves web_search-prefixed tools in both ordinary and hoisted Mantle Responses tool filtering
model_prices_and_context_window.json Advertises web-search support for the five registered Bedrock Mantle Responses models
litellm/model_prices_and_context_window_backup.json Keeps backup model capability metadata synchronized with the canonical model map
tests/test_litellm/llms/bedrock_mantle/test_bedrock_mantle_responses_transformation.py Covers top-level web-search preservation and unsupported-tool removal but omits preservation through additional_tools hoisting

Reviews (1): Last reviewed commit: "feat(bedrock): support Mantle web search..." | Re-trigger Greptile

Comment on lines +583 to +585
@pytest.mark.parametrize(
"tool_type", ["file_search", "image_generation", "code_interpreter"]
)

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.

P2 Cover hoisted web-search preservation

The changed tests cover unsupported hoisted tools, but not web-search preservation, leaving this distinct transformation path without regression protection

Context Used: CLAUDE.md (source)

Knowledge Base Used: LLM Provider Adapters

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@codecov

codecov Bot commented Aug 18, 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 18, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_1787092214_mantle_web_search (4859f53) with litellm_internal_staging (852368d)1

Open in CodSpeed

Footnotes

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

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.

1 participant