Build a Polymarket trading agent with Claude
Updated by the Circuit team
Three ways to build it
You can get a working Polymarket agent out of an AI assistant in three ways on Circuit. All three 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 connected as an assistant | Circuit's Builder, driven by Claude | The Circuit CLI and a connected assistant login | People who already work in Claude Code |
| 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. Open Circuit at app.circuit.org and describe the strategy. The Builder writes the agent, checks the code and lets you test it. The other two routes use Claude as the interface. The guide on trading with Claude and other assistants covers what a connected assistant can read and suggest.
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.
Prompts that work
The Builder turns a plain-English 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. That is a profit of 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 simulated 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 in a paper session.
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 simulated funds using circuit run --paper, and upload it with circuit upload once you sign in. The TypeScript guide walks through the same loop for Hyperliquid.
Your account for building and suggesting. 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 suggest changes for and whether it may build agents. A connected assistant builds new agents through the Builder with circuit ask --build "<strategy>" --wait. Its permit can only read the account. It cannot upload code, approve its own suggestions or sign anything. Starting the agent it built waits for you in Circuit.
What the agent cannot do
Know the limits before you write the spec.
- No resting Polymarket orders. Circuit sends Polymarket orders as fill-or-kill: the whole order fills against the book at once or nothing does. An agent can't post a bid and wait. It can't market-make on Polymarket through Circuit and it always pays the taker fee.
- 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 wallet you create in Circuit or import by private key. Circuit keeps the signing key in a hardware enclave. Agents never see it. An agent requests typed actions through Circuit's SDK. Nothing is signed without the permit you sign with your passkey when you start the agent.
You can export the private key from Settings at any time. You can pause, resume or stop an agent at any time. Stopping leaves your positions and resting orders in your account. You ask Circuit to close them.
What it costs
Circuit charges no fees today and adds no builder fee to Hyperliquid or Polymarket orders. You pay the venue's trading fees, network gas and any bridge or routing fees. Each prepared action's review shows the costs it reports before you confirm. Today's terms make no commitment about future fees.
FAQ
Can Claude trade on Polymarket for me?
Claude can write a Polymarket agent through Circuit's Builder or directly against the Circuit SDK. The agent trades. A connected Claude assistant can read your account, build agents through the Builder and suggest actions. You approve each suggestion 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 login. 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 simulated 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.
Build it on Circuit
Circuit writes the agent and backtests it. Paper trade it before you fund it.
Build your agent