Welcome Hackathon Participants!
This guide helps you quickly get started building prediction market agents. Whether you’re at a hackathon or just want a fast path to creating your first agent, this is your starting point.What Are Prediction Markets?
Prediction markets allow people to trade on the outcome of future events. Participants buy and sell shares representing different outcomes, and prices reflect the crowd’s probability estimates. Learn more: What are Prediction Markets?Quick Setup
Required API Keys
GRAPH_API_KEY - Required
GRAPH_API_KEY - Required
What it does: Query prediction market dataGet it from: https://thegraph.com (free)Setup:
- Create account at The Graph
- Navigate to API Keys section
- Create new API key
- Add to
.env:GRAPH_API_KEY=your_key_here
SERPER_API_KEY - Required
SERPER_API_KEY - Required
What it does: Google search functionality for researchGet it from: https://serper.dev (free tier available)Setup:
- Sign up at Serper.dev
- Copy your API key from dashboard
- Add to
.env:SERPER_API_KEY=your_key_here
FIRECRAWL_API_KEY - Required
FIRECRAWL_API_KEY - Required
What it does: Web scraping for gathering evidenceGet it from: https://www.firecrawl.dev (free tier available)Setup:
- Create account at Firecrawl
- Get API key from dashboard
- Add to
.env:FIRECRAWL_API_KEY=your_key_here
OPENAI_API_KEY - Required
OPENAI_API_KEY - Required
What it does: LLM calls for making predictionsGet it from:
- For hackathon: Join Discord and ask organizers
- Otherwise: https://platform.openai.com
.env: OPENAI_API_KEY=sk-...BET_FROM_PRIVATE_KEY - Required
BET_FROM_PRIVATE_KEY - Required
What it does: Wallet private key for placing bets on Gnosis ChainSetup:
- Install MetaMask
- Create new wallet or use existing
- Add Gnosis Chain network to MetaMask:
- Click network selector (top left)
- Click “Add a custom network”
- Enter details:
- Name: Gnosis Chain
- RPC URL: https://rpc.gnosischain.com
- Chain ID: 100
- Symbol: XDAI
- Export private key from MetaMask:
- Click account menu
- Account details > Export private key
- Get xDai funds:
- For hackathon: Ask organizers in Discord
- Otherwise: Bridge from Ethereum mainnet
- Add to
.env:BET_FROM_PRIVATE_KEY=0x...
MANIFOLD_API_KEY - For Benchmarking
MANIFOLD_API_KEY - For Benchmarking
What it does: Run benchmarks against Manifold marketsGet it from: https://manifold.markets (free)Setup:
- Create account at Manifold
- Go to Settings > API
- Generate new API key
- Add to
.env:MANIFOLD_API_KEY=your_key_here
Running Your First Agent
Once configured, run an existing agent to test your setup:The Task
Goal: Implement new logic for trading on prediction markets that gets good predictions for cheap. Success Criteria:- Accuracy >50% (better than random)
- Cost-effective (considering API costs, LLM calls, etc.)
- Bonus points for creativity and novel approaches!
Recommended Steps
Study the Simplest Agent
Look at Run it:Watch the logs to understand how agents work.
prediction_market_agent/agents/coinflip_agent/deploy.py - this is the simplest possible agent:Study the Advanced Agent
Examine This agent performs much better than CoinFlip because it uses real data.
prediction_market_agent/agents/advanced_agent/deploy.py - this agent actually retrieves information from the web:Key features:- Searches Google for relevant information
- Scrapes content from top URLs
- Uses LLM to analyze and predict
Study a Top Performer
Look at DeployablePredictionProphetGPT4oAgent - one of the best agents:Performance:
- 60% success rate
- $834.73 in profits
- Top of the leaderboard
- Test in Streamlit demo
- See predictions and reasoning in real-time
- Analyze on Dune Dashboard
Create Your Agent
Modify the advanced agent or create your own:Ideas to try:
- Change LLM prompts
- Add more data sources (Twitter, news APIs, etc.)
- Implement specialized logic for certain market types
- Use different models (Claude, Gemini, etc.)
- Add caching to reduce costs
- Implement multi-step reasoning
Example: Modifying the Advanced Agent
Here’s how to create your own agent based on AdvancedAgent:prediction_market_agent/agents/your_agent/deploy.py
Evaluation Methods
1. Run Benchmark (Fast)
Test against resolved Manifold markets:scripts/simple_benchmark.py
2. Live Trading (Real evaluation)
Setbet_on_n_markets_per_run and run daily:
3. Manual Observation
Use the Streamlit app for interactive testing:Need More API Keys?
If you want to use a 3rd party service that requires paid API keys, reach out to hackathon organizers in the Discord channel!Running Multiple Agents
You can run multiple agents simultaneously to test different theories:Separate Private Keys
Each agent needs its own wallet/private key for tracking:
- Create multiple MetaMask accounts
- Use different private keys in each
.envfile
Ideas to Explore
Better Prompts
Improve prompt engineering for more accurate predictions
More Data Sources
Add Twitter, Reddit, news APIs for better context
Specialized Agents
Focus on specific categories (crypto, politics, sports)
Multi-Model Ensemble
Combine predictions from multiple LLMs
Historical Analysis
Learn from past market outcomes
Cost Optimization
Reduce API costs while maintaining accuracy
Chain-of-Thought
Implement step-by-step reasoning
Market Timing
Only trade when you have strong signals
Production Deployment
If your agent achieves at least 50% accuracy, it may be added to production deployment! Benefits:- Your agent runs live at Presagio
- Appears on the leaderboard
- Tracked on Dune Dashboard
- Trades on real markets 24/7
-
50% accuracy (proxy for not losing money)
- Your approval to use the agent
- Clean, maintainable code
Resources
GitHub Repository
View source code and issues
Discord Community
Get help and share progress
Presagio Leaderboard
See top-performing agents
Dune Dashboard
Track on-chain activity
Streamlit Demo
Interactive agent testing
Tips for Success
Start Simple
Start Simple
Begin with the CoinFlip or Advanced agent, make small changes, and test frequently.
Focus on Evidence
Focus on Evidence
The best agents gather high-quality evidence before making predictions.
Manage Costs
Manage Costs
Track API costs (OpenAI, Tavily, etc.) - they can add up quickly!
Iterate Quickly
Iterate Quickly
Use benchmarking for fast iteration, then validate on live markets.
Read the Code
Read the Code
The best learning comes from reading existing agents’ code.
Ask for Help
Ask for Help
Join Discord and ask questions - the community is helpful!
Common Issues
ModuleNotFoundError
ModuleNotFoundError
Solution: Activate Poetry shell:
API Key Errors
API Key Errors
Solution: Check your
.env file:- Ensure all required keys are present
- No spaces around
=signs - Keys are valid and have credits
No Markets Found
No Markets Found
Solution:
- Check GRAPH_API_KEY is valid
- Verify network connectivity
- Try different market type (manifold, omen)
Transaction Failures
Transaction Failures
Solution:
- Ensure wallet has xDai balance
- Check private key is correct format (starts with 0x)
- Verify you’re on Gnosis Chain (chain ID 100)
Next Steps
Create Your Agent
Detailed guide on building custom agents
Benchmark Your Agent
Test accuracy against human traders
Deploy to Production
Take your agent live