Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pipeline/preprocessors/link_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,9 @@ class LinkMap(TypedDict):
# @langchain/core references
"AIMessage": "classes/_langchain_core.messages.AIMessage.html",
"AIMessageChunk": "classes/_langchain_core.messages.AIMessageChunk.html",
"SystemMessage": "classes/_langchain_core.messages.SystemMessage.html",
"SystemMessage.concat": "classes/_langchain_core.messages.SystemMessage.html#concat",
"ModelRequest": "classes/_langchain_core.messages.ModelRequest.html",
"BaseChatModel.invoke": "classes/_langchain_core.language_models_chat_models.BaseChatModel.html#invoke",
"BaseChatModel.stream": "classes/_langchain_core.language_models_chat_models.BaseChatModel.html#stream",
"BaseChatModel.streamEvents": "classes/_langchain_core.language_models_chat_models.BaseChatModel.html#streamEvents",
Expand Down
6 changes: 4 additions & 2 deletions src/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,8 @@
{
"group": "Releases",
"pages": [
"oss/python/releases/langchain-v1"
"oss/python/releases/langchain-v1",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's order this newest to oldest

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, can you remove the /releases/langchain-v1 from the langchain tab?

i think the release notes should live in the Reference tab and we can keep the migration guide on the main tab

"oss/python/releases/langchain-v1-1"
]
},
{
Expand Down Expand Up @@ -792,7 +793,8 @@
{
"group": "Releases",
"pages": [
"oss/javascript/releases/langchain-v1"
"oss/javascript/releases/langchain-v1",
"oss/javascript/releases/langchain-v1-1"
]
},
{
Expand Down
136 changes: 136 additions & 0 deletions src/oss/javascript/releases/langchain-v1-1.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
---
title: What's new in v1.1
sidebarTitle: v1.1 Release notes
---

**LangChain v1.1 focuses on improving agent reliability and flexibility.** This release introduces model profiles for better model capability awareness, new middleware capabilities for retrying model calls and content moderation, improved system message handling, and enhanced compatibility with Zod v4.

To upgrade,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To upgrade,
To upgrade:


<CodeGroup>
```bash npm
npm install @langchain/core @langchain/langgraph
```
```bash pnpm
pnpm add @langchain/core @langchain/langgraph
```
```bash yarn
yarn add @langchain/core @langchain/langgraph
```
```bash bun
bun add @langchain/core @langchain/langgraph
```
</CodeGroup>

## Model profiles

Model profiles provide a standardized way to understand model capabilities and constraints. Every chat model now exposes a `.profile` getter that returns information about context window size, structured output support, and other model-specific characteristics.

```typescript
import { initChatModel } from "langchain";

const model = await initChatModel("gpt-4o");
const profile = model.profile;

console.log(profile.maxTokens); // Maximum context window size
console.log(profile.supportsStructuredOutput); // Native structured output support
```

Profiles are automatically generated from [models.dev](https://models.dev) and enable middleware like summarization to use accurate token limits, while `createAgent` can automatically detect native structured output support.

## System message improvements

You can now pass a `SystemMessage` instance directly to the `systemPrompt` parameter when creating agents, and use the new `concat` method to extend system messages. This enables advanced features like cache control (e.g., Anthropic's ephemeral cache) and structured content blocks.

```typescript
import { createAgent, SystemMessage } from "langchain";

// SystemMessage instance with cache control
const agent = createAgent({
model: "anthropic:claude-3-5-sonnet",
tools: [myTool],
systemPrompt: new SystemMessage({
content: [
{
type: "text",
text: "You are a helpful assistant.",
},
{
type: "text",
text: "Today's date is 2024-06-01.",
cache_control: { type: "ephemeral", ttl: "5m" },
},
],
}),
});
```

When using middleware with `wrapModelCall`, you can modify system prompts using either `systemPrompt` (string) or `systemMessage` (SystemMessage object). See the [custom middleware documentation](/oss/langchain/middleware/custom#working-with-system-messages) for detailed examples and best practices.

## Model retry middleware

A new `modelRetryMiddleware` automatically retries failed model calls with configurable exponential backoff, improving agent reliability by handling transient model failures gracefully.

```typescript
import { createAgent, modelRetryMiddleware } from "langchain";

const agent = createAgent({
model: "gpt-4o",
tools: [searchTool, databaseTool],
middleware: [
modelRetryMiddleware({
maxRetries: 3,
backoffFactor: 2.0,
initialDelayMs: 1000,
}),
],
});
```

See the [built-in middleware documentation](/oss/langchain/middleware/built-in) for configuration options and detailed examples.

## OpenAI content moderation middleware

A new middleware integrates OpenAI's moderation endpoint to detect and handle unsafe content in agent interactions. This middleware is useful for applications requiring content safety and compliance.

The middleware can check content at multiple stages:
- **Input checking**: User messages before model calls
- **Output checking**: AI messages after model calls
- **Tool results**: Tool outputs before model calls

You can configure how violations are handled with options like ending execution, raising errors, or replacing flagged content. See the [middleware documentation](/oss/langchain/middleware/built-in#content-moderation) for detailed usage examples.

## Compatibility improvements

### Zod v4 support

LangChain.js now supports Zod v4, ensuring seamless integration with the latest version of the schema validation library. This update maintains backward compatibility while enabling you to use the latest Zod features for structured output and tool schemas.

## Reporting issues

Please report any issues discovered with v1.1 on [GitHub](https://github.com/langchain-ai/langchainjs/issues) using the [`'v1.1'` label](https://github.com/langchain-ai/langchainjs/issues?q=state%3Aopen%20label%3Av1.1).

## Additional resources

<CardGroup cols={3}>
<Card title="Agents" icon="robot" href="/oss/langchain/agents" arrow>
Learn about building agents with LangChain
</Card>
<Card title="Middleware" icon="layer-group" href="/oss/langchain/middleware/overview" arrow>
Deep dive into middleware concepts
</Card>
<Card title="Tools" icon="wrench" href="/oss/langchain/tools" arrow>
Working with tools in agents
</Card>
<Card title="Migration guide" icon="arrow-right-arrow-left" href="/oss/migrate/langchain-v1" arrow>
How to migrate to LangChain v1
</Card>
<Card title="GitHub" icon="github" href="https://github.com/langchain-ai/langchainjs">
Report issues or contribute
</Card>
</CardGroup>

## See also
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

combine with additional resources section?


- [Versioning](/oss/javascript/versioning) - Understanding version numbers
- [Release policy](/oss/javascript/release-policy) - Detailed release policies
73 changes: 73 additions & 0 deletions src/oss/langchain/middleware/custom.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,79 @@ const agent = createAgent({

:::

### Working with system messages

You can modify system prompts in middleware using either `systemPrompt` (`string`) or `systemMessage` (@[`SystemMessage`]). The @[`ModelRequest`] provides both for maximum flexibility.

**Key behavior:**
- Middleware receives both `systemPrompt` (string) and `systemMessage` (@[`SystemMessage`]) in the request
- You can modify either `systemPrompt` or `systemMessage`, but **cannot set both in the same middleware call** - this prevents conflicts
- Using `systemPrompt` creates a new simple system message (may overwrite cache control metadata)
- Using `systemMessage` (JavaScript) or manually combining content blocks (Python) preserves existing cache control and structured content blocks
- Multiple middleware can chain modifications sequentially across different middleware calls

:::python

```python
@wrap_model_call
def add_context_preserve_cache(
request: ModelRequest,
handler: Callable[[ModelRequest], ModelResponse],
) -> ModelResponse:
new_system_message = SystemMessage(content="Additional context.")
return handler(request.override(system_message=new_system_message))
```
:::

:::js
**Example: Chaining middleware** - Different middleware can use different approaches:

```typescript
import { createMiddleware, SystemMessage, createAgent } from "langchain";

// Middleware 1: Uses systemPrompt (string)
const myMiddleware = createMiddleware({
name: "MyMiddleware",
wrapModelCall: async (request, handler) => {
return handler({
...request,
systemPrompt: request.systemMessage.concat(`\nAdditional context.`),
});
},
});

// Middleware 2: Uses systemMessage (preserves structure)
const myOtherMiddleware = createMiddleware({
name: "MyOtherMiddleware",
wrapModelCall: async (request, handler) => {
return handler({
...request,
systemMessage: request.systemMessage.concat(
new SystemMessage({
content: [
{
type: "text",
text: " More additional context. This will be cached.",
cache_control: { type: "ephemeral", ttl: "5m" },
},
],
})
),
});
},
});

const agent = createAgent({
model: "anthropic:claude-3-5-sonnet",
systemPrompt: "You are a helpful assistant.",
middleware: [myMiddleware, myOtherMiddleware],
});
```

Use @[`SystemMessage.concat`] to preserve cache control metadata or structured content blocks created by other middleware.

:::

## Additional resources

- [Middleware API reference](https://reference.langchain.com/python/langchain/middleware/)
Expand Down
62 changes: 62 additions & 0 deletions src/oss/python/releases/langchain-v1-1.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: What's new in v1.1
sidebarTitle: v1.1 Release notes
---

**LangChain v1.1 focuses on improving agent reliability and flexibility.** This release introduces model profiles, new middleware capabilities, and enhanced type safety for custom middleware implementations.

To upgrade,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To upgrade,
To upgrade:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to spell out installation instructions for every minor release.


<CodeGroup>
```bash pip
pip install -U langchain
```
```bash uv
uv add langchain
```
</CodeGroup>

## Model profiles

Model profiles allow you to configure how agents interact with specific models by defining capabilities, context handling, and structured output behavior.

### Summarization middleware

### Structured output for agents

## Model retry middleware

## Misc

### New middleware docs

### Type safety improvements for custom middlewares

## Reporting issues

Please report any issues discovered with v1.1 on [GitHub](https://github.com/langchain-ai/langchain/issues) using the [`'v1.1'` label](https://github.com/langchain-ai/langchain/issues?q=state%3Aopen%20label%3Av1.1).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

personal opinion / feeling but I don't feel the need to ask people to label all their issues with the corresponding version— don't we ask for this information in the issue template?


## Additional resources

<CardGroup cols={3}>
<Card title="Agents" icon="robot" href="/oss/langchain/agents" arrow>
Learn about building agents with LangChain
</Card>
<Card title="Middleware" icon="layer-group" href="/oss/langchain/middleware/overview" arrow>
Deep dive into middleware concepts
</Card>
<Card title="Tools" icon="wrench" href="/oss/langchain/tools" arrow>
Working with tools in agents
</Card>
<Card title="Migration guide" icon="arrow-right-arrow-left" href="/oss/migrate/langchain-v1" arrow>
How to migrate to LangChain v1
</Card>
<Card title="GitHub" icon="github" href="https://github.com/langchain-ai/langchain">
Report issues or contribute
</Card>
</CardGroup>

## See also

- [Versioning](/oss/python/versioning) - Understanding version numbers
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe these should be combined w the "Additional resources" section?

- [Release policy](/oss/python/release-policy) - Detailed release policies
Loading