langchain-ai / langgraph

Build resilient language agents as graphs.
https://langchain-ai.github.io/langgraph/
MIT License
4.1k stars 618 forks source link

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

Open cristianohello opened 1 week ago

cristianohello commented 1 week ago

Checked other resources

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 commented 1 week ago

langgraph 0.0.69

hinthornw commented 1 week ago

Could you share the MVC for your graph?

JoffreyLemery commented 5 days ago

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 ?