[PR #4126] [MERGED] docs(langchain): document middleware-registered stream transformers #4123

Closed
opened 2026-06-05 19:12:50 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

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

Base: mainHead: nh/middleware-transformers


📝 Commits (6)

  • 18d45fd docs(langchain): document middleware-registered stream transformers
  • e918786 docs(langchain): bump min version to langchain>=1.3.2 in transformers note
  • bed5a5e docs(langchain): add PIIMiddleware example for middleware-registered transformers
  • fcb632e docs(langchain): note PIIMiddleware streaming redaction in built-in and guardrails
  • f0527bb docs(langchain): JS parity for stream transformers + custom middleware coverage
  • f8180d9 docs(langchain): spell out the exact factory shape per language

📊 Changes

4 files changed (+168 additions, -1 deletions)

View changed files

📝 src/oss/langchain/event-streaming.mdx (+88 -0)
📝 src/oss/langchain/guardrails.mdx (+4 -0)
📝 src/oss/langchain/middleware/built-in.mdx (+5 -1)
📝 src/oss/langchain/middleware/custom.mdx (+71 -0)

📄 Description

Documents the new AgentMiddleware.transformers attribute introduced in langchain-ai/langchain#37591. Middleware can now declare scope-aware StreamTransformer factories alongside their tools and lifecycle hooks; create_agent merges them with caller-supplied transformers= at compile time.

Summary

  • Adds a Register transformers on middleware subsection under "Custom updates" in src/oss/langchain/event-streaming.mdx.
  • Shows the compile-time merge order: ToolCallTransformer → middleware-registered factories (in middleware order) → caller-supplied transformers= from create_agent.
  • Python-only (:::python fenced) — the upstream PR only ships the Python surface. JS parity can be documented when langchainjs adds the equivalent.

Reviewer notes

  • The <Note> pins the minimum version to langchain>=1.3.2 (next patch after the current 1.3.1). If the upstream PR ends up shipping in a different release, adjust the note.
  • This PR should land after langchain-ai/langchain#37591 merges and the langchain release that contains it is published.

Test plan

  • make lint_prose FILES="src/oss/langchain/event-streaming.mdx" — clean
  • Visual review of the rendered "Custom updates" section in Mintlify preview
  • Confirm the final langchain release tag matches the <Note> before merge

🔄 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/4126 **Author:** [@nick-hollon-lc](https://github.com/nick-hollon-lc) **Created:** 5/21/2026 **Status:** ✅ Merged **Merged:** 5/27/2026 **Merged by:** [@nick-hollon-lc](https://github.com/nick-hollon-lc) **Base:** `main` ← **Head:** `nh/middleware-transformers` --- ### 📝 Commits (6) - [`18d45fd`](https://github.com/langchain-ai/docs/commit/18d45fde9350d734a3d8f6573cefcaf6bc139021) docs(langchain): document middleware-registered stream transformers - [`e918786`](https://github.com/langchain-ai/docs/commit/e9187869804711d13ed0948267246cc434a424f6) docs(langchain): bump min version to langchain>=1.3.2 in transformers note - [`bed5a5e`](https://github.com/langchain-ai/docs/commit/bed5a5ed0be9ac6cddd9413ba6b63c50dcf101f0) docs(langchain): add PIIMiddleware example for middleware-registered transformers - [`fcb632e`](https://github.com/langchain-ai/docs/commit/fcb632e4484e9c9f7e30b106c061ba2d8726cd9f) docs(langchain): note PIIMiddleware streaming redaction in built-in and guardrails - [`f0527bb`](https://github.com/langchain-ai/docs/commit/f0527bb8d8b2ee39a2306a81f6804b8a44c615be) docs(langchain): JS parity for stream transformers + custom middleware coverage - [`f8180d9`](https://github.com/langchain-ai/docs/commit/f8180d94ccddfb77a4b351953bbc4cce59c91592) docs(langchain): spell out the exact factory shape per language ### 📊 Changes **4 files changed** (+168 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/oss/langchain/event-streaming.mdx` (+88 -0) 📝 `src/oss/langchain/guardrails.mdx` (+4 -0) 📝 `src/oss/langchain/middleware/built-in.mdx` (+5 -1) 📝 `src/oss/langchain/middleware/custom.mdx` (+71 -0) </details> ### 📄 Description Documents the new `AgentMiddleware.transformers` attribute introduced in [langchain-ai/langchain#37591](https://github.com/langchain-ai/langchain/pull/37591). Middleware can now declare scope-aware `StreamTransformer` factories alongside their `tools` and lifecycle hooks; `create_agent` merges them with caller-supplied `transformers=` at compile time. ## Summary - Adds a `Register transformers on middleware` subsection under "Custom updates" in `src/oss/langchain/event-streaming.mdx`. - Shows the compile-time merge order: `ToolCallTransformer` → middleware-registered factories (in middleware order) → caller-supplied `transformers=` from `create_agent`. - Python-only (`:::python` fenced) — the upstream PR only ships the Python surface. JS parity can be documented when `langchainjs` adds the equivalent. ## Reviewer notes - The `<Note>` pins the minimum version to `langchain>=1.3.2` (next patch after the current `1.3.1`). If the upstream PR ends up shipping in a different release, adjust the note. - This PR should land **after** langchain-ai/langchain#37591 merges and the `langchain` release that contains it is published. ## Test plan - [x] `make lint_prose FILES="src/oss/langchain/event-streaming.mdx"` — clean - [x] Visual review of the rendered "Custom updates" section in Mintlify preview - [x] Confirm the final `langchain` release tag matches the `<Note>` before merge --- <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 19:12:50 -04:00
yindo closed this issue 2026-06-05 19:12:50 -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#4123