LogoAIAny
Icon for item

Polymarket Agents

Polymarket Agents is an open-source developer framework and utilities for building AI agents that trade autonomously on Polymarket. The repository integrates with the Polymarket API, provides LLM tooling and RAG support, and includes data connectors for news, web search, and betting data to enable prediction-market oriented agents. Distributed under an MIT license with usage and jurisdictional restrictions noted in the README.

Introduction

Polymarket Agents — Detailed Introduction

Overview

Polymarket Agents is an open-source Python framework (targeted at Python 3.9) and a set of utilities for building, testing, and running AI-driven trading agents that interact with Polymarket prediction markets. The project provides connectors to Polymarket APIs, tools for constructing and signing orders, utilities for retrieval-augmented generation (RAG), and integrations for sourcing data such as news, web search, and betting feeds to inform agent decisions.

Key Features
  • Integration with Polymarket APIs (including Gamma/CLOB clients) to fetch markets, events, and execute trades.
  • AI agent utilities tailored for prediction-market workflows (prompting helpers, agent orchestration, trade execution helpers).
  • Local and remote RAG support via vectorization (Chroma) and pluggable vector DB adapters.
  • Data sourcing connectors for news providers, web search, and betting/data services to build contextual agent inputs.
  • Pydantic-based data models for markets, events, and trades, improving data validation and developer ergonomics.
  • Command-line interface (CLI) for common operations: listing markets, querying news, running local agents, and issuing trades.
Architecture

The repository adopts a modular architecture so community members can replace or extend components:

  • APIs: connector modules (e.g., Chroma.py, Gamma.py, Polymarket.py) that standardize data retrieval and order types.
  • Objects: Pydantic models for strongly typed representations of markets, trades and events.
  • Scripts: CLI tooling and Docker scripts to run in local or containerized environments.
  • LLM tooling: utilities and prompt engineering helpers for interacting with language models (used for prediction reasoning and decision logic).
Getting Started (high level)
  1. Clone the repo and create a Python 3.9 virtual environment.
  2. Install dependencies from requirements.txt.
  3. Create a .env from .env.example and set required keys (e.g. POLYGON_WALLET_PRIVATE_KEY and OPENAI_API_KEY) if you plan to use external LLM providers or execute on-chain (USDC) trades.
  4. Load your wallet with USDC (for trading) and use the provided CLI or scripts to interact with markets, test agent logic, or run trades.

Example commands:

  • Run CLI: python scripts/python/cli.py get-all-markets --limit 5 --sort-by volume
  • Run a trading script: python agents/application/trade.py
  • Docker: ./scripts/bash/build-docker.sh and ./scripts/bash/run-docker-dev.sh
Requirements & Notes
  • Targeted for Python 3.9; virtualenv recommended.
  • Requires API keys and a funded Polygon wallet for live trading.
  • Uses vectorization (Chroma) for RAG workflows; developers can plug other vector DBs.

Polymarket Agents is released under an MIT license, but the README explicitly links to Polymarket Terms of Service: trading via Polymarket is restricted for persons in certain jurisdictions (the README notes prohibition for US persons and some other jurisdictions). Users must ensure compliance with Polymarket TOS and local laws before running trading agents.

The repo encourages community contributions (fork → branch → PR) and provides pre-commit hooks. Related Polymarket repos (py-clob-client, python-order-utils, clob-client) and general tools like LangChain and Chroma are referenced for building complete agent stacks.

Use Cases
  • Automated prediction-market strategies driven by LLM-based analysis.
  • Research and experimentation in market forecasting and AI-driven decision making.
  • Building RAG-enabled agents that combine news/web evidence with market data to form trading actions.
License

MIT License (see repository LICENSE file).

Information

  • Websitegithub.com
  • AuthorsPolymarket
  • Published date2024/07/03

Categories

More Items