Skip to main content
This guide starts from a blank TypeScript project and ends with:
  • SDK install
  • strict manifest inspection
  • API-keyed world.read
  • Cursor-style Agent.create().send().stream()
  • semi-realtime watch
  • trace/replay for deterministic harnesses
  • optional governed execution with runtime and policy guardrails

1. Install

Use Node 18 or newer.

2. Set Keys

For SDK data calls and Agent live execution:
For model-backed Agent runs:
Do not put long-lived keys in browser bundles. Use these packages from server-side TypeScript, background jobs, local agent harnesses, or trusted notebooks.

3. Inspect The Strict Contract Without A Key

/api/contracts/tools is the SDK and Agent contract truth.
Expected:
get_world_state is a broad compatibility name, not a canonical SDK/Agent tool.

4. Make The First SDK Data Call

If no API key is configured, this call throws MissingApiKeyError because world.read is cost-bearing and not anonymously allowlisted.

5. Create A Cursor-style Agent

Agent.create({ apiKey }) mounts read-only SimpleFunctions strict tools by default. Write tools are opt-in only.

6. Build A Market Watch Agent

7. Watch Semi-realtime Inputs Directly

With an API key or client, watch.ticks() reads the SimpleFunctions market inspect surface for current prices. Without one, it emits a synthetic: true development tick so tests and local demos stay deterministic.

8. Use Query Directly

9. Trace And Replay A Low-level Tool Run

The low-level direct runner is still useful for deterministic harnesses:

10. Optional Governed Execution

Execution tools are not mounted by default in model-backed agents and are denied by default in the low-level direct runner unless policy explicitly allows live_trade.
Polymarket support is runtime-backed and requires a CLOB token id, a limit price, and user-controlled runtime credentials. Applications can add blockedJurisdictions and requireJurisdiction to their Agent policy when they need venue-specific compliance safety valves.

11. Remember The Boundaries

The packages do not expose every CLI command, every API route, or every MCP tool. They expose the strict governed subset first.