microsoft.opentelemetry.a365.core.invoke_agent_scope module

class microsoft.opentelemetry.a365.core.invoke_agent_scope.InvokeAgentScope(request, scope_details, agent_details, caller_details=None, span_details=None)[source]

Bases: OpenTelemetryScope

Provides OpenTelemetry tracing scope for AI agent invocation operations.

static start(request, scope_details, agent_details, caller_details=None, span_details=None)[source]

Create and start a new scope for agent invocation tracing.

Parameters:
  • request (Request) – Request details for the invocation

  • scope_details (InvokeAgentScopeDetails) – Scope-level configuration (endpoint)

  • agent_details (AgentDetails) – The details of the agent being invoked

  • caller_details (CallerDetails | None) – Optional composite caller details (human user and/or calling agent for A2A scenarios)

  • span_details (SpanDetails | None) – Optional span configuration (parent context, timing, kind)

Return type:

InvokeAgentScope

Returns:

A new InvokeAgentScope instance

record_response(response)[source]

Record response information for telemetry tracking.

Parameters:

response (str) – The response string to record

Return type:

None

record_input_messages(messages)[source]

Record the input messages for telemetry tracking.

Accepts plain strings (auto-wrapped as OTEL ChatMessage with role user) or a versioned InputMessages wrapper.

Parameters:

messages (Union[str, list[str], InputMessages]) – List of input message strings or an InputMessages wrapper

Return type:

None

record_output_messages(messages)[source]

Record the output messages for telemetry tracking.

Accepts plain strings (auto-wrapped as OTEL OutputMessage with role assistant) or a versioned OutputMessages wrapper.

Parameters:

messages (Union[str, list[str], OutputMessages]) – List of output message strings or an OutputMessages wrapper

Return type:

None