microsoft.opentelemetry.a365.core.spans_scopes.output_scope module
- class microsoft.opentelemetry.a365.core.spans_scopes.output_scope.OutputScope(request, response, agent_details, user_details=None, span_details=None)[source]
Bases:
OpenTelemetryScopeProvides OpenTelemetry tracing scope for output messages.
Output messages are set once (via the constructor or
record_output_messages) rather than accumulated. For streaming scenarios, the agent developer should collect all output (e.g. via a list or string builder) and pass the final result toOutputScope.- static start(request, response, agent_details, user_details=None, span_details=None)[source]
Creates and starts a new scope for output tracing.
- Parameters:
request (
Request) – Request details for the outputresponse (
Response) – The response details from the agentagent_details (
AgentDetails) – The details of the agentuser_details (
UserDetails|None) – Optional human user detailsspan_details (
SpanDetails|None) – Optional span configuration (parent context, timing)
- Return type:
- Returns:
A new OutputScope instance
- record_output_messages(messages)[source]
Records the output messages for telemetry tracking.
Overwrites any previously set output messages. Accepts a single string, a list of strings (auto-wrapped as OTEL OutputMessage), a versioned
OutputMessageswrapper, or adict[str, object]for tool call results (per OTEL spec).