Overview
TheAdvancedAgent is a baseline agent that performs evidence-based predictions by searching Google, scraping web content, and analyzing it with an LLM. It represents the most basic approach to making informed predictions.
Class: AdvancedAgent
A trading agent that combines web search, content scraping, and LLM analysis to generate probabilistic predictions.Inheritance
Configuration Properties
Number of markets the agent will trade on per execution run
Methods
answer_binary_market
The market to predict on
A probabilistic answer containing:
p_yes: Probability of the “yes” outcome (0.0 to 1.0)confidence: Confidence in the prediction (0.0 to 1.0)reasoning: “I asked Google and LLM to do it!”
None if no research results are found or content cannot be scraped.Prediction Workflow
The agent follows a systematic research process:1. Google Search
Searches Google for content related to the market question:- Uses the Serper API for search results
- Filters out Manifold Markets results to avoid copying answers
- Returns
Noneif no results are found
2. Web Scraping
Scrapes the top 5 search results:- Limits content to 10,000 characters per site
- Converts web pages to markdown format
- Returns
Noneif no content can be extracted
3. LLM Analysis
Analyzes the scraped content using GPT-4o-mini:- Uses GPT-4o-mini with temperature 0.0 for consistent predictions
- Provides current date context
- Returns probability and confidence as float values
Helper Function: llm
The market question to predict on
List of scraped web content (markdown format)
A tuple containing:
probability: Likelihood of the event occurring (0.0 to 1.0)confidence: Confidence in the prediction (0.0 to 1.0)
LLM Configuration
- Model: gpt-4o-mini
- System Prompt: “You are professional prediction market trading agent.”
- Temperature: 0.0 (deterministic)
- Output Format: “probability confidence” (space-separated floats)
Usage Examples
Basic Deployment
Production Deployment
Custom Betting Strategy
Required API Keys
The AdvancedAgent requires the following API keys (configured via environment variables):API key for Google search via Serper API
OpenAI API key for GPT-4o-mini model
Limitations
Content Filtering
- Filters out Manifold Markets results to avoid copying existing predictions
- You may want to filter other prediction market sites depending on your use case
Context Window
- Truncates each scraped page to 10,000 characters
- May miss important information at the end of long articles
Single LLM Call
- Makes only one LLM call for prediction
- No iterative refinement or multi-step reasoning
Error Handling
- Returns
Noneif search fails - Returns
Noneif web scraping fails - No fallback mechanisms
Performance Considerations
Baseline Agent
This agent serves as a baseline for comparison:Speed vs. Quality
- Fast: Uses GPT-4o-mini (cheaper and faster)
- Simple: Single-pass prediction without refinement
- Basic: No advanced reasoning or multi-step analysis
Source Location
Related
- Prophet Agent - Advanced agent using PredictionProphet library
- Think Thoroughly Agent - Multi-step reasoning agent
- DeployableTraderAgent - Base class for trading agents
- Web Scraping Tools - Content extraction utilities