Polymarket SDK for Go

Go SDK for building AI trading agents on Polymarket prediction markets.
Features
- π Polymarket API Client - Full client for Gamma (markets) and CLOB (trading) APIs
- π€ Multi-Agent Workflows - Define agent teams using multi-agent-spec format
- π§ LLM Integration - Works with any LLM via omnillm + LangChainGo
- π Portable Specs - Same agent definitions deploy to Claude Code, Go servers, or Kubernetes
- π OmniAgent Integration - Compiled skill wrapper for embedding in omniagent-based agents
Installation
go get github.com/grokify/polymarket-go
Quick Start
Run the Demo
Fetch live market data from Polymarket:
go run ./cmd/polymarket-agent/ --demo --demo-limit=10
Output:
level=INFO msg="market 1" question="Will Panama win the 2026 FIFA World Cup?" liquidity=$4007373 ...
level=INFO msg="market 2" question="Will Haiti win the 2026 FIFA World Cup?" liquidity=$3860101 ...
Use the Polymarket Client
import "github.com/grokify/polymarket-go/internal/polymarket"
client := polymarket.NewClient()
// Fetch active markets
markets, err := client.GetMarkets(ctx, polymarket.GetMarketsParams{
Active: &active,
Limit: 10,
Order: "liquidity",
})
// Get order book for a token
book, err := client.GetOrderBook(ctx, tokenID)
Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β polymarket-go β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β cmd/polymarket-agent/ CLI for running agent workflows β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β omniagent/skill/ Compiled skill for omniagent β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β agents/specs/ Multi-agent-spec definitions β
β βββ agents/ Agent markdown files β
β βββ team.json Workflow configuration β
β βββ deployment-*.json Platform-specific configs β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β internal/ β
β βββ polymarket/ Polymarket API client β
β βββ loader/ Spec file parsers β
β βββ executor/ Workflow execution engine β
β βββ tools/ Agent tools for Polymarket β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β omnillm-langchaingo LangChainGo adapter β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β omnillm-core Unified LLM provider abstraction β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Agent Team
The default trading team consists of three agents in a graph workflow:
| Agent |
Role |
Model |
| market-analyst |
Discovers trading opportunities |
sonnet |
| superforecaster |
Generates probability estimates |
sonnet |
| trader |
Executes trades based on analysis |
haiku |
Workflow: discover β forecast β execute
Agent Specs
Agents are defined in markdown with YAML frontmatter:
---
name: market-analyst
model: sonnet
tools: [WebSearch, WebFetch, Read, Write]
role: Market Research Analyst
goal: Identify mispriced markets with >10% expected edge
---
You are a market analyst specializing in Polymarket...
Deployment Targets
The same agent specs can deploy to multiple platforms:
| Platform |
Config File |
Use Case |
| Go Server |
deployment-go-server.json |
Production trading |
| Claude Code |
deployment-claude-code.json |
Development/testing |
OmniAgent Integration
Use polymarket-go as a compiled skill in omniagent-based agents:
import (
"github.com/plexusone/omniagent/agent"
predictskill "github.com/grokify/polymarket-go/omniagent/skill"
)
// Create and register the predictions skill
predictSkill := predictskill.New(predictskill.Config{})
commands.RegisterAgentOption(agent.WithCompiledSkill(predictSkill))
Tools provided:
| Tool |
Description |
get_markets |
Fetch active prediction markets with filters |
get_orderbook |
Get order book for a market token |
Dependencies
Documentation
License
MIT License - see LICENSE for details.