Overview
The prediction market agent supports multiple search engines for gathering information. Search tools are provided by theprediction_market_agent_tooling library and integrated into various agents.
Tavily Search
tavily_search
Primary search function using Tavily’s AI-powered search API. Optimized for research tasks and agent workflows. Location:prediction_market_agent_tooling.tools.tavily.tavily_search
The search query string
Search depth level:
"basic" or "advanced"- basic: Faster, fewer results
- advanced: More thorough, includes additional sources
Maximum number of search results to return
Response object containing search resultsStructure:
results(list): List of search result objectstitle(str): Page titleurl(str): Page URLcontent(str): Relevant content snippetscore(float): Relevance score
Tavily search requires
TAVILY_API_KEY environment variable to be set.TavilyResponse
Response model for Tavily search results. Location:prediction_market_agent_tooling.tools.tavily.tavily_models
List of search result objects
The original search query
TavilyResult
Individual search result object.Page title
Page URL
Relevant content excerpt from the page
Relevance score (0.0 to 1.0)
Google Search
search_google
Google search integration using the tooling library. Location:prediction_market_agent_tooling.tools.google
The search query
List of URLs from search results
GoogleSearchTool
Function calling wrapper for Google search. Location:prediction_market_agent.tools.web_search.google
Schema
Usage
Search in Agents
Think Thoroughly Agent
Integrates Tavily search as a LangChain tool:Prophet Research Integration
Search is integrated into the research workflow:Configuration
Environment Variables
API key for Tavily search serviceGet your key at tavily.com
Google Custom Search API key (if using Google search)
Google Custom Search Engine ID
API Keys Class
Search Strategies
Basic Search Strategy
Advanced Research Strategy
Search Depth Comparison
Basic Search
Use for:
- Quick lookups
- Simple queries
- Cost optimization
- Real-time agent responses
- Faster execution
- Lower cost
- Fewer sources
- Good for straightforward questions
Advanced Search
Use for:
- Complex research
- Important predictions
- Multi-source verification
- Deep analysis
- Slower execution
- Higher cost
- More comprehensive
- Better for nuanced questions
Error Handling
Best Practices
Cost Management
- Use basic search for most queries
- Reserve advanced search for critical predictions
- Cache search results when possible
- Implement rate limiting
Query Optimization
- Use LLM to generate targeted queries
- Include date ranges for time-sensitive questions
- Filter out prediction market URLs to avoid circular references
Result Processing
- Deduplicate URLs across searches
- Track previously scraped URLs
- Validate URLs before scraping
- Handle failed scrapes gracefully
Performance
- Limit max_results based on needs
- Use parallel scraping when possible
- Implement timeouts for slow sources
- Cache frequently accessed results
Dependencies
See Also
- Web Scraping API - For scraping search result URLs
- Prophet Research - Integrated research workflow
- LLM Utils API - For processing search results