Add agent plataform flow metrics to GraphQL
Summary
Add agentPlatform field to aiMetrics GraphQL endpoint to expose Duo Agent Platform flow metrics.
Context
As part of delivering the Duo Agent Platform metrics dashboard for 18.7, we need to expose flow-level metrics through the GraphQL API. The agent_platform_sessions materialized view (introduced in !210808 (merged)) contains the necessary data.
Reference: https://gitlab.com/gitlab-org/gitlab/-/issues/570564#note_2899742603
Proposal
Add an agentPlatform attribute to the aiMetrics GraphQL endpoint that contains the following metrics per flow:
- Flow name - The name/identifier of the flow
- Number of sessions - Total count of sessions for this flow
- Average flow execution time - Avg (Median) flow execution time (minutes)
- Unique users - Count of distinct users who executed this flow
- Completion rate - Percentage of sessions that completed successfully
Query sample
query {
group(fullPath:"gitlab-org") {
aiMetrics(startDate: "2024-11-17", endDate: "2025-11-17") {
agentPlataform {
...otherFields
flowMetrics {
flowName
sessionCount
averageExecutionTime
uniqueUsersCount
completionRate
}
}
}
}
}
Sample response
flowMetrics: {
nodes: [
{
flowName: 'chat',
sessionCount: 10
...
},
{
flowName: 'other',
sessionCount: 11,
...
},
...
]
}
Sorting Support
Add the ability to sort results based on:
- Number of sessions
- Average flow execution time
- Unique users
Data Source
Query the agent_platform_sessions materialized view to calculate these metrics based on the created_at_event, finished_at_event, and other relevant fields.
Edited by Felipe Cardozo