[PR #4012] [MERGED] docs(event-streaming): fix raw event payload, text-delta type, and async examples #4019

Closed
opened 2026-06-05 18:53:55 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/docs/pull/4012
Author: @nick-hollon-lc
Created: 5/14/2026
Status: Merged
Merged: 5/15/2026
Merged by: @nick-hollon-lc

Base: mainHead: fix/event-streaming-docs


📝 Commits (8)

  • 0b65754 docs(event-streaming): fix raw event payload access and prioritize async for concurrent consumption
  • 69d7f08 docs(event-streaming): fix async examples — await astream_events and message.text
  • eec8dcc docs(deepagents/event-streaming): guard against ToolMessage in raw event loop
  • d175244 docs(deepagents/event-streaming): clarify data[0] comment
  • 61f7a78 docs(deepagents/event-streaming): drop misleading data[0] comment
  • 0ca4e5c docs(langgraph/event-streaming): fix raw messages event access
  • 804239f docs(deepagents/event-streaming): add JS counterpart for raw event source labeling
  • 95d51f0 docs(deepagents/event-streaming): fix JS source labeling

📊 Changes

3 files changed (+88 additions, -7 deletions)

View changed files

📝 src/oss/deepagents/event-streaming.mdx (+45 -4)
📝 src/oss/langchain/event-streaming.mdx (+19 -1)
📝 src/oss/langgraph/event-streaming.mdx (+24 -2)

📄 Description

Summary

  • deepagents: fix raw protocol event iteration in the "Consume concurrently" section — event["params"]["data"] is a (event_dict, metadata) tuple so the payload is at data[0], and the delta type is "text-delta" not "text"
  • all three pages (deepagents, langchain, langgraph): reframe the Python multiple-projections section to lead with the async path (astream_events + asyncio.gather) and relegate stream.interleave() to a sync-only fallback
  • async examples verified: astream_events() returns a coroutine and requires await; message.text in async projections is an AsyncProjection and also requires await — both confirmed by running the examples against the live API

Test plan

  • All three async examples (deepagents, langchain, langgraph) run successfully against live API
  • Raw event structure confirmed: data is a 2-tuple, data[0] is the event dict, delta type is "text-delta"
  • make lint_prose passes on all changed files

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/docs/pull/4012 **Author:** [@nick-hollon-lc](https://github.com/nick-hollon-lc) **Created:** 5/14/2026 **Status:** ✅ Merged **Merged:** 5/15/2026 **Merged by:** [@nick-hollon-lc](https://github.com/nick-hollon-lc) **Base:** `main` ← **Head:** `fix/event-streaming-docs` --- ### 📝 Commits (8) - [`0b65754`](https://github.com/langchain-ai/docs/commit/0b657546de6f15ef6afeb5b047af2a2ccf4722a3) docs(event-streaming): fix raw event payload access and prioritize async for concurrent consumption - [`69d7f08`](https://github.com/langchain-ai/docs/commit/69d7f08a6ec3b071a2412e93abe5e44f7439b583) docs(event-streaming): fix async examples — await astream_events and message.text - [`eec8dcc`](https://github.com/langchain-ai/docs/commit/eec8dcce4d3e3b599add13cfc8b888478e253cae) docs(deepagents/event-streaming): guard against ToolMessage in raw event loop - [`d175244`](https://github.com/langchain-ai/docs/commit/d175244978f442c29688ce8fb0cf14f1a28c9cd9) docs(deepagents/event-streaming): clarify data[0] comment - [`61f7a78`](https://github.com/langchain-ai/docs/commit/61f7a78eeb6ce0ff44abeab597bd5ed291628cd3) docs(deepagents/event-streaming): drop misleading data[0] comment - [`0ca4e5c`](https://github.com/langchain-ai/docs/commit/0ca4e5c1c38f6c86aead714af74866f53641f0a4) docs(langgraph/event-streaming): fix raw messages event access - [`804239f`](https://github.com/langchain-ai/docs/commit/804239f08e68a6fc285f2f1439ef96eea0b8fd7f) docs(deepagents/event-streaming): add JS counterpart for raw event source labeling - [`95d51f0`](https://github.com/langchain-ai/docs/commit/95d51f028fef6533a06f74efb72de7854316c199) docs(deepagents/event-streaming): fix JS source labeling ### 📊 Changes **3 files changed** (+88 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `src/oss/deepagents/event-streaming.mdx` (+45 -4) 📝 `src/oss/langchain/event-streaming.mdx` (+19 -1) 📝 `src/oss/langgraph/event-streaming.mdx` (+24 -2) </details> ### 📄 Description ## Summary - **deepagents**: fix raw protocol event iteration in the "Consume concurrently" section — `event["params"]["data"]` is a `(event_dict, metadata)` tuple so the payload is at `data[0]`, and the delta type is `"text-delta"` not `"text"` - **all three pages** (deepagents, langchain, langgraph): reframe the Python multiple-projections section to lead with the async path (`astream_events` + `asyncio.gather`) and relegate `stream.interleave()` to a sync-only fallback - **async examples verified**: `astream_events()` returns a coroutine and requires `await`; `message.text` in async projections is an `AsyncProjection` and also requires `await` — both confirmed by running the examples against the live API ## Test plan - [x] All three async examples (deepagents, langchain, langgraph) run successfully against live API - [x] Raw event structure confirmed: `data` is a 2-tuple, `data[0]` is the event dict, delta type is `"text-delta"` - [x] `make lint_prose` passes on all changed files --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-05 18:53:55 -04:00
yindo closed this issue 2026-06-05 18:53:55 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#4019