feat: Bump to LangChain 1.0 and drop community package requirement#1311
Conversation
@langchain/community was added speculatively during the ESM migration but has never been imported by any source or test file. Removing it eliminates the entire transitive stagehand -> dotenv@^16 conflict chain at the root, rather than hoping an upstream fix arrives. Also restricts @langchain/core, langchain, and @traceloop/instrumentation-langchain peer deps to 1.x-only, dropping support for the 0.2/0.3 range that triggered the original issue. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Thanks for digging into this and opening the PR! The root cause you identified is real — the transitive What we changed and why:
Thanks again for the contribution! |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit a849c6f. Configure here.
response_metadata.tokenUsage is an OpenAI-specific legacy path. LangChain standardized token counts onto usage_metadata (input_tokens, output_tokens, total_tokens) as a first-class field on AIMessage. Primary path is now usage_metadata; falls back to response_metadata.tokenUsage for any providers that have not yet migrated to the standard field. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… pr-1311-langchain-deps
LangChain 1.x core populates response_metadata.tokenUsage FROM usage_metadata, not the other way around. Any 1.x-compatible provider will set usage_metadata, making the fallback unreachable. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🤖 I have created a release *beep* *boop* --- <details><summary>jest: 1.0.13</summary> ## [1.0.13](jest-v1.0.12...jest-v1.0.13) (2026-04-27) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/react-native-client-sdk bumped from ~10.17.1 to ~10.17.2 </details> <details><summary>react-native-client-sdk: 10.17.2</summary> ## [10.17.2](react-native-client-sdk-v10.17.1...react-native-client-sdk-v10.17.2) (2026-04-27) ### Bug Fixes * **react-native:** `package.json` should declare esm format ([#1322](#1322)) ([149ae73](149ae73)) </details> <details><summary>server-sdk-ai: 0.18.0</summary> ## [0.18.0](server-sdk-ai-v0.17.1...server-sdk-ai-v0.18.0) (2026-04-27) ### Features * Add root-level tools map with customParameters to AI Config types ([#1295](#1295)) ([487182b](487182b)) </details> <details><summary>server-sdk-ai-langchain: 0.6.0</summary> ## [0.6.0](server-sdk-ai-langchain-v0.5.6...server-sdk-ai-langchain-v0.6.0) (2026-04-27) ### Features * Bump to LangChain 1.0 and drop community package requirement ([#1311](#1311)) ([f5a1c29](f5a1c29)) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/server-sdk-ai bumped from ^0.17.1 to ^0.18.0 * peerDependencies * @launchdarkly/server-sdk-ai bumped from ^0.17.0 to ^0.18.0 </details> <details><summary>server-sdk-ai-openai: 0.5.7</summary> ## [0.5.7](server-sdk-ai-openai-v0.5.6...server-sdk-ai-openai-v0.5.7) (2026-04-27) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/server-sdk-ai bumped from ^0.17.1 to ^0.18.0 * peerDependencies * @launchdarkly/server-sdk-ai bumped from ^0.17.0 to ^0.18.0 </details> <details><summary>server-sdk-ai-vercel: 0.5.7</summary> ## [0.5.7](server-sdk-ai-vercel-v0.5.6...server-sdk-ai-vercel-v0.5.7) (2026-04-27) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/server-sdk-ai bumped from ^0.17.1 to ^0.18.0 * peerDependencies * @launchdarkly/server-sdk-ai bumped from ^0.17.0 to ^0.18.0 </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Primarily a release/version-bump PR, but it updates AI provider peer/dependency ranges (notably moving `server-sdk-ai-langchain` to LangChain v1) which may introduce runtime or type-compatibility issues for consumers. > > **Overview** > Updates release metadata and publishes new versions of several packages (`server-sdk-ai` `0.18.0`, `server-sdk-ai-langchain` `0.6.0`, `server-sdk-ai-openai`/`server-sdk-ai-vercel` `0.5.7`, `react-native-client-sdk` `10.17.2`, and `@launchdarkly/jest` `1.0.13`). > > This release bumps the AI LangChain provider to *LangChain 1.x* and aligns AI provider packages’ `@launchdarkly/server-sdk-ai` peer/dev dependency requirements to `^0.18.0`; examples are updated to consume the new versions. It also includes a React Native SDK packaging fix (declaring ESM) and propagates that version bump into the React Native examples and Jest tooling dependency. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 530460b. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

This change bumps
@langchain/communityto the current npm release line and aligns@langchain/core,langchain, and@traceloop/instrumentation-langchainso peer dependencies resolve cleanly. It also adjusts token usage typing for LangChain 1.x response metadata.Made with Cursor
Note
Medium Risk
Dependency upgrades to LangChain v1 and instrumentation packages may introduce runtime/typing incompatibilities for consumers. Metrics extraction now relies on
usage_metadata, so token counts could change or be missing depending on provider support.Overview
Upgrades
@launchdarkly/server-sdk-ai-langchainto LangChain v1 by bumpinglangchain,@langchain/core, and@traceloop/instrumentation-langchain, and drops@langchain/communityas a direct/peer dependency.Updates
LangChainProvider.getAIMetricsFromResponse(and its tests) to read token usage from LangChain v1’sAIMessage.usage_metadata(*_tokensfields) instead of the olderresponse_metadata.tokenUsageshape.Reviewed by Cursor Bugbot for commit 49fd2c1. Bugbot is set up for automated code reviews on this repo. Configure here.