Repository navigation
feat(server-utils): Decide gen_ai content recording per call for LangChain and LangGraph - #26473
Draft
sentry-junior[bot] wants to merge 2 commits into
Draft
sentry-junior[bot] wants to merge 2 commits into
sentry-junior[bot] wants to merge 2 commits into
Conversation
Contributor
size-limit report 📦Compared: 9c6ca4c (PR test merge using feat/gen-ai-per-call-recording at aa56820) Against: 93949c4 (feat/gen-ai-per-call-recording) · base run #66413
|
Contributor
Optional E2E testsSome optional checks were not successful. They do not block the merge. 1 not successful, 60 successful. See the run.
Successful checks
|
sentry-junior
Bot
force-pushed
the
feat/gen-ai-per-call-recording-langchain
branch
2 times, most recently
from
November 17, 2026 12:53
ddd0622 to
8eaa59b
Compare
…Chain and LangGraph recordInputs and recordOutputs of langChainIntegration, createLangChainCallbackHandler, instrumentLangChainEmbeddings, langGraphIntegration and the LangGraph wrappers can be functions. LangChain decides in each start callback, from the callback arguments. LangGraph decides once per invoke()/stream() call, from the graph input and config, and the decision covers the whole graph run through the run metadata. Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
…ph with node integration tests Replaces the per-call recording unit tests with node integration tests that use real @langchain/core and @langchain/langgraph against a mock Anthropic server. Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
sentry-junior
Bot
force-pushed
the
feat/gen-ai-per-call-recording-langchain
branch
from
November 17, 2026 13:01
8eaa59b to
0c48b7c
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
recordInputs/recordOutputsof the LangChain and LangGraph integrations,createLangChainCallbackHandler,instrumentLangChainEmbeddingsand the LangGraph wrappers can now be functions that decide per call. LangChain decides per run, from the callback arguments. LangGraph decides perinvoke()/stream()call, from the graph input and config.Why
Stacked on #26464. Each integration gets the call info that its library already passes: for LangChain, the arguments of the start callback (
serialized, messages/prompts/inputs,runId,tags,metadata,extraParams). For embeddings, it's the embed argument. For LangGraph, it's{ input, config }as passed. The function runs in the start callback. LangChain awaits this handler's callbacks inline (awaitHandlers: true), so the function runs in the async context of the call that started the run. End callbacks use therecordOutputsstored for thatrunId.Non-obvious: a LangGraph decision covers the whole graph run. It travels through the run metadata, which child runs inherit.
__sentry_langgraph__is now{ recordInputs, recordOutputs }instead oftrue. So the chat model spans and thecreateReactAgenttool spans inside a graph follow the graph'sinvoke()/stream()decision, and the LangChain function is not called for them. This also applies when the LangChain integration's handler is the one attached. Outside a graph run, the LangGraph handler and the wrapped tools only use boolean options, because a function needs the graph input.via @mydea.
--
View Session [Sentry]