Skip to main content

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
7mod detail_queries;
8mod list_queries;
9mod stats_queries;
10
11use crate::Result;
12use sqlx::PgPool;
13use std::sync::Arc;
14use systemprompt_database::DbPool;
15
16#[derive(Debug)]
17pub struct AgentAnalyticsRepository {
18    pool: Arc<PgPool>,
19}
20
21impl AgentAnalyticsRepository {
22    pub fn new(db: &DbPool) -> Result<Self> {
23        let pool = db.pool_arc()?;
24        Ok(Self { pool })
25    }
26}