agent_storage/contracts/
usage_store.rs1use super::StorageError;
4use agent_metering::{ModelPricing, UsageRecord};
5use async_trait::async_trait;
6use uuid::Uuid;
7
8#[async_trait]
14pub trait UsageStore: Send + Sync {
15 async fn append_usage(&self, record: UsageRecord) -> Result<(), StorageError>;
16 async fn list_usage(&self, run_id: Option<Uuid>) -> Result<Vec<UsageRecord>, StorageError>;
17 async fn insert_pricing(&self, pricing: ModelPricing) -> Result<(), StorageError>;
18 async fn get_pricing(
19 &self,
20 provider: &str,
21 model: &str,
22 version: &str,
23 ) -> Result<Option<ModelPricing>, StorageError>;
24 async fn list_pricing(
25 &self,
26 provider: &str,
27 model: &str,
28 ) -> Result<Vec<ModelPricing>, StorageError>;
29 async fn list_all_pricing(&self) -> Result<Vec<ModelPricing>, StorageError>;
30}