Intelligent clustering

Updated at:

The Intelligent Clustering feature uses the conversations between users and Agents that are recorded in traces to automatically identify semantically similar requests and group them into topics. This helps you understand the distribution of user needs, discover scenarios with high latency or high token consumption, and quickly locate the related traces.

You can configure predefined topics, or let the system generate clustering topics automatically. Traces that do not match a predefined topic continue to participate in semantic clustering.

Prerequisites

  • You have activated Cloud Monitor 2.0 and created a workspace.

  • You have ingested your AI Agent's observability data into the current workspace.For information about how to ingest AI Agent observability data, see AI Agent Observability integration overview.

  • Trace data that can be analyzed exists within the selected time range.

Procedure

Log on to the Cloud Monitor 2.0 console, select the target workspace, choose AI Agent Observability in the left-side navigation pane, and click the Clustering and Attribution tab.

Clustering tasks

The page uses clustering tasks to manage different data ranges and clustering configurations. A clustering task can contain multiple run records, which lets you repeat the analysis over different time ranges.

In the task list, you can:

  • Search for clustering tasks by task name.

  • View the task description, the number of runs, and the most recent run time.

  • Create, modify, or delete a clustering task.

  • Click a task name to go to the task details.

Create a clustering task

Click Create Clustering Task and complete the following configurations.

Basic information

Parameter

Description

Task Name

Identifies the clustering task. We recommend that you use a name that reflects the analysis target or the business scenario.

Task Description

Provides additional information about the purpose of the task, the data range, or the target of interest.

Data filtering

Data filtering limits the traces that participate in clustering. The following table describes the typical filter fields.

Filter field

Description

AI application

Filters data by the application that a trace passes through. This field is suitable for analyzing request topics within a specific application.

AI Agent

Filters data by the Agent that is called. This field is suitable for focusing on the user requests and execution scenarios of a specific Agent.

User ID

Filters data by user identifier. This field is suitable for analyzing a specific user group or troubleshooting the requests of a single user.

Skill

Filters data by the Skill that is called. This field is suitable for analyzing the request types that involve a specific Skill.

Number of LLM, tool, and Agent calls

Filters data by the number of calls of the corresponding type within a single trace. This field is suitable when you focus on multi-round reasoning or complex tool call scenarios.

Total trace latency

Filters data by the overall execution latency of a trace. This field is suitable for clustering and analyzing slow requests.

Take note of the following items when you configure data filtering:

  • For AI application, AI Agent, User ID, and Skill, you can select from candidate values. Candidate values are obtained based on the time range of the first run. If the target value does not exist in the candidate list, you can also enter it manually.

Predefined topics

Predefined topics are optional. They are typically used to describe user intents or business scenarios, and are suitable for scenarios in which the business categories are already clear, such as "Refund progress inquiry", "Refund application", or "Order cancellation". By agreeing on topic names and their scope in advance, you can make the classification criteria more consistent across runs, which makes it easier to continuously observe the volume and metric changes of similar requests.

Each predefined topic requires a unique topic name and a topic description. The topic description not only explains the name but also helps the system determine whether a trace belongs to the topic. We recommend that you follow these principles:

  • The topic name must be concise and specific, and must directly express a business intent or a problem type.

  • The topic description must clearly state what is included and, if necessary, also state the adjacent scenarios that are excluded. For example: "Refund progress inquiry: the user asks about the processing status or the arrival time of a refund that has already been requested. This does not include how to apply for a refund."

  • Different topics must have clear boundaries. Avoid configuring a broad topic and a granular topic whose meanings overlap. For example, we do not recommend that you use both "Refund issues" and "Refund progress inquiry" when the boundary between them is unclear.

  • Topics at the same level must use a consistent classification dimension whenever possible, such as classifying all of them by user intent, business stage, or failure type.

The system preferentially assigns semantically matching traces to predefined topics. Unmatched traces continue to participate in automatic semantic clustering.

If you have many topics, you can use Batch Edit. Enter one topic per line and use a semicolon (;) to separate the topic name from the topic description. After you confirm the batch edit, the batch content replaces the current predefined topic list.

Automatic clustering and predefined topics

Automatic clustering is mainly used to discover topics that are not yet explicitly named in your data. Based on the conversations between users and Agents that are recorded in traces, the system groups together traces that are semantically similar and that reach a certain data scale, and then generates a topic name and description for each group. Execution information such as tool calls and latency does not participate in topic clustering. It is used only for metric analysis after clustering is complete. Traces that do not meet the clustering conditions are displayed as outliers. Minimum Cluster Size and Minimum Samples control the amount of data and the degree of aggregation that are required to form a cluster.

The two methods are suitable for different analysis goals:

  • If you already have a stable business classification and want to keep consistent criteria across runs at different times, we recommend that you configure predefined topics.

  • If you want to explore user needs, discover unknown issues, or identify newly emerging request types, we recommend that you use automatic clustering.

  • You can use both methods at the same time: first use predefined topics to ensure certainty for known categories, and then let automatic clustering discover new patterns beyond the predefined topics.

