Skip to content

(WIP) Feat/mappers cloudwatch change openinference#174

Open
poshinchen wants to merge 2 commits intostrands-agents:mainfrom
poshinchen:feat/mappers-cloudwatch-change-openinference
Open

(WIP) Feat/mappers cloudwatch change openinference#174
poshinchen wants to merge 2 commits intostrands-agents:mainfrom
poshinchen:feat/mappers-cloudwatch-change-openinference

Conversation

@poshinchen
Copy link
Contributor

Description

constants.py

As discussed in the previous PR, moved the internal variables into constants.py

CloudWatchProvider

  • Added end_time parameter to narrow the query time window (defaults to now()).

OpenInferenceSessionMapper: Multi-Agent LangGraph Fixes

  • Fixed user content extraction
    • iterates llm.input_messages by role instead of blindly grabbing index 0 (which was the system prompt, not the user message).
  • Fixed tool parameter parsing
    • uses ast.literal_eval as fallback for Python repr strings (OpenInference stores input.value with single quotes).
  • Fixed missing AgentInvocationSpan
    • backward search now skips empty AI messages in LangGraph output.
  • Simplified agent invocation detection to CHAIN + name=LangGraph only, removed false-positive-prone AGENT + langgraph_step heuristic.
  • Added multi-agent dedup — when multiple LangGraph CHAIN spans exist (nested sub-graphs), keeps only the root (last one).
  • Added ADOT/CloudWatch support
    • detects root LangGraph node via "messages" without "remaining_steps" in input body (intermediate nodes always have remaining_steps).
  • Filters empty-response InferenceSpans
    • drops LangGraph internal re-invocations where the assistant returns only empty text with no tool calls.

LangChainOtelSessionMapper: ADOT Fixes

  • moved the internal variables into constants.py

What tests have been executed

  • (in_memory and ADOT) Verified with real OpenInference multi-agent with tools, single-turn LangGraph traces
  • (in_memory and ADOT) Verified with real OpenInference multi-agent with tools, multi-turn traces
    Both in-memory and CloudWatch paths produce valid sessions with correct user prompts, tool calls, and agent responses.
    The evaluators return with valid scores and reasoning.

Related Issues

#91

Documentation PR

N/A, TBD

Type of Change

Bug fix
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

  • I ran hatch run prepare

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@poshinchen poshinchen deployed to auto-approve March 21, 2026 03:43 — with GitHub Actions Active
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