docs(agents): add warning for JS runtime tool registration limitation#3613
docs(agents): add warning for JS runtime tool registration limitation#3613sasmita016 wants to merge 1 commit intolangchain-ai:mainfrom
Conversation
wrapModelCall does not support adding new tools in JS/TS and throws: Error: You have added a new tool in wrapModelCall hook... This is not supported. Added <Warning> in the JS tab directing users to the filtering approach. Fixes: langchain-ai/langgraphjs#1934
|
Thanks for opening a docs PR, sasmita016! When it's ready for review, please add the relevant reviewers:
|
|
Naomi Pentrel (@npentrel) Lauren Hirata Singh (@lnhsingh) please review and approve |
|
Thanks for the report - I've tested the example in question and am not getting the issue (on I will also check with Christian Bromann (@christian-bromann) who might know more. |
I can confirm that this works using the latest |
Problem
The "Runtime tool registration" tab in the agents docs shows a JS/TS
example using wrapModelCall to add new tools at runtime. This throws:
Error: You have added a new tool in "wrapModelCall" hook of middleware "...".
This is not supported.
Reproduced in @langchain/core@1.2.26 and @langchain/langgraph@^1.0.14.
The Python version works via AgentMiddleware. The JS version does not.
Fix
Added a callout in the JS tab explaining the limitation and
pointing users to the working "Filtering pre-registered tools" approach.
References