Prediction Market Execution.
Intents, triggers, routing, monitoring — for Kalshi and Polymarket.
Declare what you want done — market, side, size, price, trigger condition, expiry — and let the prediction market execution layer wait, risk-check, and route through your venue. Idempotent intents, condition-based triggers, audited status across both venues. Built for agents, operators, and institutional desks.

Open-outcry pit, 1980s — the chaos that resolves into trades.
Order lifecycle — seven steps
Every prediction market execution intent flows through the same lifecycle. The shape is constant; the policy in each step is the operator's.
01Intent
Operator or agent declares: market, side, size, price, trigger, expiry
02Trigger
Wait for the named condition — immediate, price level, time window, or monitored event
03Risk check
Pre-trade checks against the operator-configured risk parameters (size, exposure, drawdown caps)
04Venue route
Map normalized intent to Kalshi or Polymarket order shape; submit through the venue connection
05Order
The actual venue order receipt — submitted, working, partial, filled
06Fill / status
Status updates flow back: filled, partial, rejected, expired, cancelled
07Monitor
Continuous watch for fill drift, price drift, or follow-up condition the operator wants surfaced
Intent shape
Ten fields define every prediction market execution intent. Anything not in this shape is not part of the contract — operator policy lives outside.
marketIdVenue market ticker or Polymarket token id
KXRATECUT-26DEC31venueExecution venue
kalshi / polymarketactionBuy or sell
buydirectionYES / NO side or token direction
yestargetQuantityContracts or units
25maxPriceLimit price in cents
49triggerTypeimmediate · price_below · price_above · time · event
price_belowtriggerValueNumeric or temporal condition argument
0.49expireAtIntent expiry — ignore if condition never met
ISO datetimeidempotencyKeyOperator-supplied dedup key — same key = same intent
op-2026-04-30-abcStatus state machine
Every intent moves through a fixed set of states. Terminal states never transition. Subscribe to status changes to drive downstream agents and dashboards.
pendingIntent created, trigger condition not yet met
waitingwaitingTrigger armed, watching market state
routing | expiredroutingTrigger fired; risk-checked; submitting to venue
working | rejectedworkingOrder accepted by venue, partially or fully open
partial | filled | cancelledpartialSome contracts filled, the rest still working
filled | cancelled | expiredfilledFully executed at the venue
— terminal —rejectedRisk check failed or venue rejected the order
— terminal —expiredexpireAt elapsed before fill
— terminal —cancelledOperator or agent cancelled prior to fill
— terminal —Create an intent
REST API and CLI both produce the same intent record — different interfaces, one audit log.
POST /api/intentsJSON{
"marketId": "KXRATECUT-26DEC31",
"venue": "kalshi",
"action": "buy",
"direction": "yes",
"targetQuantity": 25,
"maxPrice": 49,
"triggerType": "price_below",
"triggerValue": 0.49,
"expireAt": "2026-12-30T23:59:00Z",
"idempotencyKey": "op-2026-04-30-abc"
}CLI — same intentterminalsf intent buy KXRATECUT-26DEC31 25 \
--venue kalshi \
--direction yes \
--price 49 \
--trigger price_below:0.49 \
--expire 2026-12-30 \
--idem op-2026-04-30-abc
sf intent watch op-2026-04-30-abc --jsonSimpleFunctions vs raw venue API
What the venue owns, what SimpleFunctions adds. Most production agents use both — the venue for the order, SimpleFunctions for the workflow around it.
What this layer is not
Honest constraints. Read these before designing a strategy on top of intents.
Not a broker, exchange, custodian, FCM, or investment adviser
SimpleFunctions provides software, APIs, and workflow primitives. The user owns the venue account and credentials; orders execute at the venue.
Not a globally enforced risk-gate cascade — yet
Risk-check primitives exist and most execution paths run them; end-to-end verification across every live path is in progress. Treat risk checks as a pre-trade safety net the operator configures.
Not a fill guarantee
Fill quality depends on venue liquidity, order type, posted price, and market conditions. Intents declare what to attempt; the venue determines outcomes.
Not a substitute for venue API knowledge
Operators still need to understand venue-specific contract types, fee structure, and settlement rules. The execution layer normalizes the workflow, not the underlying contract semantics.
FAQ
What is a prediction market execution workflow?
A prediction market execution workflow is a software primitive for turning a market view into an auditable intent — market, side, size, price, trigger condition, expiry — then waiting for the trigger, performing a pre-trade risk check, routing through the user's venue connection, and monitoring status. The intent persists across restarts and survives the agent that created it.
Who is this for?
AI agents that need to delay an order until a price or event condition is met; operators running systematic strategies; institutional desks that need an auditable intent record before any order hits a venue; research workflows that simulate strategies before live deployment.
Does SimpleFunctions execute orders directly at Kalshi or Polymarket?
SimpleFunctions provides software, APIs, and workflow primitives. It is not a broker, exchange, custodian, FCM, or investment adviser. Orders route through the user's configured venue connection at Kalshi or Polymarket. The user owns the venue account and credentials.
What trigger types are available?
immediate (route now), price_below / price_above (wait for the venue price to cross a threshold), time (wait until a timestamp), and event (wait for a monitored upstream condition like a Fed announcement window). Triggers can be combined — for example, price_below within a time window.
How do risk checks work?
Pre-trade checks evaluate the intent against operator-configured risk parameters before the order is routed — typical checks include max position size per market, total notional exposure, daily loss caps, and venue-specific limits. Each operator configures their own risk profile; checks are pre-trade and conservative.
Are risk gates enforced on every live execution path?
Risk-check primitives exist and most execution paths run them; the team is in the process of verifying every live path end-to-end before describing this as a global guarantee. Today, treat risk checks as a pre-trade safety net the operator configures, not as a globally enforced cascade.
How does idempotency work?
Each intent carries an operator-supplied idempotencyKey. Posting the same key twice returns the same intent — the second call is a no-op. This makes retry-on-failure safe for agent loops and replayable for backtests.
What status updates does the system emit?
Intents move through pending → waiting → routing → working → (partial / filled / rejected / expired / cancelled). Each transition is timestamped and logged with the actor (operator user id, agent id) and the reason. Downstream agents and dashboards can subscribe to status changes.
Can an AI agent create and manage intents?
Yes. Agents create intents through the API or the SimpleFunctions CLI, attach triggers, and observe status updates. The intent layer is the contract between an agent's reasoning and the venue's execution; agents reason against intents, not raw orders.
How is this different from calling Kalshi or Polymarket's API directly?
You can absolutely call the venue APIs directly. SimpleFunctions adds a normalized intent shape across both venues, condition-based triggers (price/time/event) the venues do not natively expose, idempotency by design, and a single audit-log surface. Most production agents use both — the venue for the order, SimpleFunctions for the workflow around it.
What about partial fills and order amendments?
Working orders that partially fill remain in the working state with cumulative fill metadata; the remainder continues until the venue closes it or the intent expires. Amendments (price changes) cancel the existing venue order and re-submit; the intent persists across the swap so the audit trail stays clean.
Does SimpleFunctions guarantee fills?
No. Fill quality depends on venue liquidity, order type, posted price, and market conditions. SimpleFunctions provides intent, trigger, routing, and monitoring primitives; the venue determines fills.
Related surfaces
Prediction Market Hedging
Map real positions to event markets — the upstream that feeds intents.
Real-Time Data API
Sub-second WebSocket feed — what triggers actually watch.
Prediction Market API
Queryable normalized markets across Kalshi + Polymarket.
Agentic CLI
Command surface for agents to create and watch intents.
Agentic Usage
Patterns for AI agents on real-time data + execution.
Institutions
Institutional infrastructure overview.
Kalshi CLI
Operator command-line for Kalshi-specific workflows.