Advanced web search and information retrieval with real-time data access
The Deep Search Agent provides powerful web search capabilities with intelligent result synthesis. It searches the web, browses pages, and generates comprehensive answers based on real-time information.
Implemented in src/services/agents/deep_search_agent.py:103, the AutogenDeepSearchAgent class orchestrates web search operations through two specialized agents:
Researcher Agent: Plans search strategies and analyzes results
Executor Agent: Executes web searches and browses content
from src.services.agents.deep_search_agent import AutogenDeepSearchAgentfrom configs.oai_config import get_llm_configimport asyncio# Initialize the agentllm_config = get_llm_config(service_type="deepsearch")agent = AutogenDeepSearchAgent(llm_config=llm_config)# Perform a searchquery = "What are the latest developments in quantum computing?"result = asyncio.run(agent.deep_search(query))print(result)
# Launch Deep Search Agent directlypython launcher.py --mode deepsearch# Interactive prompt🤔 Please enter search question: What is the latest AI research?🔍 Searching...📋 Search results: [comprehensive answer based on web search]
# Launch unified modepython launcher.py --mode unified# The system automatically uses Deep Search for information queries🤖 Please describe your task: What's the current price of Bitcoin?🔧 Intelligent task analysis...📊 Selecting optimal processing method...[System selects Deep Search Agent automatically]
agent = AutogenDeepSearchAgent( llm_config=custom_llm_config, code_execution_config={"work_dir": "./search_workspace"}, return_chat_history=True, # Get full conversation history save_log=True # Save logs for debugging)# Configure context managementagent.max_tool_messages_before_summary = 3 # Summarize every 3 tool callsagent.token_limit = 3000 # Maximum tokens before summarization
The agent automatically manages context to handle long search sessions:
Automatic Summarization: When search results exceed the token limit (default: 2000 tokens), the agent automatically summarizes them to maintain context while staying within LLM limits.
Configuration:
max_tool_messages_before_summary: Number of tool calls before summarizing (default: 2)
token_limit: Token count threshold for triggering summarization (default: 2000)
Uses tiktoken with cl100k_base encoding for accurate token counting
# Research a technical topicquery = """What are the key differences between RAG and fine-tuning for LLM customization? Include recent research findings."""result = asyncio.run(agent.deep_search(query))
# Get latest informationquery = "What are today's top AI research papers?"result = asyncio.run(agent.deep_search(query))
# Gather specific dataquery = """Find the top 10 companies in the semiconductor industry by gross profit margin in 2024 and rank them"""result = asyncio.run(agent.deep_search(query))