Invoke Agent wrapper span populates tool-call turns and gen_ai.tool.definitions#174
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #172 by improving LangChain invoke_agent span aggregation so wrapper spans can carry ordered ReAct-style message history and tool definitions.
Changes:
- Adds LangChain utilities for tool-call response extraction, role normalization, tuple shorthand handling, and agent-history building.
- Updates agent span aggregation to build cumulative input history from LLM/tool child runs and defer final assistant output until finalization.
- Updates and expands LangChain tests for spec-compliant message extraction and aggregation behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/microsoft/opentelemetry/_genai/_langchain/_utils.py |
Adds message/tool-response helpers and improves role/message extraction. |
src/microsoft/opentelemetry/_genai/_langchain/_tracer.py |
Aggregates invoke-agent input history, final output messages, and tool definitions. |
tests/langchain/test_utils.py |
Updates session assertions and adds structured message extraction tests. |
tests/langchain/test_tracer.py |
Updates tool-output behavior tests and adds aggregation/tool-definition tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
hectorhdzg
approved these changes
May 28, 2026
JacksonWeber
approved these changes
May 28, 2026
9e15a7a to
a179d32
Compare
hectorhdzg
approved these changes
May 28, 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.
Fixes #172