adk_live_event (erlang_adk v0.7.0)

View Source

Versioned provider-neutral events emitted by a Live session.

These maps are process-local envelopes. In particular an audio payload contains a raw adk_live_media binary and is ephemeral by default. A persistence/UI boundary must explicitly project durable event kinds rather than blindly serializing this value.

Summary

Types

durability/0

-type durability() :: durable | ephemeral.

event/0

-type event() ::
          #{schema_version := 1,
            kind := kind(),
            payload := term(),
            sequence := non_neg_integer(),
            turn_epoch := non_neg_integer(),
            generation_epoch := non_neg_integer(),
            timestamp := integer(),
            durability := durability()}.

kind/0

-type kind() ::
          ready | audio | content | input_transcription | output_transcription | usage | grounding |
          tool_call | tool_response | tool_cancelled | generation_complete | turn_complete |
          interrupted | go_away | resumption_status | reconnecting | terminal | error.

Functions

bytes(_)

-spec bytes(event()) -> pos_integer().

Number of subscriber-window bytes charged by this event.

durability(_)

-spec durability(event()) -> durability().

kind(_)

-spec kind(event()) -> kind().

new(Kind, Payload)

-spec new(kind(), term()) -> {ok, event()} | {error, term()}.

new(Kind, Payload, Opts)

-spec new(kind(), term(), map()) -> {ok, event()} | {error, term()}.

sequence(_)

-spec sequence(event()) -> non_neg_integer().

validate(Event)

-spec validate(term()) -> ok | {error, term()}.

with_envelope(Event, Sequence, TurnEpoch, GenerationEpoch)

-spec with_envelope(event(), pos_integer(), non_neg_integer(), non_neg_integer()) ->
                       {ok, event()} | {error, term()}.