Skip to content

Latest commit

 

History

History

memory

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

Memory Sample

This sample demonstrates memory usage with ADK. For persistent local memory, use SQLite.

Persistent Local Memory (SQLite)

Programmatic usage:

from google.adk.memory import SqliteMemoryService
from google.adk.runners import Runner
from google.adk.sessions.in_memory_session_service import InMemorySessionService

memory_service = SqliteMemoryService(db_path="memory.db")
runner = Runner(
    app_name="my_app",
    agent=agent.root_agent,
    session_service=InMemorySessionService(),
    memory_service=memory_service,
)

CLI usage (supported for adk run, adk web, and adk api_server):

adk web path/to/agents_dir --memory_service_uri=sqlite:///memory.db

Notes:

  • sqlite:///memory.db uses a relative path.
  • sqlite:////abs/path/memory.db uses an absolute path.