Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
94 changes: 47 additions & 47 deletions src/oss/python/migrate/langchain-v1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,6 @@ sidebarTitle: Migrate to v1

This guide outlines the major changes between LangChain v1 and previous versions.

## Simplified package

The `langchain` package namespace has been significantly reduced in v1 to focus on essential building blocks for agents. The streamlined package makes it easier to discover and use the core functionality.

### Namespace

| Module | What's available | Notes |
|--------|------------------|-------|
| `langchain.agents` | `create_agent`, `AgentState` | Core agent creation functionality |
| `langchain.messages` | Message types, content blocks, `trim_messages` | Re-exported from `langchain-core` |
| `langchain.tools` | `tool`, `BaseTool`, injection helpers | Re-exported from `langchain-core` |
| `langchain.chat_models` | `init_chat_model`, `BaseChatModel` | Unified model initialization |
| `langchain.embeddings` | `Embeddings`, `init_embeddings`, | Embedding models |

### `langchain-classic`

If you were using any of the following from the `langchain` package, you'll need to install `langchain-classic` and update your imports:

- Legacy chains (`LLMChain`, `ConversationChain`, etc.)
- The indexing API
- `langchain-community` re-exports
- Other deprecated functionality

<CodeGroup>
```python v1 (new)
# For legacy chains
from langchain_classic.chains import LLMChain

# For indexing
from langchain_classic.indexes import ...
```

```python v0 (old)
from langchain.chains import LLMChain
from langchain.indexes import ...
```
</CodeGroup>

**Installation**:
```bash
uv pip install langchain-classic
```

---

## Migrate to `create_agent`

Pre v1, we recommended you use `langgraph.prebuilt.create_react_agent` to build agents.
Expand All @@ -69,7 +24,7 @@ The table below outlines what functionality has changed from `create_react_agent
| [Structured output](#structured-output) | prompted output removed, use `ToolStrategy`/`ProviderStrategy` |
| [Streaming node name](#streaming-node-name-rename) | Node name changed from `"agent"` to `"model"` |
| [Runtime context](#runtime-context) | Dependency injection via `context` argument instead of `config["configurable"]` |
| [Namespace](#simplified-namespace) | Streamlined to focus on agent building blocks, legacy code moved to `langchain-classic` |
| [Namespace](#simplified-package) | Streamlined to focus on agent building blocks, legacy code moved to `langchain-classic` |
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

The anchor link '#simplified-package' should be '#simplified-namespace' to match the actual section heading 'Simplified package' which would generate the anchor 'simplified-package', but the table row describes 'Namespace' functionality. This creates inconsistency between the link text and target.

Suggested change
| [Namespace](#simplified-package) | Streamlined to focus on agent building blocks, legacy code moved to `langchain-classic` |
| [Simplified package](#simplified-package) | Streamlined to focus on agent building blocks, legacy code moved to `langchain-classic` |

Copilot uses AI. Check for mistakes.


### Import path

Expand Down Expand Up @@ -665,6 +620,51 @@ result = agent.invoke(

---

## Simplified package

The `langchain` package namespace has been significantly reduced in v1 to focus on essential building blocks for agents. The streamlined package makes it easier to discover and use the core functionality.

### Namespace

| Module | What's available | Notes |
|--------|------------------|-------|
| `langchain.agents` | `create_agent`, `AgentState` | Core agent creation functionality |
| `langchain.messages` | Message types, content blocks, `trim_messages` | Re-exported from `langchain-core` |
| `langchain.tools` | `tool`, `BaseTool`, injection helpers | Re-exported from `langchain-core` |
| `langchain.chat_models` | `init_chat_model`, `BaseChatModel` | Unified model initialization |
| `langchain.embeddings` | `Embeddings`, `init_embeddings`, | Embedding models |

### `langchain-classic`

If you were using any of the following from the `langchain` package, you'll need to install `langchain-classic` and update your imports:

- Legacy chains (`LLMChain`, `ConversationChain`, etc.)
- The indexing API
- `langchain-community` re-exports
- Other deprecated functionality

<CodeGroup>
```python v1 (new)
# For legacy chains
from langchain_classic.chains import LLMChain

