docs: use camelCase middleware factory names in agents.mdx JS examples - #4251
Merged
Naomi Pentrel (npentrel) merged 1 commit intoJun 2, 2026
Conversation
Contributor
|
Thanks for opening a docs PR, Kimaswa Emmanuel Yusufu (@emmayusufu)! When it's ready for review, please add the relevant reviewers:
|
Naomi Pentrel (npentrel)
approved these changes
Jun 2, 2026
Naomi Pentrel (npentrel)
left a comment
Contributor
There was a problem hiding this comment.
Thank you for fixing that!
2 tasks
Nishitha M (imnishitha)
added a commit
that referenced
this pull request
Jul 7, 2026
## Description Depends on: - langchain-ai/deepagents #4251 (override a default middleware by name) - langchain-ai/deepagents #4325 (tools allowlist on FilesystemMiddleware) Documents two related Python deepagents behaviors: - A `middleware=` (or SubAgent's middleware) instance whose` .name `matches a default replaces that default in place instead of erroring on duplicate middleware. Updates the default middleware stack, the `middleware= `table row, and the `SubAgent.middleware` field description, and adds a new "Override a default middleware instance" section with an example. - The new tools allowlist on `FilesystemMiddleware` for enabling or disabling individual built-in filesystem tools (`ls, read_file, write_file, edit_file, delete, glob, grep, execute`), which relies on the middleware-override behavior above to swap in a restricted `FilesystemMiddleware` instance. Adds a "Restricting filesystem tools" example. Scoped to Python docs only (:::python fences), since both changes only shipped in the Python SDK. Test Plan - [ ] vale (prose lint) passes clean on the changed files - [ ] markdownlint shows no new violations introduced (same pre-existing count before/after) _Opened collaboratively by Nishitha Madhu and open-swe_ --------- Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com> Co-authored-by: ccurme <chester.curme@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The JavaScript middleware examples in the agents guide use the Python class names (
new TodoListMiddleware(),new ModelRetryMiddleware(), etc.), but thelangchainpackage 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 themiddleware/built-in.mdxexamples.piiMiddlewaretakes a PII type argument in JS (unlike the PythonPIIMiddleware()), so that one becomespiiMiddleware("email"). Thedeepagentsmiddleware (FilesystemMiddleware,SubAgentMiddleware) are genuinely classes and are left as-is. Verified each fixed snippet compiles against langchain 1.4.4.