Clustering parameters

Parameter

Description

Minimum Cluster Size

Controls the minimum number of traces that a cluster must contain. A larger value reduces the number of overly small topics and makes the results more concentrated, but may increase the number of outliers. A smaller value can identify more granular topics, but the results may be more scattered.

Minimum Samples

Controls the data density that is required to form a cluster. A larger value raises the clustering requirements and makes the results stricter. A smaller value can cover more traces, but may group traces with significant semantic differences into the same topic.

You can adjust the clustering parameters based on the number of topics, the topic clustering rate, and the proportion of outliers.

First run

If you select Create and Start Clustering, you must configure the parameters of the first run.

Parameter

Description

Run Name

Distinguishes between different run records of the same task.

Data Time Range

Specifies the time range of the trace data that is read for this run.

Maximum Traces

Limits the number of traces that participate in the analysis for this run.

Data Preview

Previews the number of matches and a small number of trace samples based on the current time range and filter conditions. You can also view the corresponding Simple Log Service query statement. The preview result is used only to confirm the data range and does not start clustering.

After the configuration is complete, you can select one of the following options:

  • Create and Start Clustering: creates the task and immediately starts the first run.

  • Create Task Only: saves only the task configuration. You can manually create a run later on the task details page.

Note

Running a clustering task calls the intelligent analysis capability and consumes AI credits. Before execution, the page displays a confirmation message.

Manage run records

After you go to the task details page, you can view the run records of the current task. Each run uses its own data time range and maximum number of traces.

The run states include:

State

Description

Dispatching

The task is waiting to be executed.

Running

Trace data is being read and topic clustering is being performed.

Canceling

A cancellation request has been submitted.

Succeeded

The clustering run is complete and you can view the results.

Failed

This run failed to be executed.

Canceled

This run has been canceled.

You can switch between run records to compare the topic distribution and resource consumption across different time periods.

Note

After you modify the task configuration, the new configuration applies only to runs that are created later. Existing runs and their clustering results do not change.

View clustering results

After you select a task and a run record, the page displays the clustering results of the current run.

Overview metrics

The top of the page displays the following metrics:

Metric

Description

Total Traces

The total number of traces that participate in the analysis for this run.

Topics

The number of topics that are contained in the clustering results of this run, including predefined topics and algorithm-generated topics. Outliers are not included.

Topic Clustering Rate

The proportion of traces that are assigned to a valid topic.

Average Latency

The average execution latency of all traces. The P99 latency is displayed at the same time.

Total Tokens

The total number of tokens that are consumed by all traces. The cache hit rate is displayed at the same time.

Topic distribution

The topic distribution chart displays different topics as bubbles:

  • The horizontal axis indicates the number of traces that a topic contains.

  • The vertical axis can be switched to total tokens, average TTFT, or average latency.

  • The bubble size indicates the number of traces that the topic contains.

  • Outliers indicate traces that have not yet formed a stable topic.

Click a bubble to view the details of the corresponding topic.

Topic list

The topic list displays the following information:

Field

Description

Topic

The topic name, the topic description, and the topic source.

Traces

The number and the proportion of traces that the topic contains.

Latency

The average latency and the P99 latency.

Rounds

The average number of rounds and the P99 number of rounds.

Token Consumption

The total number of tokens and the average token consumption per trace.

Cache Hit Rate

The cache hit status of the model calls within the topic.

You can sort topics by the number of traces, latency, number of rounds, token consumption, or cache hit rate.

View topic details

In the topic distribution chart or the topic list, click the target topic to open the topic details.

The topic details mainly include:

  • The topic summary and the core performance metrics.

  • The model call distribution, the number of calls, the number of errors, the average latency, and the token consumption.

  • The tool call distribution, the number of errors, the average latency, and the failure rate.

  • The Skill loading status.

  • Common failure patterns.

  • Representative trace samples of the topic.

Click a trace ID to go to the trace details, where you can view the complete trace, the span hierarchy, and the input and output information.

The page also provides an Attribution Analysis entry point, which you can use to further analyze the feature differences between abnormal traces and normal traces within the topic.

Common use cases

  • User demand analysis: understand which topics user requests are mainly concentrated in, which helps you plan Agent capabilities.

  • Abnormal scenario analysis: for a specific business scenario or task of an Agent, use common failure patterns, metric distributions, and representative traces to find abnormal samples and analyze the causes of the issues.

  • Performance issue troubleshooting: you can compare the average latency, P99 latency, or TTFT of different business scenarios to identify scenarios with poor overall performance. You can also focus on a specific scenario or task of an Agent to locate slow traces and abnormal calls.

  • Cost optimization: you can compare the token consumption and the cache hit rate of different business scenarios to identify scenarios with high token usage or low cache utilization, which provides clues for cost optimization. You can also focus on a specific scenario or task of an Agent to find traces with abnormal token consumption and analyze the model calls and the context usage.

  • Version comparison: for a specific business scenario or task of an Agent, compare metrics such as the number of traces, latency, errors, and token consumption across the runs that correspond to different versions to evaluate the results of your optimizations.

References