SimpleFunctions

Congress.gov for agents.

CLI + REST/API + MCP adapter for 425K bills, 538 members, and the prediction markets pricing each one.

Two ways in. Use it as the agent-callable Congress data feed: one call fans out to Congress.gov, Open States, nominations, and CRS reports in parallel and returns an aggregated LLM answer with the named key factors. Or use it as a market edge: the same call attaches the matched Kalshi and Polymarket contracts from the platform's 143 legislation-market pairs. No auth required for normal usage; Bearer token raises the rate limit and routes to heavier model tiers.

Realist oil painting in Jacques-Louis David neoclassical style — Athens, the Pnyx hill, 5th-century BCE: citizens deliberating on public policy

Athens, Pnyx hill, 5th century BCE — the original deliberative body.

An aggregated LLM answer over Congress + markets

This is what the government data API does that Congress.gov can't. The aggregator reads bills, nominations, members, CRS reports, and the matched Kalshi / Polymarket markets, then returns a single synthesized answer with the named key factors and the matched contracts. Two real responses below.

One natural-language query → one synthesized answer → key factors → bills → matched markets.

sf policy exposes the same aggregator from a terminal.

Querysave act
aggregated

LLM answer

Prediction markets currently indicate a low probability for the SAVE Act (H.R. 22) becoming law, with Kalshi pricing the event at 10¢ and Polymarket at 11¢ for 2026. Data suggests no active movement on the bill on the current legislative calendar.

Key factors

  • ·H.R. 22 (referenced from market title)
  • ·Low market confidence — 10–11¢ across venues
  • ·Legislative stagnation — no recent committee action

Bills

  • 119-hr-22SAVE Act — H.R. 22

Matched markets

Will "SAVE Act" (H.R. 22) become law before Jan 4, 2027?

kalshi

10¢

Will the SAVE Act be enacted in 2026?

polymarket

11¢
Queryepstein files release
aggregated

LLM answer

Prediction markets currently indicate significant skepticism regarding the release of Data Set 13 under the Epstein Files Transparency Act, with prices of 10¢ for a release before September 1, 2026, and 14¢ for a release before January 1, 2027.

Key factors

  • ·Epstein Files Transparency Act — referenced in market titles
  • ·DOJ release schedule — markets price low confidence
  • ·10–14¢ range across two staggered deadlines

Matched markets

Will the DOJ release Data Set 13 (Epstein Files) before Sep 1, 2026?

kalshi

10¢

Will the DOJ release Data Set 13 (Epstein Files) before Jan 1, 2027?

kalshi

14¢

These cards render real responses from /api/public/query-gov. When the bills array is empty the aggregator still names the relevant bill from market titles (H.R. 22, Epstein Files Transparency Act). The full wire shape is documented further down.

Bills, markets, members, and nominations — in one call

The endpoint understands natural language. Ask about a bill by name, a policy topic, or a person. It fans out to four data sources in parallel, re-ranks by relevance, and (in mode=full) synthesizes an answer.

01

Congress.gov bills

Mirror-backed bill search enriched with market pairs. Bill numbers, titles, status, sponsors, recent actions.

02

Prediction markets

Kalshi and Polymarket policy markets — bill-passage odds, confirmation votes, shutdown markets, tariff-rate markets.

03

Nominations

PN numbers, committee referrals, confirmation status. The aggregator joins each nomination to its prediction market when one exists.

04

State legislation

Open States cross-reference when a state is mentioned. All 50 states; California and New York coverage is densest.

Six public endpoints — no auth required for normal usage. The aggregator at/api/public/query-govis the entry point; the others are direct accessors.

