Spaces:
Sleeping
@langchain/core
1.1.43
Patch Changes
#10814
dfec1b7Thanks @hntrl! - fix(google): restore structured output parsing with includeRaw and reasoning blocksEnsure structured output parsers read
BaseMessagetext content whenincludeRaw: true, so responses that include reasoning/thought blocks plus JSON text continue to parse correctly.#10772
1ba7131Thanks @christian-bromann! - chore(core): new stream primitives
1.1.42
Patch Changes
- #10776
20a9abeThanks @hntrl! - fix(deps): remediate uuid vulnerability by removing direct uuid usage
1.1.41
Patch Changes
#10733
589f29cThanks @jacoblee93! - fix(core): Update inheritance behavior for tracer metadata for special keys#10711
2e9e696Thanks @jacoblee93! - feat(core): Add chat model and llm invocation params to traced metadata
1.1.40
Patch Changes
- #10694
d3e0809Thanks @hntrl! - refactor(core): decouple tracer-only metadata defaults from runnable metadata- Add tracer-scoped inheritable metadata/tag options in callback manager while keeping backward-compatible aliases.
- Move configurable-to-tracing metadata derivation into a tracer-only path and keep
ensureConfigmetadata mirroring limited tomodel. - Update
LangChainTracerdefault metadata/tag handling and add regression tests for stream events metadata behavior.
1.1.39
Patch Changes
- #10430
d3d0922Thanks @christian-bromann! - feat(langchain): support for browser tools
1.1.38
Patch Changes
- #10552
589ab9bThanks @christian-bromann! - fix(langchain): accept cross-version runnable models in createAgent
1.1.37
Patch Changes
#10511
6933769Thanks @hntrl! - cache Zod-to-JSON-Schema conversions in toJsonSchema()#10541
50d5f32Thanks @jacoblee93! - revert: Revert "feat(core): Add all chat model/llm invocation params to metadata"#10509
5552999Thanks @hntrl! - feat(openai): add support for phase parameter on Responses API messages- Extract
phasefrom message output items and surface it on text content blocks - Support phase in streaming via
response.output_item.addedevents - Round-trip phase through both raw provider and standard content paths
- Move phase into
extrasdict in the core standard content translator
- Extract
#10528
8331833Thanks @christian-bromann! - fix(core): normalize single-block content in mergeContent
1.1.36
Patch Changes
#10512
bbbfea1Thanks @hntrl! - fix(core): fix streaming chunk merge for providers withoutindexon tool call deltas_mergeListsnow falls back toid-based matching when items don't have anindexfield. Previously, providers routing through the OpenAI-compatible API withoutindexon streaming tool call deltas (e.g. Anthropic models viaChatOpenAI) would accumulate hundreds of individual raw deltas intool_call_chunksandadditional_kwargs.tool_callsinstead of merging them into a single entry per tool call. In a real trace with 3 concurrent subagents, this caused a single AI message to balloon from ~4KB to 146KB -- with 826 uncollapsed streaming fragments carrying a few bytes each.Also fixes
SystemMessage.concat()which used...thisto spread all instance properties (includinglc_kwargs) into the new constructor, causing each chainedconcat()call to nest one level deeper. After 7 middlewareconcat()calls (typical in deepagents), a 7KB system prompt would serialize to 81KB due to content being duplicated at every nesting level.
1.1.35
Patch Changes
#10327
5dc11b5Thanks @hntrl! - fix(core): replace exported zod type references with structural duck-type interfaces to fix TypeScript OOMReplaces all exported Zod type references (
z3.ZodType,z4.$ZodType, etc.) in@langchain/core's public API with minimal structural ("duck-type") interfaces. This prevents TypeScript from performing expensive deep structural comparisons (~3,400+ lines of mutually recursive generics) when downstream packages resolve a different Zod version than@langchain/core, which was causing OOM crashes and unresponsive language servers in monorepo setups.#10433
7af0b65Thanks @tanushree-sharma! - feat: Add LangSmith integration metadata to createAgent and initChatModel
1.1.34
Patch Changes
- #10312
bfb7944Thanks @jacoblee93! - feat(core): Add all invocation params as part of metadata
1.1.33
Patch Changes
#10412
6db417bThanks @pawel-twardziak! - fix(core): respect timeout option in streamEvents v2#10424
d69dfccThanks @pawel-twardziak! - fix(core): preserve multimodal content in getBufferString as placeholders
1.1.32
Patch Changes
#10330
26488b5Thanks @hntrl! - fix(core): treat empty string tool call chunk IDs as missing during mergeFixed
_mergeListsin message base to treat empty string""IDs the same asnull/undefinedwhen merging tool call chunks. This fixes old completions-style streaming where follow-up chunks carryid: ""instead ofundefined, which previously prevented chunks from being merged by index.#10167
ca826f6Thanks @colifran! - feat: implement type inference for tool streams#10334
a602c42Thanks @maahir30! - fix(core): add JSDoc docstrings to fakeModel builder API and export FakeBuiltModel#10254
db7d017Thanks @pawel-twardziak! - fix(core): preserve thoughtSignature in array content during streaming with thinking models
1.1.31
Patch Changes
#10271
7373b4cThanks @jacoblee93! - feat(core): Use uuid7 instead of v4 for generating run ids#10262
b0175a5Thanks @maahir30! - fix: Move fakeModel from utils/testing to testing namespace move to updated namespace#10185
414f6edThanks @maahir30! - feat: add custom Vitest matchers for LangChain message and tool call assertionsAdds a new
@langchain/core/testing/matchersexport containing custom Vitest matchers (toBeHumanMessage,toBeAIMessage,toBeSystemMessage,toBeToolMessage,toHaveToolCalls,toHaveToolCallCount,toContainToolCall,toHaveToolMessages,toHaveBeenInterrupted,toHaveStructuredResponse) that external users can register viaexpect.extend(langchainMatchers)in their Vitest setup files. Re-exported fromlangchainfor convenience.
1.1.30
Patch Changes
#10243
96c630dThanks @hntrl! - fix: add explicit: symboltype annotations to Symbol.for() declarations for cross-version compatibilityTypeScript infers
unique symboltype when Symbol.for() is used without an explicit type annotation, causing type incompatibility when multiple versions of the same package are present in a dependency tree. By adding explicit: symbolannotations, all declarations now use the general symbol type, making them compatible across versions while maintaining identical runtime behavior.Changes:
- Added
: symboltoMESSAGE_SYMBOLin messages/base.ts - Added
: symboltoMIDDLEWARE_BRANDin agents/middleware/types.ts (also changed from Symbol() to Symbol.for() for cross-realm compatibility)
- Added
#10256
a8b9cccThanks @colifran! - fix(core): standard schema type guards don't support callable schemas#10204
a1f22bbThanks @colifran! - feat(core): implement standard schema support for structured output
1.1.29
Patch Changes
#10106
9f30267Thanks @hntrl! - Add package version metadata to runnable traces. Each package now stamps its version inthis.metadata.versionsat construction time, making version info available in LangSmith trace metadata.#10154
403a99fThanks @kanweiwei! - fix(core): add usage_metadata to AIMessage lc_aliases#10169
3b1fd54Thanks @hntrl! - fix(core, langchain): bump uuid dependency from ^10.0.0 to ^11.0.0 to fix Metro bundler errorThe
uuidv10 package has ambiguousexportsin itspackage.jsonwhich causes Metro (used by Expo/React Native) to resolve the wrong entry point, resulting inCannot read properties of undefined (reading 'v1'). Theuuidv11 package fixes its exports map to work correctly with Metro's package exports resolution.#10044
77bd982Thanks @hntrl! - fix(core): remove inherited LangChainTracer handlers when tracingEnabled is falseWhen a RunTree explicitly disables tracing via
tracingEnabled: false,CallbackManager._configureSyncnow strips any inheritedLangChainTracerhandlers so child runs don't produce traces.
1.1.28
Patch Changes
#10140
10a876cThanks @hntrl! - Merge content blocks by string index during streaming.#10102
b46d96aThanks @colifran! - feat: implement aynchronous generator tool calling for streaming partial tool results
1.1.27
Patch Changes
1.1.26
Patch Changes
- #10085
ed6ea53Thanks @colifran! - fix(google): tool_calls are not preserved when concatenating AIMessageChunks
1.1.25
Patch Changes
#10002
27186c5Thanks @aditya-gg04! - fix(core): support reasoning/thinking blocks in StringOutputParser#10077
05396f7Thanks @christian-bromann! - feat(core): add ContextOverflowError, raise in anthropic and openai#10081
5a6f26bThanks @hntrl! - feat(core): add namespace-based symbol branding for error class hierarchiesIntroduces
createNamespaceutility for hierarchical symbol-based branding of class hierarchies. All LangChain error classes now use this pattern, replacing hand-rolled duck-typeisInstancechecks with reliable cross-realmSymbol.for-based identity.- New
LangChainErrorbase class that all LangChain errors extend - New
createNamespace/NamespaceAPI in@langchain/core/utils/namespace - Refactored
ModelAbortError,ContextOverflowErrorto use namespace branding - Added
ContextOverflowError.fromError()static factory method - Deprecated
addLangChainErrorFieldsin favor ofLangChainErrorsubclasses - Migrated Google provider errors (
GoogleError,ConfigurationError, etc.) to namespace branding - Updated Anthropic and OpenAI providers to use
ContextOverflowError.fromError()
- New
1.1.24
Patch Changes
- #9978
70a4400Thanks @christian-bromann! - fix(core): fix web_search_call and file_search_call contentBlocks for OpenAI Responses API
1.1.23
Patch Changes
#10000
71d08c0Thanks @hntrl! - feat(google): add@langchain/google-- unified Google/Gemini integrationNew package that replaces the fragmented
@langchain/google-genai/@langchain/google-common/ Vertex AI package stack with a single integration.Published as 0.1.0 (early release). Existing Google packages will continue to receive maintenance updates.
1.1.22
Patch Changes
- #9995
8f166b1Thanks @kaigritun! - fix(core): skip empty text blocks in ChatOpenAI contentBlocks
1.1.21
Patch Changes
#9990
d5e3db0Thanks @hntrl! - feat(core): Add SSRF protection module (@langchain/core/utils/ssrf) with utilities for validating URLs against private IPs, cloud metadata endpoints, and localhost.fix(community): Harden
RecursiveUrlLoaderagainst SSRF attacks by integratingvalidateSafeUrland replacing string-based URL comparison with origin-basedisSameOriginfrom the shared SSRF module.
1.1.20
Patch Changes
- #9957
71c3cbaThanks @jacoblee93! - feat(langchain,core): Update prompt pulling params, LangSmith version
1.1.19
Patch Changes
- #9905
41bfea5Thanks @christian-bromann! - fix(classic/community/core): avoid long lived abort signals
1.1.18
Patch Changes
#9900
a9b5059Thanks @hntrl! - fix(core): update method signatures to usePartial<CallOptions>for options parametersUpdated
invoke,stream,generate, andgeneratePromptmethod signatures acrossRunnable,BaseChatModel, andBaseLLMto correctly acceptPartial<CallOptions>instead of fullCallOptions. This aligns the implementation with theRunnableInterfacespecification and allows users to pass partial options (e.g.,{ signal: abortedSignal }) without TypeScript errors.#9900
a9b5059Thanks @hntrl! - Improved abort signal handling for chat models:- Added
ModelAbortErrorclass in@langchain/core/errorsthat contains partial output when a model invocation is aborted mid-stream invoke()now throwsModelAbortErrorwith accumulatedpartialOutputwhen aborted during streaming (when using streaming callback handlers)stream()throws a regularAbortErrorwhen aborted (since chunks are already yielded to the caller)- All provider implementations now properly check and propagate abort signals in both
_generate()and_streamResponseChunks()methods - Added standard tests for abort signal behavior
- Added
1.1.17
Patch Changes
1.1.16
Patch Changes
#9830
70387a1Thanks @bracesproul! - fix: More undefined null errors and tests#9679
a7c6ec5Thanks @christian-bromann! - feat(openai): elevate OpenAI image generation outputs to proper image content blocks#9817
5e04543Thanks @Ashx098! - read error.status when response.status is absent to avoid retrying OpenAI SDK 4xx#9819
40b4467Thanks @MrDockal! - Tool call content returns compacted json#9815
17e30bdThanks @hntrl! - fix(core): respect tracingEnabled=false from RunTree when env tracing is enabled
1.1.15
Patch Changes
- #9781
230462dThanks @christian-bromann! - fix(core): preserve index and timestamp fields in _mergeDicts
1.1.14
Patch Changes
- #9797
bd1ab45Thanks @christian-bromann! - handle undefined error objects in async-caller
1.1.13
Patch Changes
#9777
3efe79cThanks @christian-bromann! - fix(core): properly elevate reasoning tokens#9789
b8561c1Thanks @hntrl! - source JsonOutputParser content from text accessor
1.1.12
Patch Changes
- #9517
23be5afThanks @christian-bromann! - fix(@langchain/core): add literal name type inference to tool()
1.1.11
Patch Changes
- #9753
a46a249Thanks @christian-bromann! - fix(core): allow shared object references in serialization
1.1.10
Patch Changes
- #9746
817fc9aThanks @bracesproul! - fix:_mergeDictserror when merging undefined values
1.1.9
Patch Changes
#9725
56600b9Thanks @Orenoid! - fix(langchain): update merge logic for numeric values inmergeDicts#9736
dc5c2acThanks @hntrl! - fix(core): handle circular references inload#9739
c28d24aThanks @christian-bromann! - fix(core): use getBufferString for message summarization#9702
bfcb87dThanks @christian-bromann! - fix(core): improve interop with Zod
1.1.8
Patch Changes
#9707
e5063f9Thanks @hntrl! - add security hardening forload#9684
8996647Thanks @christian-bromann! - fix(core): document purpose of name in base message
1.1.7
Patch Changes
#9686
df9c42bThanks @hntrl! - add usage_metadata to metadata in LangChainTracer#9665
8d2982bThanks @jacoblee93! - feat(core): Make runnable transform trace in a single payload in LangChainTracer#9675
af664beThanks @jacoblee93! - Bump LangSmith dep to 0.4.0
1.1.6
Patch Changes
#9668
a7b2a7dThanks @bracesproul! - fix: Cannot merge two undefined objects error#9657
a496c5fThanks @dqbd! - fix(core): avoid writing to TransformStream in EventStreamCallbackHandler when underlying ReadableStream is closed#9658
1da1325Thanks @dqbd! - fix(core): ensure streaming test chat models respect AbortSignal
1.1.5
Patch Changes
#9641
005c729Thanks @christian-bromann! - fix(community/core): various security fixes#7907
ab78246Thanks @jasonphillips! - fix(core): handle subgraph nesting better in graph_mermaid#9589
8cc81c7Thanks @nathannewyen! - test(core): add test for response_metadata in streamEvents#9644
f32e499Thanks @hntrl! - add bindTools to FakeListChatModel#9508
a28d83dThanks @shubham-021! - Fix toFormattedString() to properly display nested objects in tool call arguments instead of [object Object]#9165
2e5ad70Thanks @pawel-twardziak! - fix(mcp-adapters): preserve timeout from RunnableConfig in MCP tool calls#9647
e456c66Thanks @hntrl! - handle missing parent runs in tracer to prevent LangSmith 400 errors
1.1.4
Patch Changes
#9574
6c40d00Thanks @hntrl! - Revert "fix(@langchain/core): update and bundle dependencies (#9534)"
1.1.3
Patch Changes
#9534
bd2c46eThanks @christian-bromann! - fix(@langchain/core): update and bundlep-retry,ansi-styles,camelcaseanddecamelizedependencies#9544
487378bThanks @hntrl! - fix tool chunk concat behavior (#9450)#9505
138e7fbThanks @chosh-dev! - feat: replace btoa with toBase64Url for encoding in drawMermaidImage
1.1.2
Patch Changes
1.1.1
Patch Changes
#9495
636b994Thanks @gsriram24! - fix: use dynamic import for p-retry to support CommonJS environments
1.1.0
Minor Changes
- #9475
708d360Thanks @christian-bromann! - allow to concat system messages
Patch Changes
#9416
0fe9bebThanks @hntrl! - fix 'moduleResultion: "node"' compatibility#9463
10fa2afThanks @christian-bromann! - fix(core): update p-retry to fix memory leak
1.0.6
Patch Changes
1.0.5
Patch Changes
#9308
04bd55cThanks @ro0sterjam! - respect JSON schema references in interopZodTransformInputSchema#9387
ac0d4feThanks @hntrl! - AddModelProfileand.profileproperties to ChatModel
1.0.4
Patch Changes
- 8319201: Export standard converter function utility
1.0.3
Patch Changes
- 0a8a23b: feat(@langchain/core): support of ToolRuntime
1.0.2
Patch Changes
- 6426eb6: fix chunks constructed with tool calls + chunks
- 619ae64: Add
BaseMessage.toFormattedString()
1.0.1
Patch changes
- cacc137: remove bad import map exports
1.0.0
π 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
contentBlocksproperty: 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.0Use the new
contentBlocksproperty to access rich content:const response = await model.invoke(messages); console.log(response.contentBlocks); // New API console.log(response.content); // Legacy API still worksFor middleware and
createAgent, installlangchain@next:npm install langchain@1.0.0 @langchain/core@1.0.0
π Additional Resources
0.3.79
Patch Changes
- 1063b43: fix chunks constructed with tool calls + chunks
0.3.78
Patch Changes
- 1519a97: update chunk concat logic to match on missing ID fields
- 079e11d: omit tool call chunks without tool call id
0.3.76
Patch Changes
- 41bd944: support base64 embeddings format
- e90bc0a: fix(core): prevent tool call chunks from merging incorrectly in AIMesβ¦
- 3a99a40: Fix deserialization of RemoveMessage if represented as a plain object
- 58e9522: make mustache prompt with nested object working correctly
- e44dc1b: handle backticks in structured output
0.3.75
Patch Changes
- d6d841f: fix(core): Fix deep nesting of runnables within traceables
0.3.74
Patch Changes
- 4e53005: fix(core): Always inherit parent run id onto callback manager from context
0.3.73
Patch Changes
- a5a2e10: add root export to satisfy bundler requirements