feat: added Langchain mappers#153
Merged
poshinchen merged 1 commit intostrands-agents:mainfrom Mar 13, 2026
Merged
Conversation
715d093 to
8489766
Compare
afarntrog
reviewed
Mar 11, 2026
Contributor
|
I would also like to see integration tests that run with langchain agent so that we can know immediately if something changes as our tests will fail. |
8489766 to
af53d71
Compare
af53d71 to
4686de8
Compare
4686de8 to
845f372
Compare
afarntrog
approved these changes
Mar 13, 2026
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.
Description
This PR adds a mapper framework for converting OpenTelemetry traces from different LangChain (with traceloop / openllmetry) into a unified Session format for evaluation
Architecture
Base Class:
Famework-Specific Mappers:
LangChainOtelSessionMapper: Maps Traceloop/OpenLLMetry LangChain traces (scope: opentelemetry.instrumentation.langchain)
OpenInferenceSessionMapper: Maps OpenInference LangChain traces (scope: openinference.instrumentation.langchain)
CloudWatchSessionMapper: Maps Strands telemetry from CloudWatch/ADOT format
StrandsInMemorySessionMapper: Maps Strands in-memory OTEL spans (existing, now inherits from base)
Utilities:
Cleanup Opportunities for Follow-up
1. Extract Common Helper Methods to Base Class
The following methods are duplicated across all mappers:
2. DRY Up Build Trace Logic
_build_trace()method has identical structure in LangChainOtelSessionMapper and OpenInferenceSessionMapper. This pattern could be moved to base class with abstract is*_span() methods.3. Consolidate Message Extraction Pattern
_get_messages_from_span_events()has similar logic in both LangChain and OpenInference mappers for extracting messages from ADOT/CloudWatch format.4. Unify Tool Extraction
_extract_tools_from_attributes()could be generalized - both mappers extract tool schemas but from different attribute keys.Related Issues
#91
Documentation PR
N/A
Type of Change
New feature
Testing
How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli
hatch run prepareChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.