Method
Path
What it returns
GET
/api/public/query-gov?q=...
Aggregated answer + bills + markets + nominations
GET
/api/public/query-gov?q=...&mode=raw
Skip LLM synthesis — structured arrays only, fastest
GET
/api/public/legislation
List legislation with attached prediction-market pairs
GET
/api/public/legislation/:billId
Bill detail — sponsors, actions, related state bills
GET
/api/public/congress/members
All current Congress members with directory metadata
GET
/api/public/congress/member/:id
Member detail — bills sponsored, terms, committees
Param
Type
Meaning
q
string
Natural-language query (required, min 2 chars)
mode
raw | full
Skip or include LLM synthesis (default: full)
sources
csv
Pick sources: congress, openstates, kalshi, crs (default: all)
limit
1–20
Max results per source (default: 10)
depth
true | false
When true, fetch bill actions + market orderbook (slower)

Three ways to query

Same aggregator, three transports. Pick the one that matches the runtime — REST for any HTTP client, CLI for terminal-resident workflows, MCP for Claude Code / Cursor / any MCP host.

REST

No auth required. JSON in, JSON out. Add &mode=raw to skip LLM synthesis.

curl "https://simplefunctions.dev/api/public/query-gov?q=government+shutdown"

CLI

sf policy searches bills + markets in one call. sf bill <id> returns full detail.

sf policy "save act"

MCP

query_gov + legislation tools for Claude Code, Cursor, or any MCP-compatible host.

claude mcp add simplefunctions --url https://simplefunctions.dev/api/mcp/mcp

Data sources

Each query fans out to multiple sources in parallel. Results are de-duplicated, enriched with the platform's 143 legislation-market pairs, and re-ranked by relevance.

Congress.gov mirror

425K+ bills, 538 members, nominations, CRS reports. LLM-expanded search finds bills by name, acronym, or topic — keyword fan-out runs in parallel with the raw query.

e.g. SAVE Act, HR 22, immigration reform

Kalshi

Policy prediction markets — bill-passage odds, confirmation votes, shutdown markets, tariff-rate markets. Live prices and 24h volume.

e.g. KXSAVEACT, KXGOVSHUT, cloture votes

Open States

State-level legislation for all 50 states. Cross-referenced when the query mentions a state, governor, or state-specific policy area.

e.g. California AI bill, Texas immigration

Legislation-market pairs

143 mapped pairs (and growing) linking Congress bills and nominations to Kalshi or Polymarket contracts. Updated weekly by the platform; surfaced in every response.

e.g. Which bills have prediction markets?

How it works

Four phases — query understanding, parallel fan-out, merge and enrich, re-rank and synthesize. The pipeline below shows a real run for the query “government shutdown”.

01

Query understanding

LLM extracts bill references (HR 22), jurisdictions (California), person names, and 2–3 expanded search terms from the natural-language query. Total: ~600 ms for the first phase.

02

Parallel fan-out

The raw query hits the Congress mirror, Kalshi, the nomination directory, and Open States simultaneously. After the LLM returns expansions, those fire in a second parallel batch. Total round-trip: typically ~3 seconds in mode=full.

03

Merge and enrich

Results de-duplicated across sources. Bills are matched against the 143 legislation-market pairs to surface live prediction-market prices alongside the bill record.

04

Re-rank and synthesize

Bills with attached markets rank higher; policy-area match boosts score. mode=full runs an LLM synthesis pass that produces a 1–3 sentence answer citing bill numbers and market probabilities.

Pipeline — “government shutdown”~3 s
Phase 1 (parallel):
  LLM      → ["government shutdown",
              "continuing resolution",
              "appropriations bill"]
  Congress → 8 bills from mirror search
  Kalshi   → 4 policy markets
  Noms     → 250 fetched, 0 matched

Phase 2 (parallel):
  Congress → +6 bills from expanded queries

Merge:
  10 unique bills, 4 markets
  1 bill has market pair
  Total: 2955ms

Use cases

Four shipped integrations. The government data API is deliberately minimal so it composes — most production callers chain it into a follow-up call against the inspect endpoint.

Policy analysts

Track bill progression alongside market-implied probability. Know when the Senate vote odds shift before the press release lands.

?q=government shutdown

Trading desks

Cross-reference legislative status with Kalshi prices. Find confirmation-vote markets with mispriced odds based on committee status the desk already knows.

?q=fed chair nomination

Journalists

