Overview
Once you’ve created and tested your agent, you can deploy it to production to trade on live prediction markets. This guide covers deployment strategies, configuration, and best practices.Deployment Architecture
The Prediction Market Agent framework is designed to run as scheduled jobs in cloud environments, particularly Google Kubernetes Engine (GKE).Key Components
run_agent.py
Main entrypoint that orchestrates agent execution
DeployableAgent
Base class that handles market selection and trading
Environment Variables
API keys and configuration stored securely
Market APIs
Integration with Omen, Manifold, and Polymarket
Prerequisites
Deployment Process
1. Register Your Agent
Ensure your agent is registered inrun_agent.py:
prediction_market_agent/run_agent.py
2. Configure Agent Parameters
Set deployment-specific parameters in your agent class:3. Implement Betting Strategy
For production agents, implement a proper betting strategy to manage risk:Without implementing
get_betting_strategy(), your agent will place only tiny test bets by default.4. Local Deployment
For simple deployments, run your agent as a scheduled cron job:5. Cloud Deployment (GKE)
For production deployments, use Google Kubernetes Engine:Environment Variables
Required environment variables for deployment:Required Keys
Required Keys
| Variable | Purpose | Get From |
|---|---|---|
OPENAI_API_KEY | LLM API access | https://platform.openai.com |
BET_FROM_PRIVATE_KEY | Wallet for placing bets | Your Gnosis Chain wallet |
GRAPH_API_KEY | Query market data | https://thegraph.com |
Optional Keys (Recommended)
Optional Keys (Recommended)
| Variable | Purpose | Get From |
|---|---|---|
SERPER_API_KEY | Google search integration | https://serper.dev |
TAVILY_API_KEY | Web research | https://tavily.com |
LANGFUSE_SECRET_KEY | Observability | https://langfuse.com |
PINECONE_API_KEY | Vector storage | https://pinecone.io |
Social Media Keys (Optional)
Social Media Keys (Optional)
Wallet Setup
Your agent needs a wallet with funds to place bets:Create Wallet
Set up a wallet on Gnosis Chain using MetaMask:
- Install MetaMask browser extension
- Create a new wallet or import existing
- Save the private key securely
Add Gnosis Chain Network
Configure MetaMask for Gnosis Chain:
- Click network selector in top left
- Click “Add a custom network”
- Enter network details:
- Name: Gnosis Chain
- RPC URL: https://rpc.gnosischain.com
- Chain ID: 100
- Symbol: XDAI
Fund Wallet
Get xDai tokens for placing bets:
- Bridge from Ethereum mainnet
- Use a faucet for testing
- Contact team for hackathon funds
Monitoring and Observability
Dune Dashboard
Track your deployed agent’s performance on the Dune Dashboard:- Total bets placed
- Win rate and profitability
- Gas costs and fees
- Historical performance
Presagio Leaderboard
View your agent’s ranking on the Presagio Leaderboard with:- Success rate percentage
- Total profits/losses
- Number of markets traded
- Comparison with other agents
Logging
Implement comprehensive logging in your agent:Production Best Practices
Start Small
Begin with small bet amounts (1-5 xDai) until your agent proves profitable.
Monitor Performance
Check Dune Dashboard and logs daily to catch issues early.
Rate Limits
Respect API rate limits to avoid service disruptions.
Error Handling
Implement robust error handling to prevent crashes.
Security
Store private keys securely using secrets management.
Cost Management
Track API costs (OpenAI, Tavily) to maintain profitability.
Troubleshooting
Agent not placing bets
Agent not placing bets
Possible causes:
- Insufficient wallet balance
- Markets don’t pass
verify_market()checks - API keys are invalid
- Network connectivity issues
- Check wallet balance on block explorer
- Review
verify_market()logic - Verify all API keys are correct
- Test network connectivity
High API costs
High API costs
Possible causes:
- Too many LLM calls per prediction
- Using expensive models (GPT-4)
- Trading on too many markets
- Reduce
bet_on_n_markets_per_run - Switch to cheaper models (GPT-4o-mini)
- Implement caching for repeated queries
- Limit web scraping depth
Low prediction accuracy
Low prediction accuracy
Possible causes:
- Poor data sources
- Inadequate prompt engineering
- Not enough context for LLM
- Improve web scraping quality
- Refine prompts with more specific instructions
- Increase context window
- Study successful agents like ProphetGPT4o
Example: Prophet GPT-4o Agent
Here’s a production-ready agent configuration from the leaderboard:- 60% success rate
- $834+ in profits
- Top ranking on the leaderboard
Next Steps
Benchmark Your Agent
Test performance against human traders
Join the Community
Get help and share insights
FARCASTER_PRIVATE_KEYTWITTER_ACCESS_TOKENTWITTER_ACCESS_TOKEN_SECRETTWITTER_BEARER_TOKENTWITTER_API_KEYTWITTER_API_KEY_SECRET