16.07, Webinar Securing AI Agents: where threats hide in agentic systems
15 min read

Supercharge your Amazon Bedrock agents with Tavily search

A practical guide on how to add real-time web search results to your agentic AI built on Amazon Bedrock.



As AI engineers, we’ve all faced the same frustrating limitation: our LLMs are frozen in time, unable to access current information or verify recent facts. Whether it’s hallucinations on complex queries or simply being unaware of events that happened after their training cutoff, these limitations can severely restrict the practical applications of our AI agents.

I recently discovered a game-changing solution that transformed how we build AI agents. After struggling with traditional search APIs in our production environment, we switched to Tavily — a search engine built specifically for LLMs — and the results were remarkable. The integration was so successful that I want to share our experience.

In this guide, I’ll walk you through exactly how to supercharge your Amazon Bedrock agents with Tavily web search, complete with practical examples and lessons learned from production deployment.

Why LLMs need real-time data access

Before diving into the solution, let’s address the elephant in the room: why do even the most advanced LLMs struggle without web search capabilities?

  1. The knowledge cutoff problem

    Every LLM has a training cutoff date — a point in time after which it has no knowledge of world events. This means your AI agent can’t tell you today’s weather, current stock prices, recent product releases, or even who won last night’s game. Whether it’s breaking news, updated documentation, or simply checking if a service is currently online, LLMs are blind to anything that happened after their training. They’ll either admit they don’t know, or worse — confidently provide outdated information.

  2. Hallucinations and uncertainty

    When LLMs lack information, they don’t always admit it. Instead, they might:

    • Generate plausible-sounding but incorrect information
    • Mix outdated facts with speculation
    • Provide confident answers based on patterns rather than facts

Why traditional search APIs fall short

You might think, “I’ll just integrate Google Search API.” We tried that. Here’s why it didn’t work:

Enter Tavily: search built for AI

Tavily isn’t just another search engine — it’s a search infrastructure designed from the ground up to feed LLMs. Here’s what makes it special:

Beyond the API, Tavily offers a keyless access mode for instant Search and Extract with zero setup and also publishes its documentation in agent-readable Markdown format (append .md to any docs URL), so your agent can self-configure — even set up its own MCP server.

Hands-on: exploring the Tavily playground

Let’s start by exploring what Tavily can do through its interactive playground. This is the best way to understand its capabilities before writing any code.

Getting started

First, head to tavily.com and sign up for a free account (you get 1,000 API credits monthly — more than enough for experimentation).

Tavily playground interface

The Tavily playground lets you test searches, extracts, and crawls right from your browser.

Once logged in, you’ll see the API playground with four main modes:

  1. Search: The primary mode for web searching
  2. Extract: For pulling data from specific URLs
  3. Crawl: For systematically exploring websites
  4. Research: For the comprehensive exploration of a particular topic

Your first search

Let’s try a practical example. In the search box, enter: “What are the most recent news about Amazon Bedrock?

Tavily search results in JSON format

Hit send, and you’ll see the results in a structured JSON format:

{  "query": "What are the most recent news about Amazon Bedrock?",  "follow_up_questions": null,  "answer": "Amazon Bedrock now offers access to advanced foundation models from OpenAI and includes new guardrails for responsible AI implementation.",  "images": [],  "results": [    {      "url": "https://aws.amazon.com/blogs/aws/category/featured/",      "title": "Featured | AWS News Blog",      "content": "AWS continues to expand access to the most advanced foundation models with OpenAI open weight models now available in Amazon Bedrock and Amazon SageMaker",      "score": 0.66229486,      "raw_content": null    },    {      "url": "https://aws.amazon.com/blogs/aws/author/danilop/",      "title": "Danilo Poccia | AWS News Blog",      "content": "AWS continues to expand access to the most advanced foundation models with OpenAI open weight models now available in Amazon Bedrock and Amazon SageMaker",      "score": 0.6410185,      "raw_content": null    },    {      "url": "https://aws.amazon.com/blogs/aws/category/artificial-intelligence/amazon-machine-learning/amazon-bedrock/amazon-bedrock-guardrails/",      "title": "Amazon Bedrock Guardrails | AWS News Blog",      "content": "Amazon Bedrock Guardrails introduces enhanced capabilities to help enterprises implement responsible AI at scale, including multimodal toxicity detection, PII",      "score": 0.6320719,      "raw_content": null    }  ],  "response_time": 1.59,  "request_id": "3b3d9613-9a54-4ae4-b39d-378b66cac25c"}

Tavily returns clean, structured JSON with relevance scores.

Notice how the results are:

Advanced search parameters

Under Additional fields, Tavily offers several powerful parameters to fine-tune your searches. The key ones to know are:

Search depth

