// Execution persistence abstraction for decoupling executor from KG
// Allows different persistence strategies

use async_trait::async_trait;

/// Execution record to persist
#[derive(Clone, Debug)]
pub struct ExecutionRecord {
    pub task_id: String,
    pub agent_id: String,
    pub task_type: String,
    pub success: bool,
    pub duration_ms: u64,
    pub input_tokens: u32,
    pub output_tokens: u32,
    pub error_message: Option<String>,
}

/// Abstraction for persisting execution records.
/// Decouples executor from knowledge graph implementation.
#[async_trait]
pub trait ExecutionPersistence: Send + Sync {
    /// Record task execution with results.
    async fn record_execution(&self, record: ExecutionRecord) -> anyhow::Result<()>;
}
