mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
feat!: Introduction of ADK folder for local session and artifact storage
Default CLI session storage to SQLite instead of in-memory Previously, adk run and adk web used in-memory session storage by default, causing sessions to be lost on restart. Now sessions persist to .adk/session.db automatically. To use in-memory storage, pass --session-service-uri memory:// Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 838975328
This commit is contained in:
committed by
Copybara-Service
parent
dd827af2ee
commit
ed9da3fa45
@@ -19,10 +19,10 @@ from __future__ import annotations
|
||||
from pathlib import Path
|
||||
from unittest.mock import Mock
|
||||
|
||||
from google.adk.cli.utils.local_storage import PerAgentDatabaseSessionService
|
||||
import google.adk.cli.utils.service_factory as service_factory
|
||||
from google.adk.memory.in_memory_memory_service import InMemoryMemoryService
|
||||
from google.adk.sessions.database_session_service import DatabaseSessionService
|
||||
from google.adk.sessions.in_memory_session_service import InMemorySessionService
|
||||
import pytest
|
||||
|
||||
|
||||
@@ -44,12 +44,20 @@ def test_create_session_service_uses_registry(tmp_path: Path, monkeypatch):
|
||||
)
|
||||
|
||||
|
||||
def test_create_session_service_defaults_to_memory(tmp_path: Path):
|
||||
@pytest.mark.asyncio
|
||||
async def test_create_session_service_defaults_to_per_agent_sqlite(
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
agent_dir = tmp_path / "agent_a"
|
||||
agent_dir.mkdir()
|
||||
service = service_factory.create_session_service_from_options(
|
||||
base_dir=tmp_path,
|
||||
)
|
||||
|
||||
assert isinstance(service, InMemorySessionService)
|
||||
assert isinstance(service, PerAgentDatabaseSessionService)
|
||||
session = await service.create_session(app_name="agent_a", user_id="user")
|
||||
assert session.app_name == "agent_a"
|
||||
assert (agent_dir / ".adk" / "session.db").exists()
|
||||
|
||||
|
||||
def test_create_session_service_fallbacks_to_database(
|
||||
|
||||
Reference in New Issue
Block a user