🎉 LangChain v1.0 is here! This release provides a focused, production-ready foundation for building agents with significant improvements to the core abstractions and APIs. See the release notes for more details.
✨ Major Features
Standard content blocks
A new unified API for accessing modern LLM features across all providers:
- New
contentBlocks
property: Provides provider-agnostic access to reasoning traces, citations, built-in tools (web search, code interpreters, etc.), and other advanced LLM features - Type-safe: Full TypeScript support with type hints for all content block types
- Backward compatible: Content blocks can be loaded lazily with no breaking changes to existing code
Example:
const response = await model.invoke([
{ role: "user", content: "What is the weather in Tokyo?" },
]);
// Access structured content blocks
for (const block of response.contentBlocks) {
if (block.type === "thinking") {
console.log("Model reasoning:", block.thinking);
} else if (block.type === "text") {
console.log("Response:", block.text);
}
}
For more information, see our guide on content blocks.
Enhanced Message API
Improvements to the core message types:
- Structured content: Better support for multimodal content with the new content blocks API
- Provider compatibility: Consistent message format across all LLM providers
- Rich metadata: Enhanced metadata support for tracking message provenance and transformations
🔧 Improvements
- Better structured output generation: Core abstractions for generating structured outputs in the main agent loop
- Improved type safety: Enhanced TypeScript definitions across all core abstractions
- Performance optimizations: Reduced overhead in message processing and runnable composition
- Better error handling: More informative error messages and better error recovery
📦 Package Changes
The @langchain/core
package remains focused on essential abstractions:
- Core message types and content blocks
- Base runnable abstractions
- Tool definitions and schemas
- Middleware infrastructure
- Callback system
- Output parsers
- Prompt templates
🔄 Migration Notes
Backward Compatibility: This release maintains backward compatibility with existing code. Content blocks are loaded lazily, so no changes are required to existing applications.
New Features: To take advantage of new features like content blocks and middleware:
-
Update to
@langchain/core@next
:npm install @langchain/core@1.0.0
-
Use the new
contentBlocks
property to access rich content:const response = await model.invoke(messages); console.log(response.contentBlocks); // New API console.log(response.content); // Legacy API still works
-
For middleware and
createAgent
, installlangchain@next
:npm install langchain@1.0.0 @langchain/core@1.0.0