Add structure to input output messages on all the scopes#221
Merged
nikhilNava merged 7 commits intomainfrom Apr 7, 2026
Merged
Add structure to input output messages on all the scopes#221nikhilNava merged 7 commits intomainfrom
nikhilNava merged 7 commits intomainfrom
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Snapshot WarningsEnsure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice. Scanned FilesNone |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a structured, versioned message schema for recording gen-ai input/output messages (and related tool inputs/outputs) across observability scopes, aligning telemetry payloads with OpenTelemetry gen-ai semantic conventions while keeping some backward compatibility for plain string inputs.
Changes:
- Added OTEL gen-ai message model types (
InputMessages/OutputMessages, roles, parts) plus normalization/serialization helpers. - Updated InvokeAgentScope, InferenceScope, and OutputScope to record input/output messages as versioned JSON wrappers rather than raw JSON lists.
- Replaced URL parse results with a
ServiceEndpoint(hostname, port)model and updated tests/examples accordingly.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/usage_example.py | Updates sample usage to use ServiceEndpoint instead of urlparse. |
| tests/observability/core/test_trace_context_propagation.py | Updates endpoint usage and tool argument structure to new message wrappers. |
| tests/observability/core/test_scope_messages.py | Adds new tests covering structured message recording across scopes. |
| tests/observability/core/test_output_scope_bounded.py | Updates bounded-output tests to reflect OutputMessage accumulation behavior. |
| tests/observability/core/test_message_utils.py | Adds unit tests for message normalization and serialization helpers. |
| tests/observability/core/test_invoke_agent_scope.py | Updates invoke scope tests to use ServiceEndpoint. |
| tests/observability/core/test_execute_tool_scope.py | Updates tool scope tests to use tool message wrappers and new method names. |
| tests/observability/core/test_custom_start_end_time.py | Updates tool arguments to structured tool input messages. |
| libraries/.../core/tool_call_details.py | Changes tool call arguments/endpoints to structured types. |
| libraries/.../core/tenant_details.py | Removes TenantDetails (deleted file). |
| libraries/.../core/spans_scopes/output_scope.py | Normalizes/accumulates output messages as structured objects and flushes on scope end. |
| libraries/.../core/request.py | Updates request content typing to structured input messages param. |
| libraries/.../core/models/service_endpoint.py | Introduces ServiceEndpoint model for host/port endpoints. |
| libraries/.../core/models/response.py | Updates response messages typing to structured output messages param. |
| libraries/.../core/models/messages.py | Adds OTEL gen-ai message schema dataclasses, enums, wrappers, and param aliases. |
| libraries/.../core/message_utils.py | Adds normalization and robust serialization helpers for message wrappers. |
| libraries/.../core/invoke_agent_scope.py | Records input/output messages via structured wrapper serialization. |
| libraries/.../core/invoke_agent_details.py | Updates endpoint typing to ServiceEndpoint. |
| libraries/.../core/inference_scope.py | Records input/output messages via structured wrapper serialization. |
| libraries/.../core/inference_call_details.py | Moves ServiceEndpoint to shared model import. |
| libraries/.../core/execution_type.py | Removes ExecutionType (deleted file). |
| libraries/.../core/execute_tool_scope.py | Records tool input/output via serialized wrappers and adds new recording APIs. |
| libraries/.../core/init.py | Re-exports message schema types, Response, and ServiceEndpoint from the core package. |
...gents-a365-observability-core/microsoft_agents_a365/observability/core/invoke_agent_scope.py
Outdated
Show resolved
Hide resolved
...t-agents-a365-observability-core/microsoft_agents_a365/observability/core/inference_scope.py
Outdated
Show resolved
Hide resolved
...gents-a365-observability-core/microsoft_agents_a365/observability/core/execute_tool_scope.py
Show resolved
Hide resolved
...t-agents-a365-observability-core/microsoft_agents_a365/observability/core/models/messages.py
Outdated
Show resolved
Hide resolved
...agents-a365-observability-core/microsoft_agents_a365/observability/core/tool_call_details.py
Outdated
Show resolved
Hide resolved
...oft-agents-a365-observability-core/microsoft_agents_a365/observability/core/message_utils.py
Outdated
Show resolved
Hide resolved
...t-agents-a365-observability-core/microsoft_agents_a365/observability/core/models/messages.py
Show resolved
Hide resolved
...t-agents-a365-observability-core/microsoft_agents_a365/observability/core/models/messages.py
Outdated
Show resolved
Hide resolved
...gents-a365-observability-core/microsoft_agents_a365/observability/core/execute_tool_scope.py
Outdated
Show resolved
Hide resolved
...365-observability-core/microsoft_agents_a365/observability/core/spans_scopes/output_scope.py
Outdated
Show resolved
Hide resolved
...t-agents-a365-observability-core/microsoft_agents_a365/observability/core/models/response.py
Outdated
Show resolved
Hide resolved
...t-agents-a365-observability-core/microsoft_agents_a365/observability/core/models/messages.py
Outdated
Show resolved
Hide resolved
...gents-a365-observability-core/microsoft_agents_a365/observability/core/execute_tool_scope.py
Show resolved
Hide resolved
...gents-a365-observability-core/microsoft_agents_a365/observability/core/execute_tool_scope.py
Outdated
Show resolved
Hide resolved
fpfp100
reviewed
Apr 6, 2026
...365-observability-core/microsoft_agents_a365/observability/core/spans_scopes/output_scope.py
Outdated
Show resolved
Hide resolved
fpfp100
reviewed
Apr 6, 2026
...gents-a365-observability-core/microsoft_agents_a365/observability/core/execute_tool_scope.py
Show resolved
Hide resolved
fpfp100
approved these changes
Apr 6, 2026
threddy
approved these changes
Apr 7, 2026
juliomenendez
approved these changes
Apr 7, 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.
Task
Add a message structure to input and output messages on all scopes
Result