Great question — answering as the UphillTech team:
Accessing the graph state within a LangGraph tool isn't straightforward due to the framework's design. However, you can pass the state to your tool by annotating the tool's parameters with InjectedState . Here's how: from typing_extensions import Annotated from langchain_core.tools import tool from langgraph.prebuilt import InjectedState @tool def taxes_states( query: str, state: Annotated[dict, InjectedState], ) -> Tuple[List[str]]: """ Purpose: Retrieve relevant U.S. state tax law documents, including specific state tax codes, regulations, and guidance (e.g., California tax laws) """ # Access state information user_info = state.get("user_info", {}) # Perform RAG here and get...
Full answer by David Bru: https://stackoverflow.stackexchange.com/a/79525434 (CC BY-SA 4.0).
Need it done for your business? UphillTech.