Live probability snippets for policy stories. The article body becomes the query; the response carries the matching bill and market price.

?q=tariff on chinese goods

AI agents

Drop legislative context into any agent loop. The aggregated answer fits in a context budget; the raw markets array is there for downstream actions.

?q=epstein files release

Read next from the library

Matched from SimpleFunctions blog, opinions, technical guides, concepts, and learn pages.

Browse library

FAQ

What is the government data API?

A REST endpoint at /api/public/query-gov that takes a natural-language query and returns an aggregated LLM answer over Congress.gov bills, US Congress members, nominations, CRS reports, and Open States legislation — cross-referenced with live Kalshi and Polymarket prediction-market prices. The aggregator is the differentiator: one call returns the synthesized answer + named key factors + the matched bills + the matched markets.

How fresh is the data?

Congress.gov mirror is refreshed at least daily; high-traffic bills re-poll on shorter windows. Kalshi market prices and volume update in near real-time through the live data layer. Open States state legislation refreshes daily. Nominations are pulled from the Congress mirror on the same schedule as bills.

How is this different from calling Congress.gov directly?

Congress.gov gives you raw legislative records — useful but unjoined. The government data API joins those records to live prediction-market prices, runs an LLM aggregator that produces a one-paragraph synthesized answer plus named key factors, and surfaces nominations and state legislation in the same response. The differentiator is the aggregation, not the raw record fetch.

Which Congress members are covered?

All 538 sitting members of the current Congress (House + Senate + non-voting delegates). The /api/public/congress/members endpoint lists everyone; /api/public/congress/member/:id returns sponsorships, committees, terms, and contact metadata for a single member.

How is legislation cadence handled?

Bills are pulled from the Congress.gov mirror on the daily refresh cycle and joined against the platform's 143 legislation-market pairs. New bills appear in /api/public/legislation as soon as the mirror refresh completes; market pair attachments propagate within the next refresh cycle.

What about CRS reports and "deep state" markets?

CRS report search is included in the aggregator fan-out (sources includes crs by default). Markets the press calls "deep state" — DOJ disclosure, agency-action, intel-community markets — are surfaced through the standard Kalshi feed; the aggregator joins them whenever the query keywords overlap.

Does it work for AI agents?

Yes — the response is shaped for tool-use. The nextActions block names the next URLs the agent should fetch (inspect for market depth, related for adjacent endpoints). Agents typically call mode=raw on the first hop (cheap, fast), then call inspect for the chosen ticker and member-detail for the named senator on the second hop.

What is the JSON shape?

Top-level fields: query (echoed), answer (synthesized text), keyFactors (string[]), bills (Bill[]), nominations (Nomination[]), markets (Market[]), meta (sources, mode, latencyMs, ts), nextActions ({ inspect: Action[], related: Action[] }). Bill records carry id, title, status, hasMarket, optional market reference; Market records carry ticker, price, volume, plus pageUrl, apiUrl, and inspectUrl that are all fully qualified.

Is there a free tier?

Yes. Unauthenticated access is rate-limited to 10 requests per minute and uses the cheap LLM tier. Add a Bearer token for 60/min and the medium tier; auth + heavy tier routes to the heaviest model. All legislative read endpoints are public.

How do I search for a specific member?

Use /api/public/congress/members?q=name to filter the directory by name, or /api/public/congress/member/:id for a known member id. The aggregator at /api/public/query-gov also catches person names — phrasing like "what is senator X working on" returns sponsored bills + matched markets in one call.

Is the bill detail comprehensive?

The bill detail endpoint (/api/public/legislation/:billId) returns sponsors, recent actions, related state bills, the attached prediction-market record (when one exists), and the LLM-extracted summary. It is not a substitute for the Congress.gov record itself for legal-grade citation; use it for working analysis and treat Congress.gov as the authoritative source.

Are next-actions URLs absolute?

Yes. Every URL in the response — pageUrl, apiUrl, inspectUrl, nextActions[].url — is fully qualified (https://simplefunctions.dev/...). Agents can fetch them directly without joining against a base URL.

Related surfaces