Build a Polymarket trading agent with Claude
Updated by the Circuit team
Two ways to build it
You can get a working Polymarket agent out of an AI assistant in two ways on Circuit. Both end in the same place: an agent with readable code that trades Polymarket from a wallet in your Circuit account.
| Route | Who writes the code | What you need | Best for |
|---|---|---|---|
| Ask Circuit | Circuit's Builder | A browser and a passkey | Most people |
| Claude Code writing the agent directly | Claude, against the Circuit SDK | The Circuit CLI and the docs MCP server | Developers who want to edit every line |
The first route needs no setup: shape a spec with Claude if you like, open Circuit at app.circuit.org and describe the strategy so the Builder writes and checks the agent. The second uses Claude Code to write TypeScript against the SDK. You can also connect Claude as an assistant to read your account and propose wallet operations you confirm. The guide on trading with Claude and other assistants covers what a connected assistant can read and propose.
What a Polymarket agent can do on Circuit
An agent reaches Polymarket through Circuit's SDK. Everything below comes from the Polymarket SDK reference.
| Action | What it does |
|---|---|
| Find events | List events, search them by text, or retrieve one event with all its open markets |
| Screen markets | Filter by time to end, price band, minimum liquidity, stake size and sports market type, then rank. Tags can include or exclude categories such as sports |
| Quote | Price a buy by pUSD to spend or a sell by shares, with Polymarket's fees included |
| Buy and sell outcomes | Send the order against the live book. A sell can use "max" to close the agent's whole holding of that outcome |
| Split | Turn pUSD into equal shares of YES and NO in one binary market |
| Merge | Turn equal YES and NO shares back into pUSD |
| Convert | In a negative-risk event turn NO shares of one or more questions into YES shares of every other question. Converting more than one also returns pUSD minus the market fee |
| Redeem | Claim a resolved market. Both outcomes redeem in one action. Losing shares pay nothing |
Agents can also react to events instead of polling. A resolution trigger fires when a Polymarket outcome resolves. A position trigger fires on changes to a named outcome token. A news trigger fires once for each news item that matches a sentence you write like "the Fed announces a rate decision". Circuit charges no builder fee on Polymarket orders.
See the published strategy reports for ANTHROPIC View and H100 Index Drift for parameter choices and replay results.
Prompts that work
The Builder turns a written spec into code. The spec decides the agent. Name the market filter, the entry rule, the size, the exit and what to do when data is missing. Every number you write becomes a setting you can change later. Three prompts that produce testable agents:
Longshot fader. "Every hour, screen Polymarket markets that end within 7 days with at least $20,000 of liquidity, excluding sports. Find outcomes priced between $0.03 and $0.08. Buy NO in the three with the most 24-hour volume, spending $25 each. Never hold more than 10 positions. Redeem every resolved market."
Complete-set scanner. "Every 15 minutes, scan negative-risk events with at least four outcomes. When the asks for one YES share of every outcome sum below $0.97 after fees, buy one complete set sized at $50. Log the sum for every event checked, even when it doesn't trade."
News-driven entry. "When news says a named company has filed for an IPO, search Polymarket for that company's IPO market. If YES is below $0.70, spend $40 on YES. Sell half if YES reaches $0.90. Redeem at resolution."
Specific numbers make the agent predictable. "Buy undervalued markets" gives the Builder nothing to test. "Buy YES when the price is at least 8 cents below the odds feed" does. More on writing specs is in building a trading agent without code.
A worked example: pricing an edge
A YES share pays $1 if the outcome happens and $0 if it doesn't. Its price reads as the market's probability. An agent has an edge when its own probability estimate beats the price by more than the costs.
Polymarket charges takers a fee of shares × feeRate × p × (1 − p). p is the share price. Makers pay nothing. As of October 2026 its fee page lists a fee rate of 0.07 for crypto markets, 0.05 for sports, 0.04 for politics and finance, and 0 for geopolitics.
Say a politics market's YES ask is $0.40 and your agent estimates a 50% chance.
| Step | Math | Result |
|---|---|---|
| Buy 200 YES at $0.40 | 200 × $0.40 | $80.00 |
| Taker fee | 200 × 0.04 × 0.40 × 0.60 | $1.92 |
| Total cost | $80.00 + $1.92 | $81.92 |
| Payout if YES | 200 × $1 | $200.00 |
| Expected payout at 50% | 0.50 × $200 | $100.00 |
| Expected profit | $100.00 − $81.92 | $18.08 |
| Break-even probability | $81.92 ÷ $200 | 40.96% |
The agent needs the true chance to sit above 40.96% to profit over many such trades. The estimate has to be better than the market's. The gap has to survive fees.
Complete sets and the fee math
In a negative-risk event exactly one outcome resolves YES. One YES share of every outcome is a complete set, and it always pays $1. When the asks sum below $1 buying the set locks in the difference minus fees.
Take a three-outcome event in the "Other" category (fee rate 0.05) with YES asks of $0.30, $0.33 and $0.32.
| Outcome | Ask | Fee per share: 0.05 × p × (1 − p) |
|---|---|---|
| A | $0.30 | $0.0105 |
| B | $0.33 | $0.011055 |
| C | $0.32 | $0.01088 |
| Total | $0.95 | $0.032435 |
One set costs $0.95 + $0.032435 = $0.982435 and pays $1.00, netting about 1.76 cents. A hundred sets make about $1.76. The edge is real and thin. The asks move as soon as anyone else sees it. Circuit's market screen marks negative-risk groups and notes that a complete set costs less than its payout only when the asks sum below 1. An agent can check every event in one pass.
Paper trade on the live book
A Polymarket agent starts in paper trading by default. Polymarket orders fill against the live order book with paper funds, and redemptions pay each market's real resolution. Split, merge and convert settle against the same onchain market terms. You see what the agent would have bought, at what price and what it collected. No money moves.
Backtests on Circuit replay recorded Hyperliquid and Lighter markets only. A Polymarket agent is tested forward in paper trading. Give it enough time to see markets resolve. An agent that trades weekly markets needs weeks of paper results before they mean much. The paper trading guide lists what to check while paper trading.
Connect Claude Code
There are two separate connections. They do different jobs.
Docs for writing code. Circuit publishes its documentation as an MCP server. Add it to Claude Code with claude mcp add circuit --transport http https://docs.circuit.org/mcp. Claude then reads the current SDK reference while it writes your agent. The full docs are also at docs.circuit.org/llms-full.txt for tools that take a single file. With the Circuit CLI installed Claude can create a project with circuit new, check it with circuit check, run it against live markets with paper funds using circuit run --simulated, and upload it with circuit upload once you sign in. The TypeScript guide walks through the same loop for Hyperliquid.
Your account for reading and proposing. circuit auth login --assistant "Claude" connects Claude to your Circuit account through a browser handoff you approve with your passkey. You choose which wallets it may propose changes for and whether it may propose operations. A connected assistant reads your account with circuit wallet holdings, circuit agent list, circuit agent sessions, circuit operations get and circuit data, and submits wallet operation proposals with circuit ask --proposals <file>. Its permit can only read the account. It cannot build agents, upload code, confirm its own proposals or sign anything.
What the agent cannot do
Know the limits before you write the spec.
- Market orders fill or kill. A Polymarket market order fills against the book at once or not at all, and it pays the taker fee. To wait for a price, the agent places a limit order that rests until filled or canceled, or a post-only order (Circuit SDK).
- No historical backtest. Polymarket agents are tested in paper trading only.
- Resolution takes time. Polymarket's resolution page describes a 2-hour challenge period after a proposal. A disputed market adds a 24 to 48 hour debate and about 48 hours of UMA voting. Capital sits in the position until then.
- Minimums and ticks apply. Orders must meet the market's minimum shares and current tick size. Ticks go as small as 0.005 and 0.0025.
- Funding is separate. Polymarket settles in pUSD on Polygon. Before the agent trades Circuit prepares any approval or USDC.e wrapping as its own operation with its own deadline.
Risks
Prediction markets carry risks that perps don't.
- Rules decide outcomes. The title describes the question. The written rules decide how it resolves. An agent that reads only titles can be right about the world and wrong about the market.
- Thin books. Many markets have little depth beyond the best price. An agent that sizes from the displayed price can walk the book and pay far more. Screening reports an estimated fill price for a given stake. Size from that.
- Binary losses. A wrong position loses the full stake. Diversify across uncorrelated markets and cap each one.
- Correlated markets. Ten markets on the same election are one position. Cap exposure per event as well as per market.
- Code risk. The agent does exactly what its code says. Read the code the Builder writes. With the agent open in Circuit, run
/reviewand it reports risks and gaps before you start.
Keys and permits
Agents run on a self-custodial wallet you create in Circuit or import by private key. Signing keys stay inside an attested hardware enclave where agents can never see them. Instead, agents request typed actions through Circuit's SDK, and nothing is signed without the passkey permit you approve at start.
You can export your private key from Settings or stop an agent at any time. Stopping revokes the permit while leaving existing positions and resting orders open until you close them in Circuit.
What it costs
Circuit has no subscription. It charges 0.01% on Hyperliquid perp orders and spot sells (up to 0.01% on Hyperliquid outcomes) and on most swaps, and 0% on Polymarket, Lighter, Derive, Kraken, and Papertrade. Venue trading fees, network gas, and bridge or routing fees still apply; each proposal's Review shows reported costs before you confirm. See Pricing for the full schedule.
FAQ
Can Claude trade on Polymarket for me?
Claude Code can write a Polymarket agent directly against the Circuit SDK, or help you draft a spec to paste into Ask Circuit for the Builder. The agent trades. A connected Claude assistant can read your account and propose wallet operations, which you confirm with your passkey in Circuit.
Do I need to know how to code to build a Polymarket agent?
No. Describe the strategy to Circuit and the Builder writes and checks the code. You can read the code it writes. Developers can edit it directly with the Circuit CLI.
Is there an MCP server for Circuit?
Yes. It serves the documentation. claude mcp add circuit --transport http https://docs.circuit.org/mcp gives Claude Code the current Circuit docs while it writes code. Account access for an assistant uses the Circuit CLI's assistant sign-in. You approve it with your passkey.
Can I test a Polymarket agent without real money?
Yes. Agents start in paper trading by default. Polymarket orders fill against the live order book with paper funds and redemptions pay the market's real resolution.
What fees does a Polymarket agent pay?
Polymarket charges takers shares × feeRate × p × (1 − p). Rates vary by category. As of October 2026 politics is 0.04 and crypto is 0.07. Circuit charges no builder fee. Funding a wallet can cost Polygon gas or bridge fees. The review shows them before you confirm.
Can an agent redeem winning Polymarket positions automatically?
Yes. An agent redeems one resolved market per call. Both outcomes redeem together. A resolution trigger can wake the agent when a market it holds resolves.
Agents you can run now
Fork the whole strategy, rules and limits included, and run it from your wallet.
Trade it on Circuit.
Build it or fork it. Backtest it and run it in Paper trading before using real money.
Run It