Agent skill · software engineering · jeremylongshore
langchain-langgraph-streaming
Pick the correct LangGraph 1.0 stream_mode ("messages" vs "updates
Why this skill is useful
Adds a production-grade FastAPI SSE endpoint with anti-buffering headers and a server-side event filter that significantly reduces noise in streaming data.
What it needs
Requires fastapi, langchain-core, langgraph, python, uvicorn installed locally. About 8k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.
What this skill does
LangGraph Streaming (Python) Overview An engineer ships streammode="values" to a token-level chat UI because it "seemed the most complete." Every single token causes the full graph state — message history, scratchpad, plan — to be re-sent and re-rendered. At ~60 tokens/sec the browser overdraws, the React reconciler can't keep up, the tab freezes, and users blame the model. The correct answer was streammode="messages", which emits an AIMessageChunk delta per token (typically 5-50 bytes) — one token's worth of DOM work. This is pain-catalog entry P19 and it is the #1 LangGraph integration mistake in the 1.0 generation. Then the same UI ships to Cloud Run and hangs forever. No error. No logs. The server is emitting tokens; they just never reach the browser. Default proxy buffering (Nginx, Cloud Run's HTTP/1.1 path, Cloudflare Free) holds the last chunk waiting for more bytes. This is P46 — SSE streams from LangGraph drop the final end event over proxies that buffer — and the fix is three headers: X-Accel-Buffering: no, Cache-Control: no-cache, Connection: keep-alive. And then the debug view starts crashing browser tabs on long runs. The engineer forwarded astreamevents(version="v2") raw to the client because "it has more detail" — but v2 emits thousands of events per invocation (per-token, per-node, per-runnable lifecycle), and a 60-second agent run easily hits 3,000 events. Browsers freeze on the JSON deserialize queue. This is P47 — filter server-side, forward only onchatmodelstream tokens (and optionally ontoolstart / ontoolend). This skill ships the decision matrix, a production-grade FastAPI SSE endpoint with the anti-buffering headers and a 15-second heartbeat, a server-side v2 event filter that drops ~90% of noise, and a WebSocket variant with reconnect-by-threadid that resumes from the LangGraph checkpointer. Pin: langgraph 1.0.x, langchain-core 1.0.x. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills jeremylongshore/langchain-langgraph-streaming