Reference agent for the Fanfare sports API — real-time sports intelligence (schedules, tickets, travel) for MLB, NBA, WNBA, NHL, NFL, and the 2026 FIFA World Cup. Each API call is paid automatically via the x402 protocol ($0.001–$0.25 USDC on Base per request, no subscription).
Two complete implementations:
| Python | TypeScript | |
|---|---|---|
| Framework | LangGraph ReAct | Vercel AI SDK |
| LLM | Claude via langchain-anthropic |
Claude via @ai-sdk/anthropic |
| x402 client | x402[evm,requests] |
@x402/fetch + @x402/evm |
| Examples | game_night.py, world_cup.py |
game-night.ts, world-cup.ts |
Plans your evening around any game: arrival time, Ticketmaster tickets, weather, and nearby dining — all in one API call.
You: Plan my evening for the Red Sox game on June 10
Agent: Here's your game-night plan for Red Sox vs Yankees, June 10 at Fenway Park:
• Kickoff: 7:10 PM ET — arrive by 6:25 PM (35 min before first pitch)
• Weather: 68°F, partly cloudy — perfect evening for baseball
• Tickets: From $45 (bleacher reserve) to $220 (field box) — ticketmaster.com/...
• Dinner: Island Creek Oyster Bar (0.3 mi) — New England seafood, book ahead
Books the whole trip: match schedule, flights from your airport, hotels near the venue, and local dining.
You: Plan a trip to see Argentina play June 19, fly from JFK
Agent: Argentina vs Canada — June 19, 8:00 PM ET at MetLife Stadium, East Rutherford NJ
Flights from JFK (same day):
• Delta DL 4821 — 3:15 PM departure — $89 one-way
Hotels near MetLife (1 night):
• Marriott Meadowlands — $189/night — 2.1 mi from stadium
• Courtyard Lyndhurst — $145/night — 3.4 mi from stadium
Weather: 74°F, clear skies
Dinner: Connolly's Pub & Restaurant — Irish-American, 0.5 mi from stadium
cd python
pip install -r requirements.txt
cp .env.example .env # add WALLET_PRIVATE_KEY and ANTHROPIC_API_KEY
source .env
python examples/game_night.py
python examples/world_cup.pycd typescript
npm install
cp .env.example .env # add WALLET_PRIVATE_KEY and ANTHROPIC_API_KEY
source .env
npm run game-night
npm run world-cupBoth agents pay for API calls automatically from a Base mainnet wallet. You need:
- A Base wallet private key — create one at Coinbase or use any EVM wallet
- USDC on Base mainnet — bridge from Ethereum or buy directly on Base
- A small amount of ETH on Base for gas (< $1 covers thousands of requests)
Game-night queries typically cost $0.05 USDC (one bundle call). World Cup trip queries with flights and hotels cost $0.25 USDC.
Full docs at fanfare.run/docs. Key endpoints used by these agents:
GET /v1/game-night-bundle— game + tickets + weather + dining ($0.05)GET /v1/game-trip-bundle— game-night bundle + flights + hotels ($0.25)GET /v1/playoff-tracker— upcoming games with playoff flag + tickets ($0.05)GET /v1/world-cup-bundle— World Cup match + city intel + travel ($0.25)GET /mlb/schedule,/nba/schedule, etc. — sport-specific data ($0.001)
MIT