export_to_json

Function export_to_json 

Source
pub async fn export_to_json<P: Into<PathBuf>>(
    source: &dyn Memory,
    agent_id: &str,
    file_path: P,
) -> Result<usize, String>
Expand description

Exports all memory entries to a JSON file.

§Arguments

  • source - The source memory backend to read from
  • agent_id - The agent ID whose memories to export
  • file_path - Path to the output JSON file

§Examples

use ceylon_next::memory::{InMemoryStore, export_to_json};
use std::sync::Arc;

#[tokio::main]
async fn main() {
    let memory = Arc::new(InMemoryStore::new());
    export_to_json(&*memory, "agent-123", "backup.json").await.unwrap();
}