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. Typed ExecuteToolCallResult payloads are serialized with the Agent365 schema contract; a payload that cannot be serialized records the diagnostic payload instead of raising.

Parameters:

result (ExecuteToolCallResult | dict[str, object] | str | None) – Tool call result as a typed schema model, a structured dict, a JSON string, or None to omit the attribute

Return type:

None