Search the web using Brave Search API in LlamaIndex agents
Search and retrieve results from the Brave search engine in a LlamaIndex agent.
Why it matters
Enable AI agents to search and retrieve real-time information from the Brave search engine, allowing them to answer questions about current events, find specific content, and access up-to-date web data.
Outcomes
What it gets done
Connect LlamaIndex agents to Brave Search API with authentication
Execute web searches based on natural language queries from agents
Retrieve and return search results including news and current information
Integrate search capabilities into agent workflows for multi-turn conversations
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/li-tool-tools-brave-search | bash Overview
LlamaIndex Tools Integration: Brave_Search
A LlamaIndex tool that searches the web via the Brave search engine, supporting multi-turn conversational follow-ups. Use when an agent needs current web search results specifically from Brave, including conversational follow-up queries.
What it does
The Brave Search Tool lets a LlamaIndex agent search and retrieve results from the Brave search engine. BraveSearchToolSpec is initialized with a Brave search API key, and once attached to an agent's tool list, the agent can answer questions by searching the web through Brave rather than relying on its own training data.
The source's own worked example shows a multi-turn conversation pattern: the agent is first asked for the latest news about a topic ("superconductors"), then asked a follow-up about a specific detail ("what does lk-99 look like"), then a further follow-up ("is there any videos of it levitating") - illustrating that the tool supports iterative, conversational search rather than only single, isolated queries.
When to use - and when NOT to
Use it when a LlamaIndex agent needs current web search results through Brave specifically - for example when Brave's index or ranking is preferred over another search provider - and especially for multi-turn conversations where follow-up questions build on earlier search results. Do not use it without first setting up a Brave account and obtaining a search API key; the tool has no functionality without valid Brave API credentials.
Capabilities
Searches the web via Brave and returns results for the agent to use in answering natural-language questions, including follow-up questions in the same conversation.
How to install
from llama_index.tools.brave_search import BraveSearchToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
tool_spec = BraveSearchToolSpec(api_key="your-key")
agent = FunctionAgent(
tools=tool_spec.to_tool_list(),
llm=OpenAI(model="gpt-4.1"),
)
Requires a Brave search API key from a Brave account.
Who it's for
Developers building LlamaIndex agents that need current web search results from Brave, including multi-turn conversations with follow-up questions.
Source README
LlamaIndex Tools Integration: Brave_Search
This tool enables agents to search and retrieve results from the Brave search engine.
You will need to set up an Brave account to get an search api key. Please check more here: https://brave.com/search/api
Usage
This tool has a more extensive example usage documented in a Jupyter notebook here
Here's an example usage of the BraveSearchToolSpec.
from llama_index.tools.brave_search import BraveSearchToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
tool_spec = BraveSearchToolSpec(api_key="your-key")
agent = FunctionAgent(
tools=tool_spec.to_tool_list(),
llm=OpenAI(model="gpt-4.1"),
)
answer = await agent.run("what's the latest news about superconductors")
answer = await agent.run("what does lk-99 look like")
answer = await agent.run("is there any videos of it levitating")
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.