[PR #1672] [MERGED] feat(langgraph): replace toLangGraphEventStream with encoding argument #1636

Closed
opened 2026-02-15 20:16:22 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/langgraphjs/pull/1672
Author: @dqbd
Created: 9/18/2025
Status: Merged
Merged: 9/18/2025
Merged by: @dqbd

Base: v1Head: dqbd/stream-encoding


📝 Commits (2)

  • 95af3ed feat(langgraph): replace toLangGraphEventStream with encoding argument
  • 628b216 Add changeset, update example

📊 Changes

14 files changed (+260 additions, -1044 deletions)

View changed files

.changeset/funny-houses-mate.md (+5 -0)
📝 examples/stream-transport-vite/src/server.mts (+14 -14)
📝 libs/langgraph/package.json (+0 -11)
📝 libs/langgraph/src/pregel/index.ts (+32 -15)
📝 libs/langgraph/src/pregel/stream.ts (+166 -1)
📝 libs/langgraph/src/pregel/types.ts (+33 -13)
📝 libs/langgraph/src/tests/pregel.test-d.ts (+10 -0)
libs/langgraph/src/tests/ui.test-d.ts (+0 -68)
libs/langgraph/src/ui/consume.ts (+0 -206)
libs/langgraph/src/ui/index.ts (+0 -7)
libs/langgraph/src/ui/stream.ts (+0 -233)
libs/langgraph/src/ui/types.infer.ts (+0 -102)
libs/langgraph/src/ui/types.message.ts (+0 -96)
libs/langgraph/src/ui/types.schema.ts (+0 -278)

📄 Description

Supersedes toLangGraphEventStream and toLangGraphEventStreamResponse. Similar to encoding option in streamEvents, but emits LGP-style events, that can be consumed via custom transport in useStream (see #1662).

Example usage:

const app = new Hono();

app.post("/api/stream", async (c) => {
  const { input } = z.object({ input: schema }).parse(await c.req.json());

  const stream = await graph.stream(input, {
    encoding: "text/event-stream",
    streamMode: ["values", "messages", "updates"],
  });

  return new Response(stream, {
    headers: { "Content-Type": "text/event-stream" },
  });
});

🔄 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/langgraphjs/pull/1672 **Author:** [@dqbd](https://github.com/dqbd) **Created:** 9/18/2025 **Status:** ✅ Merged **Merged:** 9/18/2025 **Merged by:** [@dqbd](https://github.com/dqbd) **Base:** `v1` ← **Head:** `dqbd/stream-encoding` --- ### 📝 Commits (2) - [`95af3ed`](https://github.com/langchain-ai/langgraphjs/commit/95af3ed75fb0255f6fabe51968e90c71fac61b90) feat(langgraph): replace `toLangGraphEventStream` with `encoding` argument - [`628b216`](https://github.com/langchain-ai/langgraphjs/commit/628b216eedd349f3548a75850e83a2431ca32580) Add changeset, update example ### 📊 Changes **14 files changed** (+260 additions, -1044 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/funny-houses-mate.md` (+5 -0) 📝 `examples/stream-transport-vite/src/server.mts` (+14 -14) 📝 `libs/langgraph/package.json` (+0 -11) 📝 `libs/langgraph/src/pregel/index.ts` (+32 -15) 📝 `libs/langgraph/src/pregel/stream.ts` (+166 -1) 📝 `libs/langgraph/src/pregel/types.ts` (+33 -13) 📝 `libs/langgraph/src/tests/pregel.test-d.ts` (+10 -0) ➖ `libs/langgraph/src/tests/ui.test-d.ts` (+0 -68) ➖ `libs/langgraph/src/ui/consume.ts` (+0 -206) ➖ `libs/langgraph/src/ui/index.ts` (+0 -7) ➖ `libs/langgraph/src/ui/stream.ts` (+0 -233) ➖ `libs/langgraph/src/ui/types.infer.ts` (+0 -102) ➖ `libs/langgraph/src/ui/types.message.ts` (+0 -96) ➖ `libs/langgraph/src/ui/types.schema.ts` (+0 -278) </details> ### 📄 Description Supersedes `toLangGraphEventStream` and `toLangGraphEventStreamResponse`. Similar to `encoding` option in `streamEvents`, but emits LGP-style events, that can be consumed via custom transport in useStream (see #1662). Example usage: ```typescript const app = new Hono(); app.post("/api/stream", async (c) => { const { input } = z.object({ input: schema }).parse(await c.req.json()); const stream = await graph.stream(input, { encoding: "text/event-stream", streamMode: ["values", "messages", "updates"], }); return new Response(stream, { headers: { "Content-Type": "text/event-stream" }, }); }); ``` --- <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-02-15 20:16:22 -05:00
yindo closed this issue 2026-02-15 20:16:22 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#1636