Skip to content

Add LangGraph workflow streams sample#315

Open
brianstrauch wants to merge 7 commits into
mainfrom
langgraph-streaming-sample
Open

Add LangGraph workflow streams sample#315
brianstrauch wants to merge 7 commits into
mainfrom
langgraph-streaming-sample

Conversation

@brianstrauch

Copy link
Copy Markdown
Member

What

Adds a Graph-API sample demonstrating the LangGraph plugin's recently-added Workflow Streams support, under langgraph_plugin/graph_api/streaming/.

It combines both streaming patterns in one workflow:

  • Node token streaming — the write_story node emits live tokens via LangGraph's get_stream_writer(), routed onto the tokens topic by the plugin's streaming_topic.
  • Workflow-side astream publish — the workflow drives the graph with app.astream(...) and publishes each node-completion chunk onto a progress topic it owns via WorkflowStream.topic().publish().

A single client subscribes to all topics with WorkflowStreamClient and demultiplexes on item.topic. The workflow waits on an ack_stream signal before returning so the stream survives until the client finishes consuming it.

Dependency changes

  • Bumps the langgraph group to temporalio>=1.28.0 (where workflow streams ship).
  • Drops the now-obsolete langsmith<0.7.34 uv constraint — 1.28.0 requires langsmith>=0.7.34, and the pin was specific to the 1.27.2 langsmith patch. Existing langgraph tests still pass on the resulting langsmith 0.8.9.

Also adds langgraph_plugin/ code owners.

Testing

  • Added tests/langgraph_plugin/streaming_test.py; the full tests/langgraph_plugin/ suite passes (12 passed) on temporalio 1.28.0 / langsmith 0.8.9.
  • ruff format/import checks and mypy are clean for the new files.

🤖 Generated with Claude Code

brianstrauch and others added 2 commits June 4, 2026 15:27
Demonstrate the LangGraph plugin's Workflow Streams support: a node emits
live tokens via get_stream_writer() (routed by the plugin's streaming_topic),
and the workflow publishes coarse astream progress to its own topic. A single
client subscribes to all topics and demultiplexes on item.topic.

Bumps the langgraph group to temporalio>=1.28.0 (where workflow streams ship)
and drops the now-obsolete langsmith<0.7.34 constraint, which was specific to
the 1.27.2 langsmith patch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
brianstrauch and others added 2 commits June 8, 2026 13:27
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread langgraph_plugin/README.md
Comment thread langgraph_plugin/graph_api/streaming/run_workflow.py
brianstrauch and others added 2 commits July 7, 2026 15:22
Every other graph_api/ sample has a standalone README with run
instructions and a "what this demonstrates" blurb; streaming was the
only one without.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Streaming is at-least-once per activity attempt: a retried node re-runs
and re-publishes its writes, so subscribers can see duplicate tokens.
Tag each token chunk with a monotonic seq and dedupe on it in the client
and test, demonstrating the documented idempotent-consumer pattern
instead of implicitly assuming exactly-once delivery.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@brianstrauch brianstrauch requested a review from a team as a code owner July 7, 2026 22:34
@brianstrauch brianstrauch requested a review from DABH July 7, 2026 22:36
set.add returns None, so the comprehension trick tripped mypy's
func-returns-value. Rewrite as an explicit loop.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants