Solve: ValidationException web_search Not Supported in Bedrock Claude Tool Calls



Solve:  ValidationException web_search Not Supported in Bedrock Claude Tool Calls







Problem

When developers try to invoke Claude's newer tools (like web_search_20250305) through Amazon Bedrock, the request fails with a ValidationException. This happens even when the JSON structure is correct and the model is compatible.


Clarifying the Issue

Anthropic’s Claude 3 models recently introduced new tools such as web_search_20250305 and code_execution_20250305. These are available via the Anthropic API, but Bedrock hasn’t yet added support for these tool types. As a result, any tool request using these identifiers is blocked before it ever reaches the Claude model.

The error appears like this: 

Bash
ValidationException: tool type 'web_search_20250305' is not supported

This is not a developer mistake—the tooling is correct. It’s simply a matter of Bedrock not allowing certain tool tags (yet).


Why It Matters

For many use cases—especially those involving fresh web data, LLM-powered code interpreters, or real-time external actions—these new Claude tools are essential. If you're building a workflow or integration inside AWS, it’s important to understand that Bedrock's Claude integration lags behind what Anthropic supports natively. Without a workaround, you're stuck waiting.


Key Terms
  • Bedrock – AWS’s managed service for foundation models like Claude, Titan, and others
  • Anthropic API – The direct API interface for Claude, offering the newest features
  • Tool Type – The identifier used to request specific Claude capabilities, such as web_search_20250305
  • ValidationException – A pre-flight rejection from Bedrock’s request validator, not Claude itself


Steps at a Glance
  1. Understand that Bedrock does not support web_search_20250305 or code_execution_20250305.
  2. Use the direct Anthropic API to access these features.
  3. Authenticate with your Anthropic API key.
  4. Send a properly structured message with the tool declaration.
  5. Handle the response using standard Claude 3 output formats.


Detailed Steps

Here’s a complete Python example using requests to invoke the web search tool directly from Anthropic:

Bash
import requests
import os

# Your Claude API key from Anthropic
ANTHROPIC_API_KEY = os.getenv("ANTHROPIC_API_KEY", "sk-ant-api-key-goes-here")

headers = {
    "x-api-key": ANTHROPIC_API_KEY,
    "anthropic-version": "2023-06-01",
    "content-type": "application/json"
}

data = {
    "model": "claude-3-sonnet-20240229",
    "max_tokens": 512,
    "temperature": 0.5,
    "top_p": 0.9,
    "messages": [
        {
            "role": "user",
            "content": "What's the latest on the Boeing Starliner launch?"
        }
    ],
    "tools": [
        {
            "type": "web_search_20250305",
            "name": "web_search",
            "description": "Search the web for recent information.",
            "input_schema": {
                "type": "object",
                "properties": {
                    "query": {"type": "string"}
                },
                "required": ["query"]
            }
        }
    ]
}

response = requests.post(
    "https://api.anthropic.com/v1/messages",
    headers=headers,
    json=data
)

print("Response:", response.status_code)
print("Body:", response.json())

This will yield Claude’s response based on a live web search—without needing to wait for AWS to catch up.



Conclusion

If you're encountering ValidationException errors when using Claude tool types like web_search_20250305 on AWS Bedrock, you're not alone. This is a limitation in Bedrock’s rollout, not a bug in your code. Until support is added, the best path forward is to call the Anthropic API directly using the tool definitions described above.

If you’re building AWS-native apps, this workaround will help you stay current while keeping your broader integration strategy intact. Keep an eye on AWS updates—and we’ll update this guide when Bedrock support becomes available. 



Need AWS Expertise?

We'd love to help you with your AWS projects.  Feel free to reach out to us at info@pacificw.com.


Written by Aaron Rose, software engineer and technology writer at Tech-Reader.blog.

Comments

Popular posts from this blog

The New ChatGPT Reason Feature: What It Is and Why You Should Use It

Raspberry Pi Connect vs. RealVNC: A Comprehensive Comparison

Running AI Models on Raspberry Pi 5 (8GB RAM): What Works and What Doesn't