The research tools provide powerful capabilities for gathering information from the web, including Google search integration and the Prediction Prophet research framework for deep market analysis.
from prediction_market_agent_tooling.tools.google_utils import search_google_serperfrom prediction_market_agent.tools.web_scrape.markdown import web_scrapedef research_market(question: str) -> list[str]: # Search for relevant URLs urls = search_google_serper(question) # Filter and scrape top results contents = [] for url in urls[:5]: if "manifold" not in url: # Filter out certain domains content = web_scrape(url) if content: contents.append(content[:10000]) # Limit size return contents
from prediction_market_agent.tools.prediction_prophet.research import prophet_make_prediction# Generate prediction with built-in researchprediction = prophet_make_prediction( agent=agent, question="Will Bitcoin reach $100k by end of 2024?", openai_api_key=keys.openai_api_key, tavily_api_key=keys.tavily_api_key)print(f"Probability: {prediction.probability}")print(f"Confidence: {prediction.confidence}")print(f"Reasoning: {prediction.reasoning}")
The min_scraped_sites parameter acts as a quality threshold. If fewer sites are successfully scraped (due to duplicates, failures, or insufficient results), the function will raise an error. Adjust this based on your research thoroughness requirements.
For agents using CrewAI or other frameworks, a Tavily search tool is available:
from prediction_market_agent.agents.think_thoroughly_agent.think_thoroughly_agent import tavily_search_tool# Use as a CrewAI tool@tool("tavily_search_tool")def tavily_search_tool(query: str) -> list[dict[str, str]]: """ Given a search query, returns a list of dictionaries with results from internet search using Tavily. """ output = tavily_search(query=query) return [ { "title": r.title, "url": r.url, "content": r.content, } for r in output.results ]
The Think Thoroughly Agent uses research tools for deep market analysis:
from prediction_market_agent.agents.think_thoroughly_agent.think_thoroughly_agent import ThinkThoroughlyBaseclass MyResearchAgent(ThinkThoroughlyBase): def analyze_market(self, question: str): # Conduct research research = prophet_research( agent=self.agent, goal=question, openai_api_key=self.keys.openai_api_key, tavily_api_key=self.keys.tavily_api_key, min_scraped_sites=10 ) # Use research for prediction return self.make_prediction(research)