This project demonstrates an intelligent web search agent built using the Atomic Agents framework. The agent can perform web searches, generate relevant queries, and provide detailed answers to user questions based on the search results.
- Query Generation: Automatically generates relevant search queries based on user input.
- Web Search: Utilizes SearxNG to perform web searches across multiple search engines.
- Question Answering: Provides detailed answers to user questions based on search results.
- Follow-up Questions: Suggests related questions to encourage further exploration of the topic.
The Web Search Agent consists of several key components:
- Query Agent (
query_agent.py
): Generates diverse and relevant search queries based on user input. - SearxNG Search Tool (
searxng_search.py
): Performs web searches using the SearxNG meta-search engine. - Question Answering Agent (
question_answering_agent.py
): Analyzes search results and provides detailed answers to user questions. - Main Script (
main.py
): Orchestrates the entire process, from query generation to final answer presentation.
To run the Web Search Agent:
-
Clone the Atomic Agents repository:
git clone https://github.com/BrainBlend-AI/atomic-agents
-
Navigate to the web-search-agent directory:
cd atomic-agents/atomic-examples/web-search-agent
-
Install dependencies using Poetry:
poetry install
-
Set up environment variables: Create a
.env
file in theweb-search-agent
directory with the following content:OPENAI_API_KEY=your_openai_api_key SEARXNG_BASE_URL=your_searxng_instance_url
Replace
your_openai_api_key
with your actual OpenAI API key andyour_searxng_instance_url
with the URL of your SearxNG instance. -
Run the Web Search Agent:
poetry run python web_search_agent/main.py
- The user provides an initial question or topic for research.
- The Query Agent generates multiple relevant search queries based on the user's input.
- The SearxNG Search Tool performs web searches using the generated queries.
- The Question Answering Agent analyzes the search results and formulates a detailed answer.
- The main script presents the answer, along with references and follow-up questions.
You can customize the Web Search Agent by modifying the following:
- Adjust the number of generated queries in
main.py
. - Modify the search categories or parameters in
searxng_search.py
. - Customize the system prompts for the Query Agent and Question Answering Agent in their respective files.
Contributions to the Web Search Agent project are welcome! Please fork the repository and submit a pull request with your enhancements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.