Back Home

GitHub Repo

LangChain Core 1.7.6 Improves Streaming Tool Call Accumulation, Reducing Repeated Parsing of Large Arguments

LangChain released Core 1.7.6 on November 5, changing how messages are merged in Runnable streams to address latency caused by repeatedly parsing large tool arguments. In a maintainer’s specific test, runtime fell from 17.35 seconds to 0.07 seconds, but the fix does not cover manually accumulated messages or some streaming paths.

Dirck van Baburen · Public domain · Image source
zh-Hant

LangChain released langchain-core 1.7.6 on November 5, including a performance fix for accumulating streamed messages. For agents that have a model generate long file contents and then write them through a tool, the change addresses framework-side parsing costs that can grow with the output. The GitHub release notes list the fix, and the package is available on PyPI. Release notes, PyPI package

The issue was in how AIMessageChunk objects are added: each merge reparsed the tool call arguments received so far. When a Runnable stream adds chunks to an accumulated result one at a time, it repeatedly processes increasingly long content, causing the accumulation cost for large tool arguments to grow quadratically. Maintainers tested chain.stream() with 91 KB of arguments in 20-character chunks and reported that runtime fell from 17.35 seconds to 0.07 seconds. This was a specific reproduction case and should not be taken as the speedup for a complete agent task. Fix and test details

The new version temporarily buffers consecutive message chunks at the start of the stream, then merges them once when the full result is read, reducing repeated parsing. Coverage includes stream tracing, the default sync and async transforms, and input and output accumulation in RunnableLambda. This gives engineering teams another framework-level factor to investigate when analyzing long tool call delays; a substantial benefit is possible if message accumulation is indeed the bottleneck. Implementation scope

Before deployment, teams should check the paths they actually use. Manually accumulating messages with acc += chunk, nested messages wrapped in dictionaries, and paths such as astream_log were not improved by this change. Teams can compare CPU time and end-to-end latency on existing long-argument cases before and after upgrading, and verify that tool arguments and tracing results remain consistent. The official documentation describes several streaming modes, but that does not mean every mode benefits from the fix; teams should watch for whether the remaining accumulators receive the same optimization. Known limitations, Streaming documentation

Sources

  1. LangChain Core 1.7.6 發行紀錄
  2. Runnable 串流訊息一次合併修補 #41697
  3. langchain-core 1.7.6
  4. LangChain Streaming 文件