microsoft.opentelemetry.a365.core.execute_tool_scope module

class microsoft.opentelemetry.a365.core.execute_tool_scope.ExecuteToolScope(request, details, agent_details, user_details=None, span_details=None)[source]

Bases: OpenTelemetryScope

Provides OpenTelemetry tracing scope for AI tool execution operations.

static start(request, details, agent_details, user_details=None, span_details=None)[source]

Creates and starts a new scope for tool execution tracing.

Parameters:
  • request (Request) – Request details for the tool execution

  • details (ToolCallDetails) – The details of the tool call

  • agent_details (AgentDetails) – The details of the agent making the call

  • user_details (UserDetails | None) – Optional human user details

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

Return type:

ExecuteToolScope

Returns:

A new ExecuteToolScope instance

record_response(result)[source]

Record the tool call result for telemetry tracking.

Per OTEL spec, the result is expected to be an object. If a string is provided, it is recorded as-is (JSON string fallback). If a dict is provided, it is serialized to JSON.

Parameters:

result (dict[str, object] | str) – Tool call result as a structured dict or JSON string

Return type:

None