Project

langgraph-langserve-starter

REST API template exposing a LangGraph research agent via LangServe — SQLite thread resume, streaming, Langfuse tracing and a zero-key fake-LLM mode.

  • #ai
  • #langgraph
  • #python
  • #fastapi
  • #open-source

langgraph-langserve-starter is an open-source Python template I built that exposes a LangGraph agent as a REST API through LangServe: github.com/AleSZanello/langgraph-langserve-starter.

The problem

Most LangGraph tutorials live in notebooks, and most LangServe examples wrap simple chains rather than state machines. This repo shows the seam between the two done correctly — including resuming a thread over HTTP.

Architecture

  • Graph. A StateGraph with three nodes — planner (splits a topic into sub-questions), researcher (answers each) and synthesizer (produces a typed ResearchReport). State is a TypedDict whose list fields accumulate through Annotated[list, operator.add] reducers.
  • API. FastAPI with LangServe add_routes publishes /research/invoke, /research/stream (token and node-event streaming), /research/batch and /research/playground, plus /health and OpenAPI docs.
  • Durable threads. A SqliteSaver checkpointer persists state across requests; passing a thread_id in the config resumes an interrupted research session. It is built directly on a sqlite3 connection so the checkpointer can outlive a with block.
  • Observability. Setting Langfuse keys mounts a callback handler on the app, so every invoke or stream produces a Langfuse trace.
  • Pluggable model. Google Gemini by default, with OpenAI and Anthropic Claude behind a one-line switch. Web search through Tavily is optional and falls back to LLM-only answers.
  • Zero-key mode. Without a Gemini key the server boots with a fake LLM and canned responses; tests use the same fake model with FastAPI's TestClient, so they run with no network and no keys.

Status

Live, 2026, MIT licensed.

Related