Skip to content

feat(langchain): Add capture controls - #2763

Merged
Luca Forstner (lforst) merged 3 commits into
mainfrom
lforst/dum-e/dubai-a933bdfb63
Nov 9, 2026
Merged

Luca Forstner (lforst) merged 3 commits into
mainfrom
lforst/dum-e/dubai-a933bdfb63

Conversation

@lforst

Copy link
Copy Markdown
Member
  • Add separate controls for chain inputs, chain outputs, model inputs, model outputs, and token usage in LangChain and LangGraph traces. Capture remains enabled by default.
  • Skip disabled payloads before copying them, while keeping the trace structure, timing, errors, and metadata. This avoids copying large graph state or recording model data already captured by provider instrumentation.
  • Support these options in manual callback handlers and automatic instrumentation:
    import { configureInstrumentation } from "braintrust/instrumentation";
    
    // Configure capture before SDK initialization or loading the tracing hook.
    configureInstrumentation({
      langchain: {
        captureChainInputs: false,
        captureChainOutputs: false,
        captureModelInputs: false,
        captureModelOutputs: false,
        captureModelTokenUsage: false,
      },
    });

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T10:39:08.480011Z 3c6689a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to add all these options? Is there no way to avoid redudant serialization without them?

@lforst

Copy link
Copy Markdown
Member Author

Why do we need to add all these options? Is there no way to avoid redudant serialization without them?

Abhijeet Prasad (@AbhiPrasad) a user asked for these options. Additionally, the serialization is technically not redundant. What's happening is that we are capturing input/output via the langchain instrumentation, and also via the provider instrumentation, however at the time of capturing the outer, you don't know yet whether there is gonna be an inner, so we need to rely on configuration. I think in most cases payloads aren't gonna be large enough for this to be a problem but in some cases you may need this as an escape hatch.

@lforst
Luca Forstner (lforst) merged commit 223be87 into main Nov 9, 2026
61 checks passed
@lforst
Luca Forstner (lforst) deleted the lforst/dum-e/dubai-a933bdfb63 branch November 9, 2026 19:03
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.

2 participants