Skip to main content

Overview

Local deployment is the simplest way to run agents during development and testing. The agent runs directly on your machine using Python and Poetry for dependency management.

Prerequisites

Python 3.11

Required version: Python >=3.11

Poetry

Python dependency management tool

Installation

1

Install Poetry

Install Poetry for Python 3.11:
python3.11 -m pip install poetry
2

Install Dependencies

Install project dependencies using Poetry:
python3.11 -m poetry install
This will:
  • Create a virtual environment in the project directory
  • Install all dependencies from pyproject.toml and poetry.lock
  • Set up the development environment
3

Activate Virtual Environment

Activate the Poetry shell:
python3.11 -m poetry shell
4

Configure Environment

Create a .env file in the root directory with required variables:
.env
BET_FROM_PRIVATE_KEY=your_private_key_here
OPENAI_API_KEY=your_openai_key_here
See the Environment Variables page for complete configuration options.

Running Agents

CLI Usage

The main entrypoint is prediction_market_agent/run_agent.py. Run agents using the CLI:
python prediction_market_agent/run_agent.py <agent> <market_type>

Available Options

View all available agents and market types:
python prediction_market_agent/run_agent.py --help
Usage: run_agent.py [OPTIONS] AGENT:{coinflip|replicate_to_omen|think_thoroughly
                    ly|think_thoroughly_prophet|think_thoroughly_prophet_kelly
                    |knownoutcome|microchain|microchain_modifiable_system_prom
                    pt_0|microchain_modifiable_system_prompt_1|microchain_modi
                    fiable_system_prompt_2|microchain_modifiable_system_prompt
                    _3|microchain_with_goal_manager_agent_0|metaculus_bot_tour
                    nament_agent|prophet_gpt4o|prophet_gpt4|prophet_gpt4_final
                    |prophet_gpt4_kelly|olas_embedding_oa|social_media|omen_cl
                    eaner|ofv_challenger}
                    MARKET_TYPE:{omen|manifold|polymarket|metaculus}

Example Commands

python prediction_market_agent/run_agent.py coinflip omen

Agent Types

The system supports multiple agent implementations:
  • coinflip - Randomly selects outcomes (for testing)
  • knownoutcome - Uses known outcomes for validation
  • replicate_to_omen - Replicates markets to Omen
  • prophet_gpt4o - GPT-4o based predictions
  • prophet_gpt4 - GPT-4 Turbo based predictions
  • prophet_gpt4omini - GPT-4o Mini based predictions
  • prophet_o1 - OpenAI o1 based predictions
  • prophet_claude35_sonnet - Claude 3.5 Sonnet predictions
  • prophet_gemini20flash - Gemini 2.0 Flash predictions
  • microchain - Microchain-based agent with reasoning
  • think_thoroughly - Deep research agent
  • advanced_agent - Multi-capability agent
  • gptr_agent - GPT Researcher based agent
  • social_media - Farcaster and Twitter integration
  • omen_cleaner - Market cleanup operations
  • ofv_challenger - Fact verification challenger
  • arbitrage - Cross-market arbitrage

Market Types

Agents can interact with different prediction markets:

Omen

Gnosis Chain-based prediction markets (Presagio)

Manifold

Play-money prediction market platform

Polymarket

Real-money prediction markets on Polygon

Metaculus

Forecasting platform for quantitative predictions

How It Works

Architecture

The local deployment uses the following flow:

Agent Registry

All agents are registered in prediction_market_agent/run_agent.py:
class RunnableAgent(str, Enum):
    coinflip = "coinflip"
    prophet_gpt4o = "prophet_gpt4o"
    microchain = "microchain"
    # ... more agents

RUNNABLE_AGENTS: dict[RunnableAgent, type[DeployableAgent]] = {
    RunnableAgent.coinflip: DeployableCoinFlipAgent,
    RunnableAgent.prophet_gpt4o: DeployablePredictionProphetGPT4oAgent,
    # ... more mappings
}

Environment Requirements

When you run an agent, it will automatically check for required environment variables and inform you if any are missing:
Depending on the agent you want to run, you may require additional variables. When you run an agent, it will tell you if you need to set any additional variables.

Development Workflow

1

Create Your Agent

Subclass DeployableTraderAgent to create a custom agent:
from prediction_market_agent_tooling.deploy.agent import DeployableAgent

class MyCustomAgent(DeployableAgent):
    def run(self, market_type):
        # Your agent logic here
        pass
2

Register Your Agent

Add your agent to the RunnableAgent enum and RUNNABLE_AGENTS dict in run_agent.py:
class RunnableAgent(str, Enum):
    my_custom_agent = "my_custom_agent"

RUNNABLE_AGENTS = {
    RunnableAgent.my_custom_agent: MyCustomAgent,
    # ... other agents
}
3

Test Locally

Run your agent with the CLI:
python prediction_market_agent/run_agent.py my_custom_agent omen
4

Deploy to Cloud

Once tested, deploy using Docker or GKE (see other deployment guides).

Troubleshooting

If you encounter import errors, try reinstalling dependencies:
poetry install --no-cache
Ensure your .env file is in the root directory and contains all required variables. Check the agent’s output for specific requirements.
Verify you’re using Python 3.11:
python --version  # Should show 3.11.x
Ensure Poetry is installed and in your PATH:
which poetry
python3.11 -m poetry --version

Next Steps

Docker Deployment

Package agents in containers for consistent environments

Cloud Deployment

Deploy agents to Google Kubernetes Engine (GKE)

Environment Config

Complete environment variable reference

Interactive Apps

Run Streamlit apps for interactive agent testing

Build docs developers (and LLMs) love