You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ended up pivoting to a simple changelog approach for the 1.1 release
notes. This is more sustainable and motivates us to write up robust docs
that we can link out to for new features and changes.
Post actual release, we can link out to the changelog on github w/ nitty
gritty details.
Also fixing some broken links :)
---------
Co-authored-by: Christian Bromann <[email protected]>
Co-authored-by: Chester Curme <[email protected]>
Co-authored-by: Mason Daugherty <[email protected]>
*[Model profiles](/oss/langchain/models#model-profiles): Chat models now expose supported features and capabilities through a `.profile` getter. These data are derived from [models.dev](https://github.com/sst/models.dev), an open source project providing model capability data.
12
+
*[Model retry middleware](/oss/langchain/middleware/built-in#model-retry): New middleware for automatically retrying failed model calls with configurable exponential backoff, improving agent reliability.
13
+
*[Content moderation middleware](/oss/langchain/middleware/built-in#content-moderation): OpenAI content moderation middleware for detecting and handling unsafe content in agent interactions. Supports checking user input, model output, and tool results.
14
+
*[Summarization middleware](/oss/langchain/middleware/built-in#summarization): Updated to support flexible trigger points using model profiles for context-aware summarization.
15
+
*[Structured output](/oss/langchain/structured-output): `ProviderStrategy` support (native structured output) can now be inferred from model profiles.
16
+
*[`SystemMessage` for `createAgent`](/oss/langchain/middleware/custom#working-with-system-messages): Support for passing `SystemMessage` instances directly to `createAgent`'s `systemPrompt` parameter and a new `concat` method for extending system messages. Enables advanced features like cache control and structured content blocks.
17
+
*[Dynamic system prompt middleware](/oss/langchain/agents#dynamic-system-prompt): Return values from `dynamicSystemPromptMiddleware` are now purely additive. When returning a @[`SystemMessage`] or `string`, they are merged with existing system messages rather than replacing them, making it easier to compose multiple middleware that modify the prompt.
18
+
***Compatibility improvements:** Fixed error handling for Zod v4 validation errors in structured output and tool schemas, ensuring detailed error messages are properly displayed.
19
+
20
+
</Update>
21
+
22
+
## Resources
23
+
24
+
-[V1 Migration guide](/oss/migrate/langchain-v1) - How to migrate to LangChain v1
Copy file name to clipboardExpand all lines: src/oss/langchain/middleware/custom.mdx
+195Lines changed: 195 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -919,6 +919,201 @@ const agent = createAgent({
919
919
920
920
:::
921
921
922
+
### Working with system messages
923
+
924
+
:::python
925
+
926
+
Modify system messages in middleware using the `system_message` field on `ModelRequest`. The `system_message` field contains a @[`SystemMessage`] object (even if the agent was created with a string `system_prompt`).
927
+
928
+
**Example: Adding context to system message**
929
+
930
+
<Tabs>
931
+
<Tabtitle="Decorator">
932
+
933
+
```python
934
+
from langchain.agents.middleware import wrap_model_call, ModelRequest, ModelResponse
-`ModelRequest.system_message` is always a @[`SystemMessage`] object, even if the agent was created with `system_prompt="string"`
1045
+
- Use `SystemMessage.content_blocks` to access content as a list of blocks, regardless of whether the original content was a string or list
1046
+
- When modifying system messages, use `content_blocks` and append new blocks to preserve existing structure
1047
+
- You can pass @[`SystemMessage`] objects directly to `create_agent`'s `system_prompt` parameter for advanced use cases like cache control
1048
+
1049
+
:::
1050
+
1051
+
:::js
1052
+
Modify system messages in middleware using the `systemMessage` field in `ModelRequest`. It contains a @[`SystemMessage`] object (even if the agent was created with a string @[`systemPrompt`]).
1053
+
1054
+
**Example: Chaining middleware** - Different middleware can use different approaches:
0 commit comments