systemprompt_analytics/repository/agents/mod.rs
1//! Agent analytics queries over `agent_tasks` and joined `ai_requests`.
2//!
3//! [`AgentAnalyticsRepository`] aggregates per-agent task counts, success
4//! rates, execution time, and cost, exposing list, detail, and summary-stat
5//! reads split across the sibling query submodules.
6//!
7//! Copyright (c) systemprompt.io — Business Source License 1.1.
8//! See <https://systemprompt.io> for licensing details.
9
10mod detail_queries;
11mod list_queries;
12mod stats_queries;
13
14use sqlx::PgPool;
15use std::sync::Arc;
16use systemprompt_database::DbPool;
17
18#[derive(Debug)]
19pub struct AgentAnalyticsRepository {
20 pool: Arc<PgPool>,
21}
22
23impl AgentAnalyticsRepository {
24 pub fn new(db: &DbPool) -> Self {
25 let pool = db.pool();
26 Self { pool }
27 }
28}