Widget Data APIs

Endpoints that feed Tier 2 hybrid components with live data.

Tier 2 smart components render on the client but fetch their data from the agent. Each component maps to one endpoint. The agent owns the API keys and upstream calls, so widgets stay simple.

Live data

GET /api/widget/weatherendpoint

Powers live_weather. Query a city; returns current conditions + hourly forecast.

bash
curl "http://127.0.0.1:8000/api/widget/weather?city=Tokyo"
GET /api/widget/stockendpoint

Powers live_stock. Query a symbol; returns price series for the sparkline.

bash
curl "http://127.0.0.1:8000/api/widget/stock?symbol=AAPL"
GET /api/widget/exchange_ratesendpoint

Powers currency_converter. Returns live rates against a base currency.

GET /api/widget/newsendpoint

Powers news_ticker. Returns headlines (optionally by topic). Requires NEWS_API_KEY.

On-demand lookups

GET /api/widget/wikiendpoint

Powers wiki_summary. Returns a Wikipedia article summary card.

GET /api/widget/wordendpoint

Powers dictionary. Returns definitions + phonetics for a word.

POST /api/widget/translateendpoint

Powers translator. Translates text between languages.

GET /api/widget/rssendpoint

Powers rss_reader. Fetches and parses an RSS feed into headline cards.

GET /api/widget/astronomyendpoint

Powers astronomy. Returns NASA's Astronomy Picture of the Day + live ISS position.

GET /api/sportsendpoint

Powers live_sports. Returns live/recent scores for a sport (soccer | basketball | american_football | cricket).

GET /api/recipeendpoint

Powers recipe_viewer. Returns a step-by-step recipe (search or random).

Tip

Because the agent fronts these APIs, the LLM should emit the Tier 2 component (e.g. live_weather) rather than JIT code for weather/stock/news/translate/define queries — the widget calls the endpoint itself and renders beautifully with zero generated code.