adk_session_service behaviour (erlang_adk v0.2.5)

View Source

adk_session_service - Behaviour for ADK session persistence.

Session services store conversations, memory, and state for agents.

Summary

Types

session/0

-type session() :: map().

session_meta/0

-type session_meta() :: map().

Callbacks

add_event/4

-callback add_event(AppName :: binary(),
                    UserId :: binary(),
                    SessionId :: binary(),
                    Event :: adk_event:event()) ->
                       ok | {error, not_found}.

clear_temp_state/3

-callback clear_temp_state(AppName :: binary(), UserId :: binary(), SessionId :: binary()) ->
                              ok | {error, not_found}.

create_session/3

-callback create_session(AppName :: binary(), UserId :: binary(), Opts :: map()) ->
                            {ok, session()} | {error, term()}.

delete_session/3

-callback delete_session(AppName :: binary(), UserId :: binary(), SessionId :: binary()) -> ok.

get_session/3

-callback get_session(AppName :: binary(), UserId :: binary(), SessionId :: binary()) ->
                         {ok, session()} | {error, not_found}.

list_sessions/2

-callback list_sessions(AppName :: binary(), UserId :: binary()) -> {ok, [session_meta()]}.

take_state/4

-callback take_state(AppName :: binary(), UserId :: binary(), SessionId :: binary(), Key :: term()) ->
                        {ok, term()} | {error, not_found}.

update_state/4

-callback update_state(AppName :: binary(), UserId :: binary(), SessionId :: binary(), StateDelta :: map()) ->
                          ok | {error, not_found}.