Behaviour for memory services.
Provides long-term memory across sessions — agents can store and search
memories scoped by app + user. Mirrors Python ADK's BaseMemoryService.
Implementing a backend
defmodule MyVectorStore do
@behaviour ADK.Memory.Store
@impl true
def search(app_name, user_id, query, opts) do
# your vector search here
{:ok, []}
end
# ... other callbacks
end
Summary
Callbacks
Add memory entries.
Add all events from a session to memory.
Delete all memories for a user scope.
Delete a specific memory entry by ID.
Search memories matching the query. Returns entries ranked by relevance.
Types
Callbacks
@callback add( app_name :: String.t(), user_id :: String.t(), entries :: [ADK.Memory.Entry.t()] ) :: :ok | {:error, term()}
Add memory entries.
@callback add_session( app_name :: String.t(), user_id :: String.t(), session_id :: String.t(), events :: [ADK.Event.t()] ) :: :ok | {:error, term()}
Add all events from a session to memory.
Delete all memories for a user scope.
@callback delete( app_name :: String.t(), user_id :: String.t(), entry_id :: String.t() ) :: :ok | {:error, term()}
Delete a specific memory entry by ID.
@callback search( app_name :: String.t(), user_id :: String.t(), query :: String.t(), opts :: keyword() ) :: {:ok, [ADK.Memory.Entry.t()]} | {:error, term()}
Search memories matching the query. Returns entries ranked by relevance.