Skip to content

[AIT-206] Add message per token guide for LangGraph#3157

Merged
matt423 merged 1 commit intomainfrom
ait-206-lang-graph-per-token
Jan 30, 2026
Merged

[AIT-206] Add message per token guide for LangGraph#3157
matt423 merged 1 commit intomainfrom
ait-206-lang-graph-per-token

Conversation

@matt423
Copy link
Member

@matt423 matt423 commented Jan 27, 2026

Description

Follows the existing structure of the message-per-token guides for LangGraph in JS.

Review App

Checklist

Summary by CodeRabbit

  • Documentation
    • Added new guides for token streaming implementations with Vercel AI SDK (message-per-response) and LangGraph (message-per-token) approaches
    • Included comprehensive LangGraph tutorial with prerequisites, setup instructions, code examples, event sequencing patterns, and best practices for integration

✏️ Tip: You can customize this high-level summary in your review settings.

@matt423 matt423 self-assigned this Jan 27, 2026
@matt423 matt423 added the review-app Create a Heroku review app label Jan 27, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 27, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review

Walkthrough

This PR adds documentation and navigation for a new guide on token-by-token streaming with LangGraph. It includes navigation entries, an index tile linking to the guide, and a comprehensive tutorial document with publisher and subscriber code examples using Ably.

Changes

Cohort / File(s) Summary
Navigation and Index Updates
src/data/nav/aitransport.ts, src/pages/docs/ai-transport/index.mdx
Added two new navigation entries for AI transport guides: Vercel AI SDK message-per-response and LangGraph message-per-token. Updated the AI Transport index to include a new LangGraph section with a tile linking to the message-per-token guide.
Documentation
src/pages/docs/guides/ai-transport/lang-graph-message-per-token.mdx
New comprehensive guide documenting token-by-token streaming with LangGraph over Ably. Includes prerequisites, setup instructions, code examples for publisher and subscriber implementations, event sequencing details, and notes on throughput and echo prevention.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 Through LangGraph's token streams we hop,
Each message dances, won't stop!
With Ably's flow, granular and bright,
A guide to make streaming right. 📚✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately describes the main change: adding a message-per-token guide for LangGraph, which is clearly reflected in the code changes.
Linked Issues check ✅ Passed The PR implementation fulfills the AIT-206 objective by creating a comprehensive guide article demonstrating token streaming with granular history using LangGraph in JavaScript.
Out of Scope Changes check ✅ Passed All changes are directly related to AIT-206 objectives: new navigation entries, updated index documentation, and the new LangGraph guide file are all within scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ait-206-lang-graph-per-token

Comment @coderabbitai help to get the list of available commands and usage tips.

@ably-ci ably-ci temporarily deployed to ably-docs-ait-206-lang--jon5dp January 27, 2026 10:08 Inactive
@matt423
Copy link
Member Author

matt423 commented Jan 27, 2026

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jan 27, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@src/data/nav/aitransport.ts`:
- Around line 107-114: The nav entry named 'Vercel AI SDK token streaming -
message per response' points to a non-existent page at
'/docs/guides/ai-transport/vercel-message-per-response'; either create the
missing guide file or update the nav link to the existing Vercel guide path
'/docs/guides/ai-transport/vercel-message-per-token' (or rename the entry to
match the existing file) by editing the object in src/data/nav/aitransport.ts so
the name and link correspond to the actual MDX file.

In `@src/pages/docs/guides/ai-transport/lang-graph-message-per-token.mdx`:
- Around line 268-296: The responses Map is never cleaned up, causing unbounded
growth; in the stop handler (the channel.subscribe('stop', ...) callback where
responseId and finalText are obtained) delete the entry from responses after you
finish using finalText (e.g., call responses.delete(responseId)) so per-response
state is released when the response completes.
- Around line 180-226: The module-scoped responseId causes cross-request reuse;
make responseId a local variable inside streamLangGraphResponse (declare let
responseId = null at the top of that function) so each call gets its own ID,
update where you check and set it (inside the for-await loop) and include it in
the start and token publishes as before, and guard the final stop publish so you
only call channel.publish({ name: 'stop', ... }) when responseId was captured
(i.e., if (responseId) publish stop) to avoid emitting stop for unrelated
streams.

@matt423 matt423 force-pushed the ait-206-lang-graph-per-token branch from 86bc5dc to 181c7d5 Compare January 27, 2026 10:22
@matt423 matt423 temporarily deployed to ably-docs-ait-206-lang--jon5dp January 27, 2026 10:22 Inactive
@matt423 matt423 marked this pull request as ready for review January 27, 2026 10:28
@matt423 matt423 requested a review from mschristensen January 27, 2026 10:29
@GregHolmes GregHolmes force-pushed the ait-206-lang-graph-per-token branch from 181c7d5 to 7711ba2 Compare January 28, 2026 11:21
@GregHolmes GregHolmes temporarily deployed to ably-docs-ait-206-lang--jon5dp January 28, 2026 11:21 Inactive
Copy link
Contributor

@GregHolmes GregHolmes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@matt423 matt423 force-pushed the ait-206-lang-graph-per-token branch from 9b1658e to cfb1abc Compare January 30, 2026 11:43
@matt423 matt423 enabled auto-merge January 30, 2026 11:43
@matt423 matt423 temporarily deployed to ably-docs-ait-206-lang--jon5dp January 30, 2026 11:43 Inactive
@matt423 matt423 merged commit 3109dd8 into main Jan 30, 2026
7 checks passed
@matt423 matt423 deleted the ait-206-lang-graph-per-token branch January 30, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-app Create a Heroku review app

Development

Successfully merging this pull request may close these issues.

3 participants