AgentCore Web Search: Ground AI Agents, No API Keys
Amazon Bedrock AgentCore Web Search grounds AI agents in live web data via one MCP connector; no search API keys, zero egress from AWS. Here's how to wire it in.
Give Your AI Agents Live Web Knowledge with Amazon Bedrock AgentCore Web Search
Every agent you build ships with the same blind spot: its knowledge is frozen at training time. Ask it for today's stock price, last night's game score, or a release that dropped an hour ago, and it either guesses or admits defeat. The usual fix — bolt on a third-party search API — drags in API keys, rate limits, inconsistent result formats, snippet-parsing glue, and an awkward conversation with your security team about where customer queries actually go.
Web Search on Amazon Bedrock AgentCore, now generally available, collapses all of that into a single managed connector. Your agent gets current, cited web knowledge over the Model Context Protocol (MCP) — no search infrastructure to run, and queries never leave AWS. Let's look at what makes it different and how to wire it in.
What You're Actually Getting
This isn't a thin wrapper around someone else's search engine. Behind the connector sits a web index Amazon operates directly, and the design choices matter for agent accuracy:
- A purpose-built index spanning tens of billions of documents. Broad coverage means the long-tail question — an obscure library, a niche product spec — gets a real answer instead of a shrug.
- Refreshed within minutes. When your agent searches "what happened today," the results reflect what actually happened today. That recency window is the difference between grounded and confidently wrong.
- A built-in knowledge graph. For factual queries (who holds a role, when something was founded), the graph returns high-confidence facts instead of leaving the model to infer them from page text — cutting the subtle drift that creeps in when an agent stitches together snippets.
- Semantic snippet extraction. Instead of dumping raw HTML into the context window, the tool pulls the passages that bear on the query, tuned for a model's context. Fewer tokens on navigation chrome, more on what matters.
And the part that unblocks enterprise rollouts: queries don't leave AWS. The Gateway authenticates to an AWS-owned connector and routes the request internally, so there's no third-party egress to review. For teams with data-residency requirements, that removes an entire category of security sign-off.
Wiring It In: Three Moving Parts
Adding web search comes down to attaching a tool target to an AgentCore Gateway with
connectorId: "web-search" . The Gateway snapshots the tool schema, provisions the integration, and handles endpoint resolution and service auth for you.python
import boto3
gateway_client = boto3.client("bedrock-agentcore-control", region_name="us-east-1")
gateway_client.create_gateway_target( gatewayIdentifier=gateway_id, # your existing or new Gateway ID name="web-search-tool", targetConfiguration={ "mcp": { "connector": { "source": {"connectorId": "web-search"}, "configurations": [{"name": "WebSearch", "parameterValues": {}}], } } }, credentialProviderConfigurations=[ {"credentialProviderType": "GATEWAY_IAM_ROLE"} ],)That
GATEWAY_IAM_ROLE line is the whole outbound-auth story. Instead of you managing search API keys, the Gateway authenticates to the Web Search backend with its own IAM role. That role needs just two actions — bedrock-agentcore:InvokeGateway on your Gateway, and bedrock-agentcore:InvokeWebSearch on the AWS-owned tool ARN:json
{ "Effect": "Allow", "Action": "bedrock-agentcore:InvokeWebSearch", "Resource": "arn:aws:bedrock-agentcore:us-east-1:aws:tool/web-search.v1"}Note the resource account is
aws , not yours — authorization is enforced per invocation against that ARN. Two boundaries worth keeping straight: this role is for outbound auth only (inbound "who can call my Gateway" is handled separately, typically a Cognito JWT authorizer), and it deliberately does not include bedrock:InvokeModel — model access belongs to whatever identity runs your agent.Calling It from an Agent
Because the tool is exposed over MCP, any MCP-compatible framework — Strands, LangChain, LangGraph, CrewAI — discovers it with a standard
tools/list call and invokes it automatically when it needs fresh information. No tool-specific code on your side:python
from datetime import datefrom strands import Agentfrom strands.models.bedrock import BedrockModelfrom strands.tools.mcp import MCPClientfrom mcp_proxy_for_aws.client import aws_iam_streamablehttp_client
gateway_url = "https://gateway-<id>.gateway.bedrock-agentcore.us-east-1.amazonaws.com/mcp"
mcp_client = MCPClient(lambda: aws_iam_streamablehttp_client( endpoint=gateway_url, aws_region="us-east-1", aws_service="bedrock-agentcore",))
model = BedrockModel(model_id="us.anthropic.claude-sonnet-4-6")system_prompt = ( f"You are a helpful assistant. Today's date is {date.today().isoformat()}. " "Use the available tools when you need current information.")
with mcp_client: tools = mcp_client.list_tools_sync() # WebSearch discovered from the Gateway agent = Agent(model=model, tools=tools, system_prompt=system_prompt) print(agent("What are the latest AI breakthroughs announced this week?"))Results come back in the standard MCP envelope: a JSON
results array where each web observation carries title , url , publishedDate , and text . Knowledge-graph observations arrive with null title / url and structured facts in text . The agent composes a grounded, cited response from those on its own.Where It Fits — and What It Costs
Web Search is the complement to Amazon Bedrock Knowledge Bases, not a replacement. Knowledge Bases ground agents in your data ("what do our documents say"); Web Search grounds them in the public web ("what's true in the world right now"). Plenty of production agents run both.
Pricing is pay-as-you-go at $7 per 1,000 queries — under a cent per question. It's available today in
us-east-1 (US East, N. Virginia), and because Amazon operates the full stack, improvements to freshness, coverage, and relevance flow to your agents automatically through the same connector — no version upgrades on your end. Just remember the Gateway and Web Search invocations are billable, so clean up any resources you spin up to test.Over to You
Stale knowledge and hallucinated "facts" are the two complaints that kill trust in an agent fastest, and grounding is the fix for both. So I'm curious: would you reach for AgentCore Web Search as your default grounding layer, or pair it with a private Knowledge Base for a hybrid "web + our docs" setup? And what's the first agent you'd retrofit with live search? Drop your approach in the comments.
#AWS #Bedrock #AgentCore #AIAgents #GenAI #MCP #WebSearch #MachineLearning
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article