adk-session 0.6.0

Session management and state persistence for Rust Agent Development Kit (ADK-Rust) agents
Documentation
#[cfg(feature = "database")]
use adk_session::*;
#[cfg(feature = "database")]
use std::collections::HashMap;

#[cfg(feature = "database")]
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let db_path = "test_adk.db";
    println!("🔧 Creating SQLite database at {}", db_path);

    let service = SqliteSessionService::new(&format!("sqlite:{}", db_path)).await?;
    service.migrate().await?;

    println!("✅ Database created and migrated");

    let _session = service
        .create(CreateRequest {
            app_name: "test_app".to_string(),
            user_id: "user1".to_string(),
            session_id: Some("session1".to_string()),
            state: HashMap::new(),
        })
        .await?;

    println!("✅ Created session: session1");
    println!("   App: test_app");
    println!("   User: user1");

    // Retrieve the session
    let _retrieved = service
        .get(GetRequest {
            app_name: "test_app".to_string(),
            user_id: "user1".to_string(),
            session_id: "session1".to_string(),
            num_recent_events: None,
            after: None,
        })
        .await?;

    println!("✅ Retrieved session: session1");

    // List sessions
    let sessions = service
        .list(ListRequest {
            app_name: "test_app".to_string(),
            user_id: "user1".to_string(),
            limit: None,
            offset: None,
        })
        .await?;

    println!("✅ Found {} session(s)", sessions.len());
    println!("\n📁 Database file created at: {}", db_path);
    println!("   You can inspect it with: sqlite3 {}", db_path);

    Ok(())
}

#[cfg(not(feature = "database"))]
fn main() {
    println!("This example requires the 'database' feature.");
    println!("Run with: cargo run --example database_example --features database");
}