Skip to content

v0.7.0 - Centralized Session Management

Choose a tag to compare

@kkdai kkdai released this 24 Jan 00:21
· 354 commits to main since this release
47b9d6c

What's New

Phase 5: Centralized Session Management

This release introduces a dedicated SessionManager service for thread-safe session lifecycle management with automatic cleanup.

New Features

SessionManager (services/session_manager.py)

  • Thread-safe Operations: All session operations protected by Lock
  • Automatic TTL: Sessions expire after 30 minutes of inactivity (configurable)
  • Background Cleanup: Async task removes expired sessions every 5 minutes
  • Session Statistics: Monitor active sessions, messages, and cleanup metrics
  • Singleton Pattern: App-wide shared instance via get_session_manager()
  • Lifecycle Callbacks: Optional hooks for session created/expired events

New Commands

Command Description
/stats Display session statistics
/session-stats Alias for /stats

FastAPI Lifecycle Integration

  • Cleanup task starts automatically on app startup
  • Graceful shutdown stops cleanup task and closes resources

Architecture

User Request
     ↓
Orchestrator → ChatAgent → SessionManager
                               ↓
                    ┌──────────┴──────────┐
                    │  Background Task    │
                    │  (cleanup every 5m) │
                    └─────────────────────┘

Changes

  • New services/session_manager.py with full session lifecycle management
  • Updated agents/chat_agent.py to delegate session ops to SessionManager
  • Updated agents/orchestrator.py with /stats command
  • Updated main.py with FastAPI startup/shutdown events

Configuration

Environment Variable Default Description
SESSION_TIMEOUT_MINUTES 30 Session TTL
MAX_HISTORY_LENGTH 20 Max messages per session

ADK Migration Complete

All 5 phases of the ADK migration are now complete:

  1. ✅ Phase 1: Install ADK & Refactor Tools (v0.3.0)
  2. ✅ Phase 2: ChatAgent with LINE Integration (v0.4.0)
  3. ✅ Phase 3: Specialized Agents (v0.5.0)
  4. ✅ Phase 4: Orchestrator with A2A (v0.6.0)
  5. ✅ Phase 5: Session Management (v0.7.0)

Full Changelog: v0.6.0...v0.7.0