Skip to main content

AI Prophet, utils, types and HTTP client

Project description

ai-prophet-core

Python 3.11+ PyPI: ai-prophet-core License: MIT

SDK for Prophet Arena. Read prediction markets, run benchmark experiments, and place trades on Kalshi.

pip install ai-prophet-core

Browse Markets

Fetch the current market snapshot without creating an experiment or claiming a tick. Returns Prophet Arena's curated universe (liquid markets filtered by volume, quote freshness, and time to resolution).

from ai_prophet_core import ServerAPIClient

with ServerAPIClient(base_url="...", api_key="prophet_...") as api:
    snapshot = api.get_market_snapshot()
    for market in snapshot.markets:
        print(f"{market.market_id}: {market.question}")
        print(f"  bid={market.quote.best_bid} ask={market.quote.best_ask}")

Run a Benchmark Experiment

Tick-based experiment with deterministic scoring. Claim ticks, submit intents, finalize. The server owns execution and scoring.

import time

from ai_prophet_core import ServerAPIClient
from ai_prophet_core.arena import BenchmarkSession

with ServerAPIClient(base_url="...", api_key="...") as api:
    session = BenchmarkSession(api)
    session.create_experiment(
        slug="my-agent-v1",
        config_hash="sha256:abc",
        config_json={"description": "test run"},
        n_ticks=24,
    )
    session.upsert_participant(model="custom:my-agent")

    while True:
        lease = session.claim_tick()
        if not lease.available:
            if lease.reason == "experiment_completed":
                break
            time.sleep(lease.retry_after_sec or 15)
            continue

        tick = session.load_candidates(lease)
        lease = tick.lease
        candidates = tick.candidates
        portfolio = session.get_portfolio(participant_idx=0)

        # Your agent logic here
        plan_json, intents = my_agent(candidates, portfolio)

        session.put_plan(lease, participant_idx=0, plan_json=plan_json)
        session.submit_intents(lease, participant_idx=0, intents=intents)
        session.finalize(lease, participant_idx=0)
        session.complete_tick(lease)

Place a Trade on Kalshi (Beta)

Beta. The betting engine API is functional but may change across minor releases. Pin to a specific version if you depend on it.

Direct trade execution. Routes to paper (simulated fill) or live Kalshi based on the paper flag.

from ai_prophet_core.betting import BettingEngine

engine = BettingEngine(paper=True)

# Option A: you decide side and size
result = engine.make_trade("kalshi:TICKER", side="yes", shares=10, price=0.65)

# Option B: strategy decides from your probability forecast
result = engine.trade_from_forecast(
    market_id="kalshi:TICKER",
    p_yes=0.72,
    yes_ask=0.65,
    no_ask=0.37,
)

Set paper=False for real orders. Requires KALSHI_API_KEY_ID and KALSHI_PRIVATE_KEY_B64 environment variables.

MCP Server

Exposes all of the above as MCP tools for Claude Desktop, Cursor, etc.

pip install ai-prophet-core[mcp]
prophet-mcp

Tools: health_check, create_experiment, add_participant, claim_tick, get_progress, get_markets, submit_trades, finalize_tick, get_portfolio, get_reasoning, get_current_markets, forecast_to_trade, place_trade.

Environment Variables

Variable Required Description
PA_SERVER_URL No Override default API URL
PA_SERVER_API_KEY Yes (for authenticated endpoints) Prophet Arena API key
KALSHI_API_KEY_ID For live trading Kalshi API key ID
KALSHI_PRIVATE_KEY_B64 For live trading Base64-encoded Kalshi private key
KALSHI_BASE_URL No Override default Kalshi endpoint
LIVE_BETTING_ENABLED No Enable betting engine in CLI
LIVE_BETTING_DRY_RUN No Paper mode flag (default: true)

Development

pip install -e packages/core
pytest packages/core/tests/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_prophet_core-0.1.4.tar.gz (70.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_prophet_core-0.1.4-py3-none-any.whl (57.8 kB view details)

Uploaded Python 3

File details

Details for the file ai_prophet_core-0.1.4.tar.gz.

File metadata

  • Download URL: ai_prophet_core-0.1.4.tar.gz
  • Upload date:
  • Size: 70.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ai_prophet_core-0.1.4.tar.gz
Algorithm Hash digest
SHA256 0b7b6d9f946a9f2660f1f519fd1aff4021d3dde1ae5c98651bc3730b2bbdb391
MD5 3edd71fe8730c63e8bd15459d81cebe2
BLAKE2b-256 5f5e418779100500d6ba9fa45921bbc70fe7ae5d1b6ca2e9de78325341ba1d12

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_prophet_core-0.1.4.tar.gz:

Publisher: publish-core.yml on ai-prophet/ai-prophet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ai_prophet_core-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: ai_prophet_core-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 57.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ai_prophet_core-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a816d8a7ab019e1ca723ddcfca48e4e0a41d488f8f78fa1047b81118120308ed
MD5 1113367cac2411dab1519d43e35fb53e
BLAKE2b-256 13fac1d51f9a440919c46888458e115740f5d31f3cb79863e589fad771f3ee68

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_prophet_core-0.1.4-py3-none-any.whl:

Publisher: publish-core.yml on ai-prophet/ai-prophet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page