Share via


InvokeAgentScope class

Provides OpenTelemetry tracing scope for AI agent invocation operations.

Extends

Methods

recordInputMessages(string[])

Records the input messages for telemetry tracking.

recordOutputMessages(string[])

Records the output messages for telemetry tracking.

recordResponse(string)

Records response information for telemetry tracking.

start(InvokeAgentDetails, TenantDetails, EnhancedAgentDetails, CallerDetails)

Creates and starts a new scope for agent invocation tracing.

Inherited Methods

dispose()

Legacy dispose method for compatibility

recordError(Error)

Records an error that occurred during the operation

withActiveSpanAsync<T>(() => Promise<T>)

Makes this span active for the duration of the async callback execution

Method Details

recordInputMessages(string[])

Records the input messages for telemetry tracking.

function recordInputMessages(messages: string[])

Parameters

messages

string[]

Array of input messages

recordOutputMessages(string[])

Records the output messages for telemetry tracking.

function recordOutputMessages(messages: string[])

Parameters

messages

string[]

Array of output messages

recordResponse(string)

Records response information for telemetry tracking.

function recordResponse(response: string)

Parameters

response

string

The invocation response

start(InvokeAgentDetails, TenantDetails, EnhancedAgentDetails, CallerDetails)

Creates and starts a new scope for agent invocation tracing.

static function start(invokeAgentDetails: InvokeAgentDetails, tenantDetails: TenantDetails, callerAgentDetails?: EnhancedAgentDetails, callerDetails?: CallerDetails): InvokeAgentScope

Parameters

invokeAgentDetails
InvokeAgentDetails

The details of the agent invocation including endpoint, agent information, and conversation context.

tenantDetails
TenantDetails

The tenant details.

callerAgentDetails
EnhancedAgentDetails

The details of the caller agent.

callerDetails
CallerDetails

The details of the non-agentic caller.

Returns

A new InvokeAgentScope instance.

Inherited Method Details

dispose()

Legacy dispose method for compatibility

function dispose()

Inherited From OpenTelemetryScope.dispose

recordError(Error)

Records an error that occurred during the operation

function recordError(error: Error)

Parameters

error

Error

The error that occurred

Inherited From OpenTelemetryScope.recordError

withActiveSpanAsync<T>(() => Promise<T>)

Makes this span active for the duration of the async callback execution

function withActiveSpanAsync<T>(callback: () => Promise<T>): Promise<T>

Parameters

callback

() => Promise<T>

Returns

Promise<T>

Inherited From OpenTelemetryScope.withActiveSpanAsync