API · AI Agents
Most Polymarket bots in 2026 are built by prompting an AI coding agent — Claude Code, Cursor, Copilot. That's fine, if you keep the agent on the current V2 API and on a safety rail. This page shows how: install our rules + read-only tooling so the generated code is correct and starts in paper mode, and follow the checklist before anything touches real money.
AGENTS.md into your repo (Claude Code, Cursor, Copilot and others
read it). It pins the V2 SDKs, base URLs, pUSD contracts, the gotchas, and a paper-default money rail — so the
agent stops writing dead V1 (py-clob-client 0.34 / USDC.e) code.Set your agent up
- Rules: add
AGENTS.mdto your repo root (and aCLAUDE.mdsymlink /.cursor/rulesmirror). - Context: point the agent at our
llms.txtand the API reference so it grounds answers in current docs, not its training guess. - Grounding data: install the read-only MCP so token IDs come from live markets, not hallucinations.
The safe-vibe-coding checklist
Hold every AI-generated trading bot to this before you let it run live:
- Start read-only — market data first, no orders.
- Paper mode by default; live trading requires an explicit
--liveflag. - Keys in environment variables only — never hardcoded, logged, or committed.
- Pin the official V2 SDK + base URLs so the agent can't invent endpoints.
- Ground on the spec / MCP — don't trust an endpoint the agent "remembers".
- Fail closed on bad data — never place a trade on a failed or empty fetch.
- Human review before the first live run.
- Hard position & loss limits + a kill switch.
A good first prompt
Using the Polymarket V2 API (py-clob-client-v2) and the AGENTS.md rules in this repo,
write a PAPER bot that finds the BTC-above-150k market, reads its order book, and would
buy Yes under 0.40. Do NOT place live orders. Keys from env only. Fail closed on bad data.
The agent should produce paper-mode code, with real token IDs (from the MCP/live data), keys read from the
environment, and no live order path unless you add --live yourself.
Give your agent real markets
Hallucinated token IDs are the #1 vibe-coding bug. Search a real market here, copy its IDs, and hand them to the agent (or let the MCP do it):
Next: The AGENTS.md rules · Which SDK to use · Fix an error.
Not financial advice. Automated trading risks real money — test in paper mode and review before going live.





