Index of every page on this site: llms.txt
All skills
jeremylongshore avatar

/langchain-langgraph-streaming

@0d57af8
Run it yourself

Pick the correct LangGraph 1.0 stream_mode ("messages" vs "updates" vs "values"), wire it into SSE or WebSocket without proxy-buffering gotchas, and filter astream_events(v2) server-side before forwarding to the browser. Use when building a live-token chat UI, a per-node progress bar, a debug/time-travel view, or diagnosing a LangGraph stream that hangs over a production proxy. Trigger with "langgraph streaming", "stream_mode messages", "stream_mode updates", "stream_mode values", "langgraph SSE", "langgraph astream_events", "SSE hangs behind nginx", "cloud run streaming".

Use this Skill: https://skilld.dev/gh/jeremylongshore/tons-of-skills-marketplace/langchain-langgraph-streaming

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesone-pager.md

≈883 tokens on demand. Your agent reads this file only when SKILL.md points to it.

langchain-langgraph-streaming — One-Pager

Pick the right LangGraph 1.0 stream_mode, wire SSE/WebSocket without proxy buffering gotchas, and filter astream_events(v2) before it floods the browser.

The Problem

Ship stream_mode="values" to a token-level chat UI and every token re-renders the full conversation state — overdraw, tab freeze, users blame the model. Ship "messages" to a per-node progress bar and the bar never advances because you're receiving tokens, not node transitions. The same UI that worked on localhost then hangs forever on Cloud Run or behind Nginx because default proxy buffering holds the last chunk (P46). Forward raw astream_events(version="v2") straight to the browser and a 30-second agent emits thousands of lifecycle events — on_chain_start, on_tool_end, one per token, per node, per runnable — and the browser's message queue crashes the tab (P47). Three picks, three production failure modes, all silent.

The Solution

This skill walks the three LangGraph 1.0 stream_mode options with a decision matrix ("messages" for token-level chat UI, "updates" for per-node progress bar, "values" for debugger/time-travel, combined list for hybrid dashboards); a production-grade FastAPI SSE endpoint with the required headers (X-Accel-Buffering: no, Cache-Control: no-cache, Connection: keep-alive) plus a heartbeat to keep idle connections open; a server-side astream_events(version="v2") filter that drops everything except on_chat_model_stream tokens and optionally on_tool_start/on_tool_end for progress; a WebSocket variant with reconnect-by-thread_id resume from checkpointer state; and a proxy-readiness checklist because localhost is not production. Pinned to LangGraph 1.0.x.

Who / What / When

Aspect Details
Who Frontend/backend engineers wiring live-token chat UIs, per-node progress bars, or debug/time-travel views on top of LangGraph 1.0 agents
What Stream-mode decision matrix, FastAPI SSE endpoint template with anti-buffering headers and heartbeat, astream_events(v2) server-side filter, WebSocket reconnect-by-thread_id, proxy-readiness checklist, 4 references (stream-mode-comparison, sse-endpoint-template, astream-events-filtering, websocket-and-reconnect)
When When you first wire a LangGraph agent to a browser — before it ships past localhost; also when diagnosing a stream that works locally but hangs over production proxies, or a UI that freezes on long invocations

Key Features

  1. Stream-mode decision matrix — Three modes ("messages" / "updates" / "values") mapped to UI type, payload shape, overdraw risk, and typical bandwidth; combined-mode syntax (stream_mode=["updates", "messages"]) for hybrid dashboards; one table picks the right mode in seconds
  2. Proxy-ready SSE endpoint — FastAPI StreamingResponse with X-Accel-Buffering: no, Cache-Control: no-cache, Connection: keep-alive, proper text/event-stream content type, 15-second heartbeat pings for idle streams, and reverse-proxy snippets for Nginx / Traefik / Cloud Run that actually flush chunks
  3. astream_events(v2) server-side filter — Forwards only on_chat_model_stream tokens (and optionally on_tool_start / on_tool_end for progress), drops thousands of runnable lifecycle events before they reach the browser; compression and backpressure patterns for long invocations

Quick Start

See SKILL.md for full instructions.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    The skill provides production-grade templates and instructions for implementing streaming in LangGraph 1.0 applications using FastAPI. It addresses common performance and connectivity issues like proxy buffering and browser event flooding. A low-severity risk of indirect prompt injection is present as the skill helps build endpoints that ingest untrusted user data for LLM processing.

  • Socket2mo

    1 alert: gptAnomaly

  • Snyk2mo

    Risk: LOW · No issues

Signed by skilld at 0d57af8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 2 months ago
What it can do
Reads files Edits files Runs commands
version
2.7.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
compatibility
Designed for Claude Code
All 4 allowed tools
ReadWriteEditBash(python:*)
Other metadata
tags
[
  "saas",
  "langchain",
  "langgraph",
  "python",
  "langchain-1.0",
  "streaming",
  "sse",
  "websocket"
]

README badge

README badge for jeremylongshore/tons-of-skills-marketplace/langchain-langgraph-streaming