I am working on a customized LangGraph agent. It has the ReAct setup where I have a reasoner that points to a ToolNode and the end. Below is an example, I have a more complex build but this basically where we are having the issues. builder = StateGraph(MyState) # nodes builder.add_node("reasoner", agent_main_reasoner) builder.add_node("tools", ToolNode(mytools) # edges builder.add_edge(START, "reasoner") builder.conditional_edges("reasoner", tools_condition) builder.add_edge("tools", "reasoner") # Compile my_graph = builder.compile() I need to both read and write to state within my tools. However, when I try and do this - the LLM ignores the tool and never runs it. For example, when I have a base tool in my_tools like below, it will execute fine. my_tool_desc = "If a user asks about \"yeehaws\" this tool will return up-to-date information" @tool(name_or_callable="my_tool_fun", description=my_tool_desc) async def my_tool_func(): print("!!!HELLO FROM MY TOOL!!!") return "All the 10 yees have hawed." If I run the graph asking "How many yeeshaws?" - it would execute the function, I will see the print and the LLM will respond saying like "10 yeehaws" or something along those lines. Now lets say I have a state like this: class MyState(TypedDict): user_query: str model_context: Annotated[List[str], operator.add] AND within that tool, I want to READ in the user_query from state and then UPDATE the model_context with results. Lets do it one at a time, because separated or together BOTH of these tool examples get skipped by the LLM and I never see it executed. READ tool variation: @tool(name_or_callable="my_tool_fun", description=my_tool_desc) async def my_tool_func(state: Annotated[MyState, InjectedState]): q = state["user_query"] print(f"!!!HELLO FROM MY TOOL!!! Query: {q}") return "All the 10 yees have hawed." Using ChatGPT and a random GitHub thread, it said basically to try and add a non-state parameter and it wouldn't be ignored. Only the State Param would be ignored but to no avail. my_tool_desc = "If a user asks about \"yeehaws\" this tool will return up-to-date information.\nARGUMENTS:\n\t- query: (str) Pass the User's original query \"user_query\" from state." @tool(name_or_callable="my_tool_fun", description=my_tool_desc) async def my_tool_func(query: str, state: Annotated[MyState, InjectedState]): q = state["user_query"] print(f"!!!HELLO FROM MY TOOL!!! State: {q} - Generated: {query}") return "All the 10 yees have hawed." This also fails. Finally, here is my WRITE tool that is ignored, where I am not passing state as a parameter at all. Keep in mind the combined version also is ignored, lol. @tool(name_or_callable="my_tool_fun", description=my_tool_desc) async def my_tool_func() -> Command: print(f"!!!HELLO FROM MY TOOL!!!") return Command(update={"model_context": ["All the 10 yees have hawed."]}) How can I make it so my tools that touch state are not ignored? Is there a way or am I doomed? Thanks much Continue reading...