listSpans method
Retrieves AI agent execution traces for a session, providing granular visibility into agent orchestration flows, LLM interactions, and tool invocations.
May throw AccessDeniedException.
May throw ResourceNotFoundException.
May throw ValidationException.
Parameter assistantId :
UUID or ARN of the Connect AI Assistant resource
Parameter sessionId :
UUID or ARN of the Connect AI Session resource
Parameter maxResults :
Maximum number of spans to return per page
Parameter nextToken :
Pagination token for retrieving the next page of results
Implementation
Future<ListSpansResponse> listSpans({
required String assistantId,
required String sessionId,
int? maxResults,
String? nextToken,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
100,
);
final $query = <String, List<String>>{
if (maxResults != null) 'maxResults': [maxResults.toString()],
if (nextToken != null) 'nextToken': [nextToken],
};
final response = await _protocol.send(
payload: null,
method: 'GET',
requestUri:
'/assistants/${Uri.encodeComponent(assistantId)}/sessions/${Uri.encodeComponent(sessionId)}/spans',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return ListSpansResponse.fromJson(response);
}