InvokeAgentScope class
Provides OpenTelemetry tracing scope for AI agent invocation operations.
- Extends
Methods
| record |
Records the input messages for telemetry tracking. |
| record |
Records the output messages for telemetry tracking. |
| record |
Records response information for telemetry tracking. |
| record |
|
| start(Request, Invoke |
Creates and starts a new scope for agent invocation tracing. |
Inherited Methods
| dispose() | Legacy dispose method for compatibility. |
| get |
Gets the span context for this scope. |
| record |
Records multiple attribute key/value pairs using last-write-wins semantics. |
| record |
Records a cancellation event on the span. |
| record |
Records an error that occurred during the operation. |
| set |
Sets a custom end time for the scope.
When set, |
| with |
Makes this span active for the duration of the async callback execution. |
| [dispose]() | Disposes the scope and finalizes telemetry data collection. |
Method Details
recordInputMessages(InputMessagesParam)
Records the input messages for telemetry tracking.
function recordInputMessages(messages: InputMessagesParam)
Parameters
- messages
- InputMessagesParam
recordOutputMessages(OutputMessagesParam)
Records the output messages for telemetry tracking.
function recordOutputMessages(messages: OutputMessagesParam)
Parameters
- messages
- OutputMessagesParam
recordResponse(string)
Records response information for telemetry tracking.
function recordResponse(response: string)
Parameters
- response
-
string
recordResponseParameters(GenAiResponseParameters)
function recordResponseParameters(responseParameters: GenAiResponseParameters)
Parameters
- responseParameters
- GenAiResponseParameters
start(Request, InvokeAgentScopeDetails, AgentDetails, CallerDetails, SpanDetails)
Creates and starts a new scope for agent invocation tracing.
static function start(request: Request, invokeScopeDetails: InvokeAgentScopeDetails, agentDetails: AgentDetails, callerDetails?: CallerDetails, spanDetails?: SpanDetails): InvokeAgentScope
Parameters
- request
- A365Request
Request payload (channel, conversationId, content, sessionId).
- invokeScopeDetails
- InvokeAgentScopeDetails
Scope-level details (endpoint).
- agentDetails
- AgentDetails
The agent identity. tenantId is required.
- callerDetails
- CallerDetails
Optional caller information (human, agent, or both for A2A).
- spanDetails
- A365SpanDetails
Optional span configuration. Defaults the span kind to
SpanKind.INTERNAL when omitted.
Returns
Inherited Method Details
dispose()
Legacy dispose method for compatibility.
function dispose()
Inherited From OpenTelemetryScope.dispose
getSpanContext()
Gets the span context for this scope.
function getSpanContext(): SpanContext
Returns
SpanContext
Inherited From OpenTelemetryScope.getSpanContext
recordAttributes(Iterable<[string, AttributeValue], any, any> | Record<string, AttributeValue> | null | undefined)
Records multiple attribute key/value pairs using last-write-wins semantics.
function recordAttributes(attributes: Iterable<[string, AttributeValue], any, any> | Record<string, AttributeValue> | null | undefined)
Parameters
- attributes
-
Iterable<[string, AttributeValue], any, any> | Record<string, AttributeValue> | null | undefined
Inherited From OpenTelemetryScope.recordAttributes
recordCancellation(string)
Records a cancellation event on the span.
function recordCancellation(reason?: string)
Parameters
- reason
-
string
Inherited From OpenTelemetryScope.recordCancellation
recordError(Error)
Records an error that occurred during the operation.
function recordError(error: Error)
Parameters
- error
-
Error
Inherited From OpenTelemetryScope.recordError
setEndTime(TimeInput)
Sets a custom end time for the scope.
When set, dispose() will pass this value to span.end() instead of using wall-clock time.
function setEndTime(endTime: TimeInput)
Parameters
- endTime
-
TimeInput
Inherited From OpenTelemetryScope.setEndTime
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
[dispose]()
Disposes the scope and finalizes telemetry data collection.
function [dispose]()
Inherited From OpenTelemetryScope.[dispose]