Haisum's Blog It's not a bug, it's a feature.

Exciting new additions to Langchain 1.0.0

Langchain 1.0.0 seems to have plenty of useful improvements lately. If you previously wrote code for Agentic AI, there is plenty of opportunity to clean up the code.

Here are some I am really looking forward to:

Todo Middleware:

A lot of coding agents use a Todo list or task list to keep track of things to do to keep the context focused. Usually, one would define a function for writing and reading todos which would save and read them from some store. These functions will be exported as tools for LLM. With Todo Middleware, this is automatically done, so you can clean up code and use this middleware instead.

Dynamic Prompt Middleware:

System prompts may not always be static. For example, one might want to pass user information to LLM in system prompt or additional context like today’s date. This becomes problematic when you want to resume conversation with a previously saved state. If information changed then one would write code to dynamically mutate state before passing it to an LLM. Dynamic prompt middleware lets you do away with that code.

Summarization Middleware:

Summarization middleware will summarize the conversation if it approaches some token limit. This allows the conversation to go on with LLM virtually infinitely without ever hitting context size limits at the cost of losing some context. Earlier, one would do this manually or with the Langmem package which was Python only. Summarization middleware can be used instead and cleanup the implementation.

Anthropic Prompt Caching:

If you are using Anthropic API, you must use caching to speed up responses and save on costs. This is done by clever placement of caching tags in content blocks sent to the LLM in requests. Earlier, this had to be additional code, usually before calling a model. Now, that can happen automatically thanks to this new middleware.

Overall, I think middleware is a really useful addition to the already powerful LangChain ecosystem and opens up opportunities to make even more efficient agents while keeping code complexity low.

There are many more additions and a new documentation site and promise of keeping API stable going forward.

https://github.com/langchain-ai/langchainjs/releases/tag/langchain%3D%3D1.0.0-alpha.7

Note

This is also posted on my LinkedIn here: https://www.linkedin.com/pulse/langchain-100-haisum-mussawir-td03f