[PR #4251] [MERGED] docs: use camelCase middleware factory names in agents.mdx JS examples #4240

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

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/docs/pull/4251
Author: @emmayusufu
Created: 6/1/2026
Status: Merged
Merged: 6/2/2026
Merged by: @npentrel

Base: mainHead: docs/agents-middleware-camelcase


📝 Commits (1)

  • b989d53 docs: use camelCase middleware factory names in agents.mdx JS examples

📊 Changes

1 file changed (+8 additions, -8 deletions)

View changed files

📝 src/oss/langchain/agents.mdx (+8 -8)

📄 Description

The JavaScript middleware examples in the agents guide use the Python class names (new TodoListMiddleware(), new ModelRetryMiddleware(), etc.), but the langchain package exports these as camelCase factory functions, so the snippets fail to compile ('langchain' has no exported member named 'TodoListMiddleware'). This switches them to the factory functions, matching the package and the middleware/built-in.mdx examples.

piiMiddleware takes a PII type argument in JS (unlike the Python PIIMiddleware()), so that one becomes piiMiddleware("email"). The deepagents middleware (FilesystemMiddleware, SubAgentMiddleware) are genuinely classes and are left as-is. Verified each fixed snippet compiles against langchain 1.4.4.


🔄 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/4251 **Author:** [@emmayusufu](https://github.com/emmayusufu) **Created:** 6/1/2026 **Status:** ✅ Merged **Merged:** 6/2/2026 **Merged by:** [@npentrel](https://github.com/npentrel) **Base:** `main` ← **Head:** `docs/agents-middleware-camelcase` --- ### 📝 Commits (1) - [`b989d53`](https://github.com/langchain-ai/docs/commit/b989d53e33e54067a79743845173d84814cfc87c) docs: use camelCase middleware factory names in agents.mdx JS examples ### 📊 Changes **1 file changed** (+8 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `src/oss/langchain/agents.mdx` (+8 -8) </details> ### 📄 Description The JavaScript middleware examples in the agents guide use the Python class names (`new TodoListMiddleware()`, `new ModelRetryMiddleware()`, etc.), but the `langchain` package exports these as camelCase factory functions, so the snippets fail to compile (`'langchain' has no exported member named 'TodoListMiddleware'`). This switches them to the factory functions, matching the package and the `middleware/built-in.mdx` examples. `piiMiddleware` takes a PII type argument in JS (unlike the Python `PIIMiddleware()`), so that one becomes `piiMiddleware("email")`. The `deepagents` middleware (`FilesystemMiddleware`, `SubAgentMiddleware`) are genuinely classes and are left as-is. Verified each fixed snippet compiles against langchain 1.4.4. --- <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:13:14 -04:00
yindo closed this issue 2026-06-05 19:13:14 -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#4240