Skip to content

fix(langchain): support core 1.x and preserve callback lifecycle - #383

Merged
nik13 merged 2 commits into
devfrom
fix/langchain-typescript-core-v1
Nov 1, 2026
Merged

nik13 merged 2 commits into
devfrom
fix/langchain-typescript-core-v1

Conversation

@nik13

@nik13 nik13 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Repair the maintained @traceai/langchain integration for current LangChain and LangGraph applications without adding a second tracer or changing its public entry points.

  • Accept LangChain core 1.x in the peer dependency and automatic CommonJS hook, while retaining the supported 0.2.x and 0.3.x peers.
  • Select ESM/CommonJS declarations that match the consumer's module graph. Preserve the 0.2.0 callback-manager fallback and avoid duplicate or unfinished spans on transitional tracers.
  • Drain LangChain callbacks before provider shutdown. Document explicit module setup for ESM and older cores that lack the root export required by the automatic hook.
  • Make the README Quick Start self-contained: install the compatible OpenAI adapter and every direct import, set the model-provider and telemetry credentials separately, and run an explicit .mts file with an installed TypeScript runner.
  • Add an empty-consumer onboarding contract to scoped CI. It installs only the README's listed dependencies, substitutes candidate tarballs only for documented Future AGI packages, runs the exact shipped example and command, and checks the completed model span over loopback OTLP.

The integration retains its existing callback-manager injection design, consistent with the maintained Arize LangChain JS approach. No vendor implementation was copied.

Validation

  • Regression controls reject the original incomplete README and removal of the OpenAI adapter. The literal original example fails with ERR_MODULE_NOT_FOUND in a README-only consumer; the corrected setup installs and runs without hidden dependencies or peer bypasses.
  • Scoped CI covers the core 0.2.0, 0.3.0, 0.3.80, 1.0.0 and 1.3.2 lanes, packed ESM/CommonJS declarations, callback lifecycle, privacy and the Quick Start on Node.js 22.
  • Local checks pass: 38 unit regressions; 48 real LangGraph floor/current contracts across ESM, CommonJS, automatic registration, JSON/protobuf and plain/gzip; 10 core lifecycle contracts; strict types; README and held docs snippets; MDX compilation.
  • Runtime tests use synthetic credentials with outbound networking denied except localhost. No live model or Future AGI Cloud execution is claimed. No product UI E2E harness applies to this SDK change.

Release and review

The package README ships with the repaired npm release. The LangGraph TypeScript docs-site page remains held until that compatible package is published; this PR does not direct existing customers to an unreleased docs route. No manual version or CHANGELOG edits, runtime dependency additions, merge, tag or registry publication.

The onboarding follow-up changes only documentation, its regression contract and scoped CI; the reviewed runtime repair is unchanged. Self-reviewed for minimal scope, direct dependency completeness, executable setup, lifecycle ordering and fail-before/pass-after coverage. Independent human review remains required.

🤖 Generated with Claude Code

nik13 and others added 2 commits October 31, 2026 07:25
Retain legacy configure and transitional BaseTracer support, route ESM declarations correctly, and require callback draining before shutdown. Test packed runtime and type contracts across the declared floor and current cores.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Install the compatible OpenAI adapter and direct imports, document the provider key and ESM TypeScript runner, and enforce the exact packed README from an empty consumer in CI.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@nik13
nik13 merged commit 9886817 into dev Nov 1, 2026
35 of 40 checks passed
@nik13
nik13 deleted the fix/langchain-typescript-core-v1 branch November 1, 2026 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant