pass graph state or runtime variable to tools #52

Closed
opened 2026-02-15 17:15:07 -05:00 by yindo · 2 comments
Owner

Originally created by @nnhuyhoang on GitHub (Jul 31, 2024).

How can I pass graph state or runtime variable(eg. userID) to tools. I don't want push it to message and rely on tool to extract it. I searched and pyhon have one, Can we do it in langgraphjs?

Originally created by @nnhuyhoang on GitHub (Jul 31, 2024). How can I pass graph state or runtime variable(eg. userID) to tools. I don't want push it to message and rely on tool to extract it. I searched and [pyhon](https://langchain-ai.github.io/langgraph/how-tos/pass-run-time-values-to-tools/) have one, Can we do it in `langgraphjs`?
yindo closed this issue 2026-02-15 17:15:07 -05:00
Author
Owner

@bracesproul commented on GitHub (Jul 31, 2024):

In js we have the configurable field which is an object that can hold any value. If you pass your custom value via that field when you call .invoke/ .stream etc you should be able to access it via the config arg in any of the sub nodes/runnables.

See this doc

let me know if this doesn't provide the context you need

@bracesproul commented on GitHub (Jul 31, 2024): In js we have the `configurable` field which is an object that can hold any value. If you pass your custom value via that field when you call `.invoke`/ `.stream` etc you should be able to access it via the `config` arg in any of the sub nodes/runnables. See [this doc](https://js.langchain.com/v0.2/docs/how_to/tool_runtime/) let me know if this doesn't provide the context you need
Author
Owner

@nnhuyhoang commented on GitHub (Jul 31, 2024):

thank you, it work like a charm

@nnhuyhoang commented on GitHub (Jul 31, 2024): thank you, it work like a charm
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#52