Agent Air provides mechanisms to persist conversation history and agent configuration, ensuring that users can pick up where they left off.

What is Persisted?

  1. Session History: The list of messages (User, Assistant, System) in a conversation.
  2. Configuration: API keys (securely), preferred model, and theme settings.
  3. Tool State: Some tools may need to save state (e.g., “last search query”), though this is less common.

The Storage Backend

By default, we use a file-based storage system (JSON or SQLite) located in the user’s configuration directory (e.g., ~/.config/agent-air/sessions/).

pub trait SessionStore: Send + Sync {
    async fn save_session(&self, session: &LLMSession) -> Result<(), IoError>;
    async fn load_session(&self, id: &str) -> Result<LLMSession, IoError>;
    async fn list_sessions(&self) -> Result<Vec<SessionSummary>, IoError>;
}

Security Considerations

  • API Keys: Should never be stored in plain text JSON files alongside conversation history. We recommend using the OS keyring (via the keyring crate) or environment variables.
  • Redaction: Users might want to redact sensitive data from logs or saved history. Implementing a redaction pass before serialization is a recommended pattern.