feat(@langchain/langgraph): initial integration support#7412
feat(@langchain/langgraph): initial integration support#7412
Conversation
5e87531 to
4de611f
Compare
Overall package sizeSelf size: 4.57 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 2.0.3 | 76.87 kB | 808.03 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #7412 +/- ##
==========================================
- Coverage 80.39% 80.26% -0.13%
==========================================
Files 732 736 +4
Lines 31027 31134 +107
==========================================
+ Hits 24945 24991 +46
- Misses 6082 6143 +61
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
BenchmarksBenchmark execution time: 2026-02-03 18:52:50 Comparing candidate commit fec5e8c in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 225 metrics, 25 unstable metrics. |
These changes were made by the llm obs workflow to improve test robustness but are not needed for the LangGraph integration itself. The changes have been saved to /tmp/util-js-llmobs-improvements.patch for future reference and can be applied later if needed. Changes reverted: - Mock value handling for timing fields (span_id, duration, start_ns) - Better error handling in test assertions - Input validation improvements - Edge case handling for outputValue === 0
- Add trailing commas to all arrays and objects per @stylistic/comma-dangle - Break long line in llmobs plugin to comply with max-len rule - Remove unused 'llmobs' variable in test spec All langgraph-related linting errors have been fixed.
522cd8e to
6d3c48d
Compare
|
| const asyncIterable = ctx.result | ||
|
|
||
| const originalAsyncIterator = asyncIterable[Symbol.asyncIterator].bind(asyncIterable) | ||
|
|
||
| asyncIterable[Symbol.asyncIterator] = function () { |
There was a problem hiding this comment.
i think we should try and do this in the langgraph.js instrumentation file maybe, and add a custom subscriber there and use shimmer.wrap for robustness. then we can emit a new event with the context that this PregelStreamPlugin can listen for
There was a problem hiding this comment.
We are trying to avoid this so that we can continue to use Orchestrion, right now since we only have tracePromise we need to handle this on the subscriber.
There was a problem hiding this comment.
yeah, what i mean is we can do this out directly in the langgraph.js instead
const orchestrionStreamCh = channel('tracing:orchestrion:@langchain/langgraph:Pregel_stream')
orchestrionStreamCh.subscribe({
asyncStart (ctx) {
// shimmer.wrap ctx.result
}
})just so any/all custom wrapping logic happens in instrumentation and not in the plugins directly. lmk if this doesn't make any sense tho as idk if we do something like this currently.
There was a problem hiding this comment.
I don't think this is a common pattern to mix publisher and subscriber logic in the instrumentation. I would think it would be cleaner to keep it on the subscriber/plugin side, but I can defer to @rochdev on this.
There was a problem hiding this comment.
ah ok i don't have too strong a preference, just that we had done something like that previously for langchain before we had some more orchestrion capabilities (ref).
i think in either case we should use shimmer to patch instead of modifying properties directly (even if shimmer just does this directly under the hood)
|
|
||
| getLLMObsSpanRegisterOptions (ctx) { | ||
| const span = ctx.currentStore?.span | ||
| const name = span?.context()._tags?.['resource.name'] || 'langgraph.workflow' |
There was a problem hiding this comment.
i gotta check it out but ideally if we can use ctx.self.name if it exists (like this.name, this referring to the graph instance), that would be better i think
|
|
||
| formatIO (data) { | ||
| // Handle null/undefined explicitly | ||
| if (data === null || data === undefined) return '' |
There was a problem hiding this comment.
| if (data === null || data === undefined) return '' | |
| if (data == null) return '' |
This will add support for LangGraph and was made using the APM Instrumentation Toolkit.