Skip to content

feat(langsmith)!: migrate wrapper to integration#204

Closed
Abhijeet Prasad (AbhiPrasad) wants to merge 1 commit intomainfrom
abhi-ref-migrate-langsmith-integration
Closed

feat(langsmith)!: migrate wrapper to integration#204
Abhijeet Prasad (AbhiPrasad) wants to merge 1 commit intomainfrom
abhi-ref-migrate-langsmith-integration

Conversation

@AbhiPrasad
Copy link
Copy Markdown
Member

Move the LangSmith instrumentation into braintrust.integrations.langsmith and reduce the legacy wrapper to a setup_langsmith compatibility shim.

Add LangSmith to auto_instrument, add a dedicated nox session, and cover the patched traceable and evaluate surfaces with VCR-backed tests plus an auto-test script.

BREAKING CHANGE: remove the public LangSmith helper exports wrap_traceable, wrap_client, wrap_evaluate, and wrap_aevaluate from both braintrust.integrations.langsmith and braintrust.wrappers.langsmith_wrapper. The compatibility wrapper now exposes setup_langsmith only.

This breaking change is needed to ensure we can properly do the migration. We don't document wrap_traceable, wrap_client, wrap_evaluate, and wrap_aevaluate anywhere so we can easily do this.

Move the LangSmith instrumentation into braintrust.integrations.langsmith and
reduce the legacy wrapper to a setup_langsmith compatibility shim.

Add LangSmith to auto_instrument, add a dedicated nox session, and cover the
patched traceable and evaluate surfaces with VCR-backed tests plus an
auto-test script.

BREAKING CHANGE: remove the public LangSmith helper exports wrap_traceable,
wrap_client, wrap_evaluate, wrap_aevaluate, get_braintrust_results, and
clear_braintrust_results from both braintrust.integrations.langsmith and
braintrust.wrappers.langsmith_wrapper. The compatibility wrapper now exposes
setup_langsmith only.
@starfolkai
Copy link
Copy Markdown

starfolkai bot commented Apr 3, 2026

Drop into this review session: sfk devbox connect pr-204-braintrust-sdk-python-5b02 --attach

Found 2 issues:

  1. setup_langsmith(standalone=False) cannot override the BRAINTRUST_LANGSMITH_STANDALONE environment variable. The expression True if standalone else None on line 38 collapses False to None, which means "use the env var" rather than "explicitly disable standalone." The internal _set_langsmith_standalone_override function distinguishes None (defer to env var) from False (explicitly disabled), but the public API loses that distinction.

logger.info("LangSmith integration with Braintrust enabled")
return LangSmithIntegration.setup(standalone=True if standalone else None)

  1. The environment variable for standalone mode was renamed from BRAINTRUST_STANDALONE to BRAINTRUST_LANGSMITH_STANDALONE, but the examples in py/examples/langsmith/ still reference the old name. Users following eval_example.py or tracing_example.py will set BRAINTRUST_STANDALONE=1, which the new integration ignores.

def _langsmith_standalone_from_env() -> bool:
value = os.environ.get("BRAINTRUST_LANGSMITH_STANDALONE")
if value is None:
return False
return value.strip().lower() in {"1", "true", "yes", "on"}

# Set BRAINTRUST_STANDALONE=1 to completely replace LangSmith with Braintrust
standalone = os.environ.get("BRAINTRUST_STANDALONE", "").lower() in ("1", "true", "yes")

# Set BRAINTRUST_STANDALONE=1 to completely replace LangSmith with Braintrust
standalone = os.environ.get("BRAINTRUST_STANDALONE", "").lower() in ("1", "true", "yes")

@AbhiPrasad Abhijeet Prasad (AbhiPrasad) deleted the abhi-ref-migrate-langsmith-integration branch April 3, 2026 22:57
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