Skip to content

docs(agents): add warning for JS runtime tool registration limitation#3613

Open
sasmita016 wants to merge 1 commit intolangchain-ai:mainfrom
sasmita016:fix/js-runtime-tool-registration-limitation
Open

docs(agents): add warning for JS runtime tool registration limitation#3613
sasmita016 wants to merge 1 commit intolangchain-ai:mainfrom
sasmita016:fix/js-runtime-tool-registration-limitation

Conversation

@sasmita016
Copy link
Copy Markdown

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

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
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for opening a docs PR, sasmita016! When it's ready for review, please add the relevant reviewers:

  • @npentrel or @lnhsingh (LangChain)

@github-actions github-actions bot added langchain For docs changes to LangChain oss external User is not a member of langchain-ai labels Apr 17, 2026
@sasmita016
Copy link
Copy Markdown
Author

Naomi Pentrel (@npentrel) Lauren Hirata Singh (@lnhsingh) please review and approve

@npentrel
Copy link
Copy Markdown
Contributor

Thanks for the report - I've tested the example in question and am not getting the issue (on "@langchain/core": "^1.1.40", "@langchain/langgraph": "^1.2.9"). I think for langchain/core 1.2.26 doesn't exist, maybe you were on 1.1.26? Can you try to update and report back?

I will also check with Christian Bromann (@christian-bromann) who might know more.

@christian-bromann
Copy link
Copy Markdown
Member

I will also check with Christian Bromann (Christian Bromann (@christian-bromann)) who might know more.

I can confirm that this works using the latest langchain version. sasmita016 any chance you can provide a reproduction case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external User is not a member of langchain-ai langchain For docs changes to LangChain oss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants