From 4dfd1c368c6aaa65eb274d493e9ff1b9816d432d Mon Sep 17 00:00:00 2001 From: Todd Chaney <47466952+Therealchainman@users.noreply.github.com> Date: Tue, 9 Sep 2025 11:27:23 -0400 Subject: [PATCH] Fix to graph-api docs Send API example (#5576) Very small update to docs, I think there is an add_edge that shouldn't be there and a bug. Adding the Annotated, resolves this error I received running the example. Traceback (most recent call last): File "/Users/toddchaney/repos/work/importal-apps/python-worker/main.py", line 52, in for step in graph.stream({"topic": "animals"}, stream_mode = ["updates", "values"]): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/toddchaney/repos/work/importal-apps/python-worker/.venv/lib/python3.12/site-packages/langgraph/pregel/__init__.py", line 2544, in stream loop.after_tick() File "/Users/toddchaney/repos/work/importal-apps/python-worker/.venv/lib/python3.12/site-packages/langgraph/pregel/loop.py", line 526, in after_tick self.updated_channels = apply_writes( ^^^^^^^^^^^^^ File "/Users/toddchaney/repos/work/importal-apps/python-worker/.venv/lib/python3.12/site-packages/langgraph/pregel/algo.py", line 299, in apply_writes if channels[chan].update(vals) and next_version is not None: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/toddchaney/repos/work/importal-apps/python-worker/.venv/lib/python3.12/site-packages/langgraph/channels/last_value.py", line 58, in update raise InvalidUpdateError(msg) langgraph.errors.InvalidUpdateError: At key 'jokes': Can receive only one value per step. Use an Annotated key to handle multiple values. For troubleshooting, visit: https://python.langchain.com/docs/troubleshooting/errors/INVALID_CONCURRENT_GRAPH_UPDATE Co-authored-by: Sydney Runkle <54324534+sydney-runkle@users.noreply.github.com> Co-authored-by: Eugene Yurtsev --- docs/docs/how-tos/graph-api.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/docs/how-tos/graph-api.md b/docs/docs/how-tos/graph-api.md index 9a64d5cd8..c92f45dcc 100644 --- a/docs/docs/how-tos/graph-api.md +++ b/docs/docs/how-tos/graph-api.md @@ -2110,7 +2110,6 @@ builder.add_edge(START, "generate_topics") builder.add_conditional_edges("generate_topics", continue_to_jokes, ["generate_joke"]) builder.add_edge("generate_joke", "best_joke") builder.add_edge("best_joke", END) -builder.add_edge("generate_topics", END) graph = builder.compile() ```