# For indexing
from langchain_classic.indexes import ...
```

```python v0 (old)
from langchain.chains import LLMChain
from langchain.indexes import ...
```
</CodeGroup>

**Installation**:
```bash
uv pip install langchain-classic
```

---

## Breaking changes

### Dropped Python 3.9 support
Expand Down Expand Up @@ -699,7 +699,7 @@ The `max_tokens` parameter now defaults to higher values based on the model chos

### Legacy code moved to `langchain-classic`

Existing functionality outside the focus of standard interfaces and agents has been moved to the [`langchain-classic`](https://pypi.org/project/langchain-classic) package. See the [Simplified namespace](#simplified-namespace) section for details on what's available in the core `langchain` package and what moved to `langchain-classic`.
Existing functionality outside the focus of standard interfaces and agents has been moved to the [`langchain-classic`](https://pypi.org/project/langchain-classic) package. See the [Simplified package](#simplified-package) section for details on what's available in the core `langchain` package and what moved to `langchain-classic`.
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

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

The anchor link '#simplified-package' is correct for targeting the 'Simplified package' section, but this link was updated while the previous reference in the table (line 27) still uses the same anchor. Both should be consistent and point to the correct section.

Suggested change
Existing functionality outside the focus of standard interfaces and agents has been moved to the [`langchain-classic`](https://pypi.org/project/langchain-classic) package. See the [Simplified package](#simplified-package) section for details on what's available in the core `langchain` package and what moved to `langchain-classic`.
Existing functionality outside the focus of standard interfaces and agents has been moved to the [`langchain-classic`](https://pypi.org/project/langchain-classic) package. See the [Package: Simplified](#package-simplified) section for details on what's available in the core `langchain` package and what moved to `langchain-classic`.

Copilot uses AI. Check for mistakes.


### Removal of deprecated APIs

Expand Down
142 changes: 71 additions & 71 deletions src/oss/python/releases/langchain-v1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,86 @@ import AlphaCallout from '/snippets/alpha-lc-callout.mdx';
**LangChain v1 is a focused, production-ready foundation for building agentic applications.** We've streamlined the framework around three core improvements:

<CardGroup cols={1}>
<Card title="Simplified namespace" icon="sitemap" href="#simplified-namespace" arrow>
The `langchain` namespace has been streamlined to focus on essential building blocks for agents, with legacy functionality moved to `langchain-classic`.
</Card>
<Card title="create_agent" icon="robot" href="#create-agent" arrow>
A new standard way to build agents in LangChain, replacing `langgraph.prebuilt.create_react_agent` with a cleaner, more powerful API.
</Card>
<Card title="Standard content blocks" icon="cube" href="#standard-content-blocks" arrow>
A new `content_blocks` property that provides unified access to modern LLM features across all providers.
</Card>
<Card title="Simplified namespace" icon="sitemap" href="#simplified-namespace" arrow>
The `langchain` namespace has been streamlined to focus on essential building blocks for agents, with legacy functionality moved to `langchain-classic`.
</Card>
</CardGroup>


## Simplified package

LangChain v1 streamlines the `langchain` package namespace to focus on essential building blocks for agents. The namespace exposes only the most useful and relevant functionality:

### Namespace

The v1 namespace includes:

| Module | What's available | Notes |
|--------|------------------|-------|
| `langchain.agents` | `create_agent`, `AgentState` | Core agent creation functionality |
| `langchain.messages` | Message types, content blocks, `trim_messages` | Re-exported from `langchain-core` |
| `langchain.tools` | `tool`, `BaseTool`, injection helpers | Re-exported from `langchain-core` |
| `langchain.chat_models` | `init_chat_model`, `BaseChatModel` | Unified model initialization |
| `langchain.embeddings` | `Embeddings`, `init_embeddings` | Embedding models |

Most of these exports are re-exported from `langchain-core` for convenience, giving you a focused API surface for building agents.

```python
# Agent building
from langchain.agents import create_agent

# Messages and content
from langchain.messages import AIMessage, HumanMessage

# Tools
from langchain.tools import tool

# Model initialization
from langchain.chat_models import init_chat_model
from langchain.embeddings import init_embeddings
```

### `langchain-classic`

Legacy functionality has moved to [`langchain-classic`](https://pypi.org/project/langchain-classic) to keep the core package lean and focused.

#### What's in `langchain-classic`

- Legacy chains and chain implementations
- The indexing API
- [`langchain-community`](https://pypi.org/project/langchain-community) exports
- Other deprecated functionality

If you use any of this functionality, install [`langchain-classic`](https://pypi.org/project/langchain-classic):

<CodeGroup>
```bash pip
pip install langchain-classic
```

```bash uv
uv add langchain-classic
```
</CodeGroup>

Then update your imports:

```python
from langchain import ... # [!code --]
from langchain_classic import ... # [!code ++]

from langchain.chains import ... # [!code --]
from langchain_classic.chains import ... # [!code ++]
```

---

## `create_agent`

`create_agent` is the standard way to build agents in LangChain 1.0. It provides a simpler interface than `langgraph.prebuilt.create_react_agent` while offering greater customization potential by using middleware.
Expand Down Expand Up @@ -279,74 +347,6 @@ for block in response.content_blocks:

For more information, see our guide on [content blocks](/oss/langchain/messages#content)

---

## Simplified package

LangChain v1 streamlines the `langchain` package namespace to focus on essential building blocks for agents. The namespace exposes only the most useful and relevant functionality:

### Namespace

The v1 namespace includes:

| Module | What's available | Notes |
|--------|------------------|-------|
| `langchain.agents` | `create_agent`, `AgentState` | Core agent creation functionality |
| `langchain.messages` | Message types, content blocks, `trim_messages` | Re-exported from `langchain-core` |
| `langchain.tools` | `tool`, `BaseTool`, injection helpers | Re-exported from `langchain-core` |
| `langchain.chat_models` | `init_chat_model`, `BaseChatModel` | Unified model initialization |
| `langchain.embeddings` | `Embeddings`, `init_embeddings` | Embedding models |

Most of these exports are re-exported from `langchain-core` for convenience, giving you a focused API surface for building agents.

```python
# Agent building
from langchain.agents import create_agent

# Messages and content
from langchain.messages import AIMessage, HumanMessage

# Tools
from langchain.tools import tool

# Model initialization
from langchain.chat_models import init_chat_model
from langchain.embeddings import init_embeddings
```

### `langchain-classic`

Legacy functionality has moved to [`langchain-classic`](https://pypi.org/project/langchain-classic) to keep the core package lean and focused.

#### What's in `langchain-classic`

- Legacy chains and chain implementations
- The indexing API
- [`langchain-community`](https://pypi.org/project/langchain-community) exports
- Other deprecated functionality

If you use any of this functionality, install [`langchain-classic`](https://pypi.org/project/langchain-classic):

<CodeGroup>
```bash pip
pip install langchain-classic
```

```bash uv
uv add langchain-classic
```
</CodeGroup>

Then update your imports:

```python
from langchain import ... # [!code --]
from langchain_classic import ... # [!code ++]

from langchain.chains import ... # [!code --]
from langchain_classic.chains import ... # [!code ++]
```

## Reporting issues

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