Skip to main content

The problem

Autonomous agents (LLM-driven or otherwise) that trade prediction markets need three things at once: a clean market data feed, a safe execution surface with strong idempotency guarantees, and a way to reason about wallet state without ambiguity. Wiring an agent to Polymarket’s raw contracts requires custom code to smooth all three.

What Bravado provides

  • Semantic endpoints. Every action an agent might want (place order, get positions, look up a market, compute PnL) is a single REST call with typed request and response.
  • Idempotency. Every mutating call requires an Idempotency-Key header. Agents that retry on failure cannot double-execute. See Idempotency.
  • Machine-readable docs. llms.txt and llms-full.txt are published so any code-generation agent can consume the full API surface without scraping.
  • Optional MCP server. For agent frameworks that support the Model Context Protocol, Bravado exposes a hosted MCP endpoint.

APIs used

The UMA API endpoint reference is still being written. Until it lands, resolution state has to be inferred from position data. See UMA API.

Worked example

An LLM tool-calling function that lets an agent evaluate a market and place a scaled position:
Register these as tools with the agent framework (LangChain, OpenAI function-calling, Anthropic tool use, etc.) and constrain max_notional_usd at the tool boundary so the agent cannot exceed a budget per action.

Safety patterns

  • Per-tool notional caps. Enforce dollar limits at the tool layer, not in the agent’s prompt.
  • Dry-run mode. Route to a test wallet or a preview endpoint during development.
  • Cooldowns and daily caps. Reject tool calls that exceed a rolling limit.
  • Full audit trail. Every mutating call has an idempotency key. Log them per agent session for post-hoc review.