Case study 03

Stock AI

Ask about any stock in plain English. An agent fetches live market data and answers.

Ask about any listed company. The agent looks up live prices, metrics, financials and screeners itself.

Data from Yahoo Finance, may be delayed. Answers are written by an LLM and are not investment advice.

Overview

Stock AI is an HTTP API for stock market data with an LLM agent on top. You ask a question such as "What is Nvidia trading at and what is its P/E?" and the agent decides which data it needs, calls the right tools, and answers in Markdown with tables.

It merges two earlier projects, an MCP server of stock tools and a LangGraph stock screener, into one FastAPI service. The same tools are also available as an MCP server, so Claude Desktop or an IDE can use them directly.

It is built to be called from a public website: API-key auth, per-IP rate limits, restricted CORS, response caching and clear error codes. The live demo on this site calls it through a server-side proxy so the key never reaches the browser.

What it does

How it works

  1. 01The client sends a question, plus the thread ID of an ongoing conversation.
  2. 02The API checks the key and rate limit, then loads that thread's recent history.
  3. 03The agent plans which tools to call and fetches live data from Yahoo Finance through yfinance, using cached results where fresh enough.
  4. 04The model writes a Markdown answer from the data and returns it with the list of tools it used.
  5. 05The thread is saved, so the next message continues the same conversation.

Stack

More projects

Work with me