ADK.Memory.Service behaviour (adk_ex v1.1.0)

Copy Markdown View Source

Behaviour for memory storage backends.

Memory services store cross-session knowledge extracted from session events and provide search capabilities for retrieving relevant memories.

Summary

Callbacks

Adds a session's events to memory storage.

Searches memory for entries matching the given criteria.

Types

opts()

@type opts() :: keyword()

Callbacks

add_session(server, session)

@callback add_session(server :: GenServer.server(), session :: ADK.Session.t()) ::
  :ok | {:error, term()}

Adds a session's events to memory storage.

Extracts text content from session events, indexes it for search, and stores it keyed by the session's app_name and user_id.

search(server, opts)

@callback search(server :: GenServer.server(), opts()) ::
  {:ok, [ADK.Memory.Entry.t()]} | {:error, term()}

Searches memory for entries matching the given criteria.

Options:

  • :query — search text (words are matched against stored entries)
  • :app_name — scope to a specific application
  • :user_id — scope to a specific user