Max results

Time range

Include answer

The magic of include_answer

The “Include answer” feature is what truly sets Tavily apart. When you enable include_answer, Tavily doesn’t just return search results — it generates a coherent LLM-powered summary of all the sources it found.

For example, when querying about Amazon Bedrock’s latest updates with include_answer set to basic, Tavily returned: “Amazon Bedrock now offers access to advanced foundation models from OpenAI and includes new guardrails for responsible AI implementation.” This was information from just days — completely beyond any LLM’s training data.

Tip:

This AI-generated summary doesn’t cost any additional API credits. You’re essentially getting a free, context-aware summarization on top of your search results. This feature alone can eliminate an entire LLM call from your pipeline, reducing both latency and costs.

Building your first Tavily-powered agent

Now that you understand Tavily’s capabilities, let’s build an intelligent agent that knows when and how to use web search.

Architecture overview

We’ll create an agent using:

The key insight: our agent should be smart enough to decide when web search is necessary. Not every query needs real-time data!

Setting up the environment

First, install the required packages:

pip install langgraph langchain langchain-aws tavily-python

Setup your environment variable. If you’re working with script from below, create a .env file with your Tavily API key:

TAVILY_API_KEY=your_api_key_here

Quick-start alternative: Tavily also supports keyless access — just add the X-Tavily-Access-Mode: keyless header to your requests and skip the API key entirely. Responses are identical; upgrade to a key only when you need higher limits.

Then login into your AWS account through CLI and ensure you have the necessary permissions to access Bedrock.

Complete implementation

Here’s the full code for creating your Tavily-powered agent:

agent.pypython
import osimport dotenvfrom langgraph.prebuilt import create_react_agentfrom langchain_tavily import TavilySearchfrom langchain_core.messages.ai import AIMessagefrom langchain_aws import ChatBedrockdotenv.load_dotenv()# Set your Tavily API keyos.environ["TAVILY_API_KEY"] = os.getenv("TAVILY_API_KEY")# 1. Define the Tavily search tooltavily_search_tool = TavilySearch(    max_results=3,    topic="general",    verbose=True,    time_range="week")# 2. Connect to Bedrock LLM (e.g. Claude 3 Haiku)llm = ChatBedrock(    model_id="anthropic.claude-3-haiku-20240307-v1:0",  # or any other available Bedrock model    model_kwargs={"temperature": 0.2},)# 3. Create the agent using LangGraph's create_react_agentagent = create_react_agent(llm, [tavily_search_tool])# 4. Run the agent with a question (streaming)while True:    user_input = input("\nYou: ")    if user_input == "q":        break    for step in agent.stream({"messages": user_input}, stream_mode="values"):        if isinstance(step["messages"][-1], AIMessage):            if step["messages"][-1].tool_calls:                for tool_call in step["messages"][-1].tool_calls:                    print(f"\nTool: {tool_call['name']}, Args: {tool_call['args']}")            else:                print(f"\nAI: {step['messages'][-1].content}")

Testing your agent

Let’s run the agent script and see how it handles different types of queries:

Query 1: Simple greeting

You: Hi, how are you?AI: Hello! As an AI assistant, I don't have personal experiences or feelings, but I'mfunctioning properly and ready to help you with any questions or tasks you may have.How can I assist you today?

Note: No tool use — the agent correctly identifies this doesn't need web search.

Query 2: Current information

You: Who is the president of Poland?Tool: tavily_search, Args: {'query': 'president of poland'}  content='{"query": "president of poland", "follow_up_questions": null, "answer": null,  "results": [    {"url": "https://www.reuters.com/world/europe/poland-s-new-president-draws-battlelines...",     "title": "Poland\'s new president draws battlelines with government over ...",     "content": "New Polish President Karol Nawrocki vowed on Wednesday to change...",     "score": 0.98506, "raw_content": null},    {"url": "https://www.theguardian.com/world/2025/aug/06/nationalist-karol-nawrocki-...",     "title": "Polish president attacks rivals\' \'propaganda and lies\' as he is sworn in",     "content": "Combative speech in parliament sets Karol Nawrocki on course for ...",     "score": 0.98198, "raw_content": null},    {"url": "https://www.politico.eu/article/new-polish-president-karol-nawrocki-...",     "title": "New Polish president begins his term clashing with PM Donald Tusk",     "content": "Karol Nawrocki becomes president of a deeply divided nation ...",     "score": 0.97666, "raw_content": null}  ], "response_time": 1.02}'  tool_call_AI: Based on the search results, the current president of Poland is Karol Nawrocki. He wasrecently elected in 2025 and has already begun clashing with the pro-European governmentled by Prime Minister Donald Tusk. The results indicate that Nawrocki is a nationalistleader who plans to change Poland's constitution to protect its sovereignty, putting himat odds with the more liberal Tusk administration.

Note: The agent recognizes this requires current information and automatically searches.

The proof: without Tavily vs. with Tavily

To really drive home the difference, let’s now disable Tavily. Delete it from the agent’s tool list.

agent_no_search.pypython
agent = create_react_agent(llm, [])

Now, let’s run the same query again.

You: Who is the president of Poland?AI: The current president of Poland is Andrzej Duda. He has been the president of Polandsince 2015.Some key facts about the president of Poland:- Name: Andrzej Duda- Took office: August 6, 2015- Political party: Law and Justice (PiS)- Previous positions: Member of the European Parliament (2014), Member of the Sejm  (lower house of parliament) (2005-2015)Poland has a semi-presidential system, where the president is the head of state but theprime minister is the head of government. The president's main roles include representingthe country, signing legislation, and appointing some government officials.

The agent provides information from its training data, missing up-to-date knowledge. This is exactly the problem Tavily solves.

Production lessons

After deploying Tavily in production at Chaos Gears, here are the key insights that will save you time and money:

1. The free LLM answer is gold

The most surprising discovery: Tavily’s LLM-generated answers don’t cost extra credits. This means you can:

Tip:

Consider using Tavily as a standalone Q&A service for some use cases — you might not even need to process the results further!

2. Basic search depth is usually enough

After extensive testing, we found:

Tip:

Start with basic search and only upgrade to advanced for specific, validated use cases.

3. Stick with the “General” search topic

Tavily offers three search topics: General, Financial, News.

Despite our initial assumptions, the “General” topic consistently provided the best results, even for news queries. The specialized topics occasionally missed relevant content that the general search found, wrongly narrowing the sources.

4. The managed solution advantage

Switching from Google Search API to Tavily reduced our development time from months to days. Why?

Performance optimization tips

Token management

Cost optimization

Domain and source control

The Search → Extract pattern

For grounded answers, use a two-step flow: Search to discover relevant URLs, then Extract to pull the full cleaned content from those pages. This gives your agent richer context than search snippets alone.

When to use Research over Search

The /research endpoint performs multi-angle investigation and returns cited synthesis in your choice of citation format. Use it when your agent needs a decision-ready report rather than an overview of available sources.

The future of AI-powered search

We’re witnessing a fundamental transformation in how humans interact with information. This isn’t just an incremental improvement — it’s a complete paradigm shift that’s as significant as the move from libraries to search engines. You ask a question in natural language, and within seconds you get a comprehensive, accurate answer backed by current sources. No clicking, no scanning, no ads. Just the information you need, when you need it.

What makes this shift so powerful is the conversational nature. You can:

Your AI agent becomes a research assistant that never gets tired, can process hundreds of sources in seconds, and always provides citations for verification. It’s not replacing human judgment — it’s augmenting human capability in ways we’re only beginning to explore.

Challenges to consider

Of course, this transformation brings new questions we need to address:

Trust and verification: How do we ensure AI-summarized information remains accurate and unbiased? Who decides what sources are authoritative?

The Economics of information: If users never visit websites directly, how do content creators sustain their work? Will we see new models emerge where AI providers compensate original sources?

Manipulation risks: As AI becomes the primary interface to information, the incentive to influence these systems grows. Will we see SEO-style optimization attempts for AI search results?

These are important considerations, but they shouldn’t overshadow the incredible potential. Every major technological shift brings challenges — what matters is that we’re building something that makes information more accessible, research more efficient, and knowledge more actionable than ever before.

Your next steps

AI agents need real-time, reliable data to reach their full potential. Tavily provides the missing piece — web search designed specifically for LLMs. The integration is simple, the results are impressive, and the impact on your agents’ capabilities is transformative.

Ready to get started?

  1. Sign up for Tavily: Get your free API key (1,000 credits/month)
  2. Explore the playground: Test queries relevant to your use case
  3. Build a prototype: Use the code from this guide as your starting point
  4. Iterate and optimize: Apply the production lessons to your specific needs

The combination of Amazon Bedrock’s powerful models, LangGraph’s elegant orchestration, and Tavily’s AI-first search creates agents that aren’t just smart — they’re current, accurate, and genuinely useful.

Don’t let your LLMs remain stuck in the past. Give them the power to access real-time information, and watch as they transform from impressive demos into indispensable tools.


This guide is based on a webinar I presented about our experience integrating Tavily into Amazon Bedrock AgentCore. The full webinar recording is available here. If you’d like to talk through agentic AI for your own use cases, reach me at gracjan.strzelec@chaosgears.com or on LinkedIn.


Resources

Let's talk about your project

We'd love to answer your questions and help you thrive in the cloud.