Current section

Files

Jump to
erlang_adk src adk_session_service.erl
Raw

src/adk_session_service.erl

%% @doc adk_session_service - Behaviour for ADK session persistence.
%%
%% Session services store conversations, memory, and state for agents.
-module(adk_session_service).
-type session() :: map().
-type session_meta() :: map().
-export_type([session/0, session_meta/0]).
-callback create_session(AppName :: binary(), UserId :: binary(), Opts :: map()) -> {ok, session()} | {error, term()}.
-callback get_session(AppName :: binary(), UserId :: binary(), SessionId :: binary()) -> {ok, session()} | {error, not_found}.
-callback list_sessions(AppName :: binary(), UserId :: binary()) -> {ok, [session_meta()]}.
-callback delete_session(AppName :: binary(), UserId :: binary(), SessionId :: binary()) -> ok.
-callback update_state(AppName :: binary(), UserId :: binary(), SessionId :: binary(), StateDelta :: map()) ->
ok | {error, not_found}.
-callback add_event(AppName :: binary(), UserId :: binary(), SessionId :: binary(), Event :: adk_event:event()) ->
ok | {error, not_found}.
-callback clear_temp_state(AppName :: binary(), UserId :: binary(), SessionId :: binary()) ->
ok | {error, not_found}.
-callback take_state(AppName :: binary(), UserId :: binary(), SessionId :: binary(), Key :: term()) ->
{ok, term()} | {error, not_found}.