feat: add sandbox callback verifier#2849
Draft
Ramon Nogueira (ramon-langchain) wants to merge 4 commits into
Draft
feat: add sandbox callback verifier#2849Ramon Nogueira (ramon-langchain) wants to merge 4 commits into
Ramon Nogueira (ramon-langchain) wants to merge 4 commits into
Conversation
1e26e68 to
264f474
Compare
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.
Summary
Adds a Python SDK verifier for JWKS-signed LangSmith sandbox callback requests. The verifier resolves the LangSmith API URL and API key using normal SDK defaults, fetches and caches JWKS internally, fetches and caches the tenant ID when not supplied, and validates the JWT against the exact raw callback body.
The returned claims expose
identity, parsed from the signed body hash, including tenant ID, organization ID, sandbox ID, and optional LangSmith user ID. The verifier requires an expected sandbox ID unless callers explicitly opt intounsafely_allow_any_sandbox_id=True.Related PR:
Release Note
Add a sandbox callback verifier utility for Python applications receiving signed LangSmith sandbox callbacks.
Test Plan
uv run ruff format langsmith/sandbox/_callback_verifier.py langsmith/sandbox/__init__.py tests/unit_tests/sandbox/test_callback_verifier.pyuv run ruff check langsmith/sandbox/_callback_verifier.py tests/unit_tests/sandbox/test_callback_verifier.py langsmith/sandbox/__init__.py --fixuv run mypy langsmith/sandbox/_callback_verifier.pyTEST=tests/unit_tests/sandbox/test_callback_verifier.py make tests