How to access state in tool function ? #125

Closed
opened 2026-02-15 17:16:01 -05:00 by yindo · 5 comments
Owner

Originally created by @GaoCan702 on GitHub (Oct 24, 2024).

I'm trying to access the graph state inside a LangGraph tool function.

Originally created by @GaoCan702 on GitHub (Oct 24, 2024). I'm trying to access the graph state inside a LangGraph tool function.
yindo closed this issue 2026-02-15 17:16:01 -05:00
Author
Owner

@jacoblee93 commented on GitHub (Oct 24, 2024):

Hey @GaoCan702, see this guide:

https://langchain-ai.github.io/langgraphjs/how-tos/pass-run-time-values-to-tools/

@jacoblee93 commented on GitHub (Oct 24, 2024): Hey @GaoCan702, see this guide: https://langchain-ai.github.io/langgraphjs/how-tos/pass-run-time-values-to-tools/
Author
Owner

@GaoCan702 commented on GitHub (Oct 24, 2024):

@jacoblee93 Thank you very much for your response. The import of LangGraphRunnableConfig in the documentation is throwing an error. How can I properly import this LangGraphRunnableConfig?

@GaoCan702 commented on GitHub (Oct 24, 2024): @jacoblee93 Thank you very much for your response. The import of LangGraphRunnableConfig in the documentation is throwing an error. How can I properly import this LangGraphRunnableConfig?
Author
Owner

@jacoblee93 commented on GitHub (Oct 25, 2024):

Make sure you are on the latest LangGraph version

@jacoblee93 commented on GitHub (Oct 25, 2024): Make sure you are on the latest LangGraph version
Author
Owner

@apresmoi commented on GitHub (Feb 14, 2025):

Hello, I was trying to do exactly the same, accesing the state from a tool.

This is not currently working if you are using LangGraph on the UI (browser).

I believe its becasue of this is not currently supported on the browser:

import { setContextVariable } from "@langchain/core/context";

@apresmoi commented on GitHub (Feb 14, 2025): Hello, I was trying to do exactly the same, accesing the state from a tool. This is not currently working if you are using LangGraph on the UI (browser). I believe its becasue of this is not currently supported on the browser: `import { setContextVariable } from "@langchain/core/context";`
Author
Owner

@benjamincburns commented on GitHub (Mar 5, 2025):

@apresmoi @GaoCan702 just a heads up that you can do getCurrentTaskInput() now, and it'll return the same value that was passed into your currently executing node.

@benjamincburns commented on GitHub (Mar 5, 2025): @apresmoi @GaoCan702 just a heads up that you can do `getCurrentTaskInput()` now, and it'll return the same value that was passed into your currently executing node.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#125