langgraph icon indicating copy to clipboard operation
langgraph copied to clipboard

langgraph.errors.InvalidUpdateError: Must write to at least one of ['input', 'plan', 'past_steps', 'response']

Open cristianohello opened this issue 1 year ago • 34 comments

Checked other resources

  • [X] I added a very descriptive title to this issue.
  • [X] I searched the LangGraph/LangChain documentation with the integrated search.
  • [X] I used the GitHub search to find a similar question and didn't find it.
  • [X] I am sure that this is a bug in LangGraph/LangChain rather than my code.
  • [X] I am sure this is better as an issue rather than a GitHub discussion, since this is a LangGraph bug and not a design question.

Example Code

async def execute_step(state: PlanExecute):
    objective = state["input"]
    task = state["plan"][0]
    agent_response = await agent_executor.ainvoke({"objective": objective, "input": task, "chat_history": []})
    return {
        "past_steps": [(task, agent_response["result"])],
    }

Error Message and Stack Trace (if applicable)

Traceback (most recent call last):
  File "D:\githcoalagent\demo3\demo3_zysss.py", line 118, in <module>
    asyncio.run(handle_events(inputs, config))
  File "D:\conda-pachaall-llm\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "D:\conda-pach-llm\lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
  File "D:\glagent\demo3\demo3_zysss.py", line 107, in handle_events
    async for event in app.astream(inputs, config=config):
  File "D:\conda-pachage\envs\recall-llm\lib\site-packages\langgraph\pregel\__init__.py", line 1333, in astream
    _panic_or_proceed(done, inflight, step)
  File "D:\conda-pachage\envs\recall-llm\lib\site-packages\langgraph\pregel\__init__.py", line 1537, in _panic_or_proceed
    raise exc
  File "D:\conda-pachage\envs\recall-llm\lib\site-packages\langgraph\pregel\retry.py", line 120, in arun_with_retry
    await task.proc.ainvoke(task.input, task.config)
  File "D:\conda-pachage\envs\recall-llm\lib\site-packages\langchain_core\runnables\base.py", line 2542, in ainvoke
    input = await step.ainvoke(input, config)
  File "D:\conda-pachage\envs\recall-llm\lib\site-packages\langgraph\utils.py", line 107, in ainvoke
    ret = await self._acall_with_config(
  File "D:\conda-pachage\envs\recall-llm\lib\site-packages\langchain_core\runnables\base.py", line 1650, in _acall_with_config
    output = await coro
  File "D:\conda-pachageb\site-packages\langgraph\pregel\write.py", line 141, in _awrite
    self.do_write(
  File "D:\conggraph\pregel\write.py", line 157, in do_write
    raise InvalidUpdateError(
langgraph.errors.InvalidUpdateError: Must write to at least one of ['input', 'plan', 'past_steps', 'response']

Description

File "D:\conda-pachage\envs\recall-llm\lib\site-packages\langgraph\pregel\write.py", line 141, in _awrite self.do_write( File "D:\conda-pachage\envs\recall-llm\lib\site-packages\langgraph\pregel\write.py", line 157, in do_write raise InvalidUpdateError( langgraph.errors.InvalidUpdateEr

System Info

File "D:\conda-pachage\envs\recall-llm\lib\site-packages\langgraph\pregel\write.py", line 141, in _awrite self.do_write( File "D:\conda-pachage\envs\recall-llm\lib\site-packages\langgraph\pregel\write.py", line 157, in do_write raise InvalidUpdateError( langgraph.errors.InvalidUpdateEr

cristianohello avatar Jun 21 '24 10:06 cristianohello

langgraph 0.0.69

cristianohello avatar Jun 21 '24 10:06 cristianohello

Could you share the MVC for your graph?

hinthornw avatar Jun 21 '24 15:06 hinthornw

Hello

I face the same error and do not understand how to solve it. Also, it is a bit complex to debug.. Did you solve it ?

JoffreyLemery avatar Jun 26 '24 03:06 JoffreyLemery

@hinthornw I am facing the same invalid update error in MessageGraph. how to solve this?

his-maj-esty avatar Jul 04 '24 19:07 his-maj-esty

Any fix please?

dineshveguru avatar Jul 08 '24 07:07 dineshveguru

I have the same error and have simplified my code to:

`from typing import TypedDict, Optional from langgraph.constants import END from langgraph.graph import StateGraph

class GraphState(TypedDict): current_index: Optional[int] = 0

def gather_config_files(state): print("Entered gather_config_files") # This should print if the node is executed. return {"current_index": 1}

workflow = StateGraph(GraphState) workflow.add_node("gcf", gather_config_files) workflow.set_entry_point("gcf") workflow.add_edge("gcf", END)

graph = workflow.compile() result = graph.invoke({}) print(result) `

Nothing printed, same exact error. Can't even hit a breakpoint on the first print statement.

Perhaps not the ideal solution but I managed to get your code working by changing graph.invoke({ }) to graph.invoke({ "current_index": 0 })

I suspect something is happening when the initial state is not initialized when calling invoke

markwcollins avatar Jul 12 '24 03:07 markwcollins

Any update on this problem? I had the same error.

HoangNguyen689 avatar Jul 12 '24 05:07 HoangNguyen689

Hi there, may be this will help someone facing the same issue .... here is the problem in my code that led to it.

# Reproduce the issue by using this dummy function for the node
def  dummy_function(state: AppState):
    messages = state['messages']
    return {"message": [AIMessage(content="hello there")]}

# The typo in my function had led to the issue - this function addressed it
def  dummy_function(state: AppState):
    messages = state['messages']
   # fixed the issue by changing 'message' to 'messages' in the dictionary
    return {"messages": [AIMessage(content="hello there")]}

acloudfan avatar Jul 14 '24 16:07 acloudfan

I have the same error and have simplified my code to: from typing import TypedDict, Optional from langgraph.constants import END from langgraph.graph import StateGraph class GraphState(TypedDict): current_index: Optional[int] = 0 def gather_config_files(state): print("Entered gather_config_files") # This should print if the node is executed. return {"current_index": 1} workflow = StateGraph(GraphState) workflow.add_node("gcf", gather_config_files) workflow.set_entry_point("gcf") workflow.add_edge("gcf", END) graph = workflow.compile() result = graph.invoke({}) print(result) Nothing printed, same exact error. Can't even hit a breakpoint on the first print statement.

Perhaps not the ideal solution but I managed to get your code working by changing graph.invoke({ }) to graph.invoke({ "current_index": 0 })

I suspect something is happening when the initial state is not initialized when calling invoke

@markwcollins TypedDict doesn't support defaults, so current_index: Optional[int] = 0 won't actually do anything. and you're correct that you need to provide at least some initial state values when invoking the graph

vbarda avatar Jul 14 '24 20:07 vbarda

I am receiving this same error with a minor change: langgraph.errors.InvalidUpdateError: Must write to at least one of []. As you can see the array is of which it says you must write to is empty [].

This error occurs on macOS Catalina 10.15.7 But running on a separate pc macOS Sonoma 14.5 it runs without errors.

Is it possible that LangGraph has bugs on older versions of macOS or could something else be the issue?

SatvikSrinivas avatar Jul 14 '24 23:07 SatvikSrinivas

@SatvikSrinivas, anything is possible, but it would e easier to triage if you share a reprodible example

hinthornw avatar Jul 23 '24 16:07 hinthornw

@SatvikSrinivas, anything is possible, but it would e easier to triage if you share a reprodible example

Hi, here are the relevant parts of my code. I am using a custom AgentState object and below is my simple LangGraph flow. Search searches Pinecone for the relevant documents based on the user query and response is just the llm attempting to provide an answer using the documents.

The graph compiles without issues but fails at runtime.

class AgentState:

    def __init__(self, user_question: str):
        self.user_question = user_question
        self.docs = None  # search node will set docs based on the documents retrieved from Pinecone
        self.weather_analysis = None  # either heat/rain node will provide weather_analysis
        self.chat_history = []  # chat_history will accumulate over the course of the conversation

def execute(user_input): # user_input is the initial state which looks like this --> state = AgentState("")
    # Define a LangGraph graph
    workflow = StateGraph(AgentState)

    # Add nodes
    workflow.add_node("search", search)
    workflow.add_node("response", response)

    # Add edge
    workflow.add_edge('search', 'response')

    # Set entry and finish points
    workflow.set_entry_point("search")
    workflow.set_finish_point("response")

    # Compile
    app = workflow.compile()

    # Invoke
    return app.invoke(user_input) # <-- fails at this line

SatvikSrinivas avatar Jul 24 '24 02:07 SatvikSrinivas

I also encountered this problem, please ask the official expert to help solve it Traceback (most recent call last): File "d:\2024_crewAI_LangGraph_Mem0\CrewAI-LangGraph-weather-query\main.py", line 17, in <module> app.invoke({ "current_index": 0 }) File "E:\ProgramData\anaconda3\envs\crewAI\lib\site-packages\langgraph\pregel\__init__.py", line 1263, in invoke for chunk in self.stream( File "E:\ProgramData\anaconda3\envs\crewAI\lib\site-packages\langgraph\pregel\__init__.py", line 948, in stream _panic_or_proceed(done, inflight, loop.step) File "E:\ProgramData\anaconda3\envs\crewAI\lib\site-packages\langgraph\pregel\__init__.py", line 1349, in _panic_or_proceed raise exc File "E:\ProgramData\anaconda3\envs\crewAI\lib\site-packages\langgraph\pregel\executor.py", line 60, in done task.result() File "E:\ProgramData\anaconda3\envs\crewAI\lib\concurrent\futures\_base.py", line 451, in result return self.__get_result() File "E:\ProgramData\anaconda3\envs\crewAI\lib\concurrent\futures\_base.py", line 403, in __get_result raise self._exception File "E:\ProgramData\anaconda3\envs\crewAI\lib\concurrent\futures\thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "E:\ProgramData\anaconda3\envs\crewAI\lib\site-packages\langgraph\pregel\retry.py", line 25, in run_with_retry task.proc.invoke(task.input, task.config) File "E:\ProgramData\anaconda3\envs\crewAI\lib\site-packages\langgraph\utils.py", line 93, in invoke ret = self._call_with_config( File "E:\ProgramData\anaconda3\envs\crewAI\lib\site-packages\langchain_core\runnables\base.py", line 1784, in _call_with_config context.run( File "E:\ProgramData\anaconda3\envs\crewAI\lib\site-packages\langchain_core\runnables\config.py", line 404, in call_func_with_variable_args return func(input, **kwargs) # type: ignore[call-arg] File "E:\ProgramData\anaconda3\envs\crewAI\lib\site-packages\langgraph\pregel\write.py", line 107, in _write self.do_write( File "E:\ProgramData\anaconda3\envs\crewAI\lib\site-packages\langgraph\pregel\write.py", line 157, in do_write raise InvalidUpdateError( langgraph.errors.InvalidUpdateError: Must write to at least one of ['city']

duanzhihua avatar Jul 30 '24 01:07 duanzhihua

Facing the same issue.

InvalidUpdateError: Must write to at least one of ['messages', 'next_agent', 'requirement', 'assessment']

This happens even after trying to invoke the graph with all parameters:

graph.invoke( { "messages": [ ("user", "I want add a checkbox field called 'complete'") ], "next_agent": "NA", "requirement": "NA", "assessment": "NA" } )

Any ideas ?

siddharthsma avatar Jul 30 '24 11:07 siddharthsma

Facing the same issue.

InvalidUpdateError: Must write to at least one of ['messages', 'next_agent', 'requirement', 'assessment']

This happens even after trying to invoke the graph with all parameters:

graph.invoke( { "messages": [ ("user", "I want add a checkbox field called 'complete'") ], "next_agent": "NA", "requirement": "NA", "assessment": "NA" } )

Any ideas ?

@siddharthsma if you haven't found your solution can you share me your code?

py-taha avatar Aug 09 '24 08:08 py-taha

I guess your problem might be like this. You didn't want to update the status, so you filled in an empty dictionary.

from typing import Annotated, TypedDict

from langgraph.graph import StateGraph, add_messages


class State(TypedDict, total=False):
    messages: Annotated[list, add_messages]
    input: str
    plan: str
    past_steps: int
    response: str


def dummy(state: State) -> State:
    return {}


graph_builder = StateGraph(State)
graph_builder.set_entry_point("foo")
graph_builder.add_node("foo", dummy)
graph_builder.set_finish_point("foo")
app = graph_builder.compile()
app.invoke({"messages": [("human", "Hello")]})

This will cause an error. You have two ways to fix it. The following code only shows the modification of the dummy part.

  1. Insert messages into an empty list, and it will append to the original list. But appending an empty list does nothing, indirectly achieving your goal of not updating the state.
def dummy(state: State) -> State:
    return {"messages": []}
  1. Set the return type hint of func to None.
def dummy(state: State) -> None:
    return

gbaian10 avatar Aug 09 '24 10:08 gbaian10

Any help here, please?

Facing the same issue when I run parallel nodes and I want to aggregate result at the end.

Prem95 avatar Aug 21 '24 03:08 Prem95

@Prem95 Can you provide a minimal reproducible example?

gbaian10 avatar Aug 21 '24 03:08 gbaian10

The goal is I am running N number of MasterDocumentAgent() for N number of documents (speed up processing time)

MasterDocumentAgent declaration -

class MasterDocumentAgent:
	(all the other nodes initialisation and logic here)

	workflow.add_edge(FINAL_NODE, END)
        app = workflow.compile()
        return await app.ainvoke(state)

ParallelDocumentProcessor declaration -

class ParallelDocumentProcessor:
    def __init__(self):
        pass

    async def run(self, state: GraphState):
        workflow = StateGraph(GraphState)	
	workflow.add_node(“XXX”, self.XXX)

	app = workflow.compile()
        return await app.ainvoke(state)

Aggregate and parallel logic - Please let me know if this is the right way to do it

async def aggregate_results(self, state: GraphState):
        result = state.get(“XXX”, [])
        aggregated_result = self.aggregate_logic(result)
        return {"final_result": aggregated_result}

    def aggregate_logic(self, results: List[Dict[str, Any]]) -> Dict[str, Any]:
        return {
            “one_of_the_state_key”: [result.get("one_of_the_state_key", {}) for result in results],
        }

    async def process_attachments(self, state: GraphState):
        tasks = [self.process_single_attachment(attachment, state[‘XXX’]) 
                 for attachment in attachments]
        results = await asyncio.gather(*tasks) 
        return {“XXX_results": results}


async def process_single_attachment(self, attachment, claim, claim_summary):
        new_state = GraphState(
            attachment=[attachment]
        )
        master_agent = MasterAgent()
        result = await master_agent.run(new_state)
        return result

Error happens at FINAL_NODE

langgraph.errors.InvalidUpdateError: Must write to at least one of ['XX', 'YY', 'ZZ', etc.]

Update (21/08)

  • The ParallelDocumentProcessor runs in parallel and tasks output are gathered. I am able to see N number of outputs from each Agent with different document data.
  • Issue happens when I try to aggregate the result from N number of outputs to 1 single FINAL_NODE

Prem95 avatar Aug 21 '24 03:08 Prem95

Hey , I am facing this simillar error can someone help me to resolve this

File "/Users/nikhila.akuluru/Desktop/emailbox-automation/testar/lib/python3.12/site-packages/langgraph/pregel/write.py", line 157, in do_write raise InvalidUpdateError( langgraph.errors.InvalidUpdateError: Must write to at least one of ['checked_emails_ids', 'emails', 'action_required_emails']

Code :


inputs = {}
app = WorkFlow().app
app.invoke(inputs)

class WorkFlow():
	def __init__(self):
		nodes = Nodes()
		workflow = StateGraph(EmailsState)

		workflow.add_node("check_new_emails", nodes.check_email)
		workflow.add_node("wait_next_run", nodes.wait_next_run)
		workflow.add_node("draft_responses", EmailFilterCrew().kickoff)

		workflow.set_entry_point("check_new_emails")
		workflow.add_conditional_edges(
				"check_new_emails",
				nodes.new_emails,
				{
					"continue": 'draft_responses',
					"end": 'wait_next_run'
				}
		)
		workflow.add_edge('draft_responses', 'wait_next_run')
		workflow.add_edge('wait_next_run', 'check_new_emails')
		self.app = workflow.compile()

Nikhila-Akuluru avatar Aug 30 '24 13:08 Nikhila-Akuluru

inputs = {}

@Nikhila-Akuluru

inputs = {"checked_emails_ids": None}  # or  emails /  action_required_emails

You must fill in at least one value, which can be any initial value or None, etc.

gbaian10 avatar Aug 30 '24 14:08 gbaian10

I was trying to build customer support agent on a different use case for production , hosted on FAST API, I am stucked with the error " Must write to at least one of [] ". I am Invoking graph wit '''result = abot.graph_compiler.invoke({"messages": ("user",messages)},thread)'''

My Graph is similar to : builder = StateGraph(State) #Adding Get Order Info Node builder.add_node("fetch_user_info", self.user_info) builder.set_entry_point("fetch_user_info")

#Adding Delivery Preference Asistant builder.add_node( "enter_delivery_preference", create_entry_node("Delivery Preference Update Assistant", "delivery_preference"),

) builder.add_node("delivery_preference", Assistant(delivery_preference_runnable)) builder.add_edge("enter_delivery_preference", "delivery_preference") builder.add_node( "delivery_preference_sensitive_tools", create_tool_node_with_fallback(delivery_preference_sensitive_tools), ) builder.add_node( "delivery_preference_safe_tools", create_tool_node_with_fallback(delivery_preference_safe_tools), ) builder.add_edge("delivery_preference_sensitive_tools", "delivery_preference") builder.add_edge("delivery_preference_safe_tools", "delivery_preference") builder.add_conditional_edges("delivery_preference", self.route_delivery_preference) builder.add_node("leave_skill", self.pop_dialog_state) builder.add_edge("leave_skill", "primary_assistant")

#Adding Update Buyer Info Assistant builder.add_node( "enter_update_buyer_info", create_entry_node("Update Buyer Info Assistant", "update_buyer_info"), ) builder.add_node("update_buyer_info", Assistant(update_buyer_info_runnable)) builder.add_edge("enter_update_buyer_info", "update_buyer_info") builder.add_node( "update_buyer_info_safe_tools", create_tool_node_with_fallback(update_buyer_info_safe_tools), ) builder.add_node( "update_buyer_info_sensitive_tools", create_tool_node_with_fallback(update_buyer_info_sensitive_tools), ) builder.add_edge("update_buyer_info_sensitive_tools", "update_buyer_info") builder.add_edge("update_buyer_info_safe_tools", "update_buyer_info") builder.add_conditional_edges("update_buyer_info", self.route_update_buyer_info) # Create Escalation assistant builder.add_node( "enter_create_escalation", create_entry_node("Escalation Creation Agent", "create_escalation") ) builder.add_node("create_escalation", Assistant(create_escalation_runnable)) builder.add_edge("enter_create_escalation", "create_escalation") builder.add_node( "create_escalation_safe_tools", create_tool_node_with_fallback(create_escalation_safe_tools), ) builder.add_node( "create_escalation_sensitive_tools", create_tool_node_with_fallback(create_escalation_sensitive_tools), ) builder.add_edge("create_escalation_sensitive_tools", "create_escalation") builder.add_edge("create_escalation_safe_tools", "create_escalation") builder.add_conditional_edges("create_escalation", self.route_create_escalation) # Cancellation assistant builder.add_node( "enter_cancel_order", create_entry_node("Cancel Order Assistant", "cancel_order"), ) builder.add_node("cancel_order", Assistant(cancel_order_runnable)) builder.add_edge("enter_cancel_order", "cancel_order") builder.add_node( "cancel_order_safe_tools", create_tool_node_with_fallback(cancel_order_safe_tools), ) builder.add_node( "cancel_order_sensitive_tools", create_tool_node_with_fallback(cancel_order_sensitive_tools), ) builder.add_edge("cancel_order_sensitive_tools", "cancel_order") builder.add_edge("cancel_order_safe_tools", "cancel_order") builder.add_conditional_edges("cancel_order", self.route_cancel_order) # Primary assistant builder.add_node("primary_assistant", Assistant(assistant_runnable)) builder.add_node( "primary_assistant_tools", create_tool_node_with_fallback(primary_assistant_tools) ) # The assistant can route to one of the delegated assistants, # directly use a tool, or directly respond to the user builder.add_conditional_edges( "primary_assistant", self.route_primary_assistant, { "enter_delivery_preference": "enter_delivery_preference", "enter_update_buyer_info": "enter_update_buyer_info", "enter_create_escalation": "enter_create_escalation", "enter_cancel_order": "enter_cancel_order", "primary_assistant_tools": "primary_assistant_tools", END: END, }, ) builder.add_edge("primary_assistant_tools", "primary_assistant") builder.add_conditional_edges("fetch_user_info", self.route_to_workflow) # Compile graph memory = SqliteSaver.from_conn_string(":memory:") part_4_graph = builder.compile( checkpointer=memory, # Let the user approve or deny the use of sensitive tools interrupt_before=[ "delivery_preference_sensitive_tools", "update_buyer_info_sensitive_tools", "create_escalation_sensitive_tools", "cancel_order_sensitive_tools", ], ) self.graph_compiler=part_4_graph

Any help would be appreciated to resolve this error

gpiyush2532 avatar Sep 08 '24 19:09 gpiyush2532

Facing the same issue when invoking graph, even with all values initialized

wewesmog avatar Sep 19 '24 20:09 wewesmog

Facing the same issue:



def run_travel_planner(query: str, num_days: str) -> Dict[str, Any]:
    if not query or not num_days:
        logger.error("Invalid input: query and num_days must be non-empty strings.")
        return {"error": "Invalid input. Please provide a valid query and number of days."}

    try:
        input_data = {"query": query, "num_days": num_days}
        logger.debug(f"Running travel planner with input: {input_data}")
        result = app.invoke({"input": input_data})
        logger.debug(f"Travel planner result: {result}")
        return result
    except Exception as e:
        logger.error(f"Error in run_travel_planner: {str(e)}", exc_info=True)
        return {"error": f"An error occurred while planning your trip: {str(e)}"}

but in the log i have this:


Processing user input: campi flegrei
Number of days: 2
==================================================
2024-09-20 20:11:57,825 - app.langgraph_agents - DEBUG - Running travel planner with input: {'query': 'campi flegrei', 'num_days': '2'}
2024-09-20 20:11:57,827 - app.langgraph_agents - ERROR - Error in run_travel_planner: Must write to at least one of ['query', 'num_days']

robertobalestri avatar Sep 20 '24 18:09 robertobalestri

Getting the same error. Why this hasn;t been fixed after 4 months?

TechKemon avatar Oct 02 '24 21:10 TechKemon

Based on the error message, it seems you're attempting to implement the plan_and_execute LangChain agent graph. With the latest versions of LangChain and LangGraph (as of this writing), the provided code results in this error. I was able to resolve it by making the following changes:

import this: from langgraph.graph import MessagesState

change parameter from TypedDict to MessagesState in class definition: class PlanExecute(MessagesState): input: str plan: List[str] past_steps: Annotated[List[Tuple], operator.add] response: str

Inside the plan_step function (and all other functions as well), invoke with the state as parameter and not using the example code: (replace this line with the line below) plan = await planner.ainvoke({"messages": [("user", state["input"])]}) plan = await planner.ainvoke(state, config=config)

vantonop avatar Oct 04 '24 08:10 vantonop

I had the same issue while developing using LangGraph Studio. Turns out, one node was modifying a state key that was non existent (typo). Even after fixing the typo, the error still persisted. Changing the thread id fixed the issue.

geokanaan avatar Oct 20 '24 07:10 geokanaan

try to add 'chat_history: List[AnyMessage]' in your class State property, my question is solved!

JuneWooo avatar Oct 31 '24 08:10 JuneWooo

@JuneWooo like this ? doesn't work

State definition for plan-and-execute

class PlanExecute(TypedDict): input: str # Original user input plan: List[str] # Steps to follow chat_history: List[AnyMessage] past_steps: Annotated[List[Tuple], operator.add] # Executed steps response: str # Final response

gtnpromtior avatar Oct 31 '24 11:10 gtnpromtior

Checked other resources

  • [x] I added a very descriptive title to this issue.
  • [x] I searched the LangGraph/LangChain documentation with the integrated search.
  • [x] I used the GitHub search to find a similar question and didn't find it.
  • [x] I am sure that this is a bug in LangGraph/LangChain rather than my code.
  • [x] I am sure this is better as an issue rather than a GitHub discussion, since this is a LangGraph bug and not a design question.

Example Code

async def execute_step(state: PlanExecute):
    objective = state["input"]
    task = state["plan"][0]
    agent_response = await agent_executor.ainvoke({"objective": objective, "input": task, "chat_history": []})
    return {
        "past_steps": [(task, agent_response["result"])],
    }

Error Message and Stack Trace (if applicable)

Traceback (most recent call last):
  File "D:\githcoalagent\demo3\demo3_zysss.py", line 118, in <module>
    asyncio.run(handle_events(inputs, config))
  File "D:\conda-pachaall-llm\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "D:\conda-pach-llm\lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
  File "D:\glagent\demo3\demo3_zysss.py", line 107, in handle_events
    async for event in app.astream(inputs, config=config):
  File "D:\conda-pachage\envs\recall-llm\lib\site-packages\langgraph\pregel\__init__.py", line 1333, in astream
    _panic_or_proceed(done, inflight, step)
  File "D:\conda-pachage\envs\recall-llm\lib\site-packages\langgraph\pregel\__init__.py", line 1537, in _panic_or_proceed
    raise exc
  File "D:\conda-pachage\envs\recall-llm\lib\site-packages\langgraph\pregel\retry.py", line 120, in arun_with_retry
    await task.proc.ainvoke(task.input, task.config)
  File "D:\conda-pachage\envs\recall-llm\lib\site-packages\langchain_core\runnables\base.py", line 2542, in ainvoke
    input = await step.ainvoke(input, config)
  File "D:\conda-pachage\envs\recall-llm\lib\site-packages\langgraph\utils.py", line 107, in ainvoke
    ret = await self._acall_with_config(
  File "D:\conda-pachage\envs\recall-llm\lib\site-packages\langchain_core\runnables\base.py", line 1650, in _acall_with_config
    output = await coro
  File "D:\conda-pachageb\site-packages\langgraph\pregel\write.py", line 141, in _awrite
    self.do_write(
  File "D:\conggraph\pregel\write.py", line 157, in do_write
    raise InvalidUpdateError(
langgraph.errors.InvalidUpdateError: Must write to at least one of ['input', 'plan', 'past_steps', 'response']

Description

File "D:\conda-pachage\envs\recall-llm\lib\site-packages\langgraph\pregel\write.py", line 141, in _awrite self.do_write( File "D:\conda-pachage\envs\recall-llm\lib\site-packages\langgraph\pregel\write.py", line 157, in do_write raise InvalidUpdateError( langgraph.errors.InvalidUpdateEr

System Info

File "D:\conda-pachage\envs\recall-llm\lib\site-packages\langgraph\pregel\write.py", line 141, in _awrite self.do_write( File "D:\conda-pachage\envs\recall-llm\lib\site-packages\langgraph\pregel\write.py", line 157, in do_write raise InvalidUpdateError( langgraph.errors.InvalidUpdateEr

Did you make types of State Optional like this below:

system: **Optional[str]**

Halil3509 avatar Nov 14 '24 10:11 Halil3509