A normalized event emitted by a backend during a prompt turn.
Backends translate their native event streams into GenAgent.Event values
so the state machine and user callbacks see a consistent shape regardless
of which LLM is on the other end.
Event kinds
:text-- an assistant text chunk (delta).datacarries%{text: String.t()}.:tool_use-- the agent invoked a tool.datais backend-specific.:tool_result-- a tool returned.datais backend-specific.:usage-- token usage info.datatypically carries%{input_tokens: integer(), output_tokens: integer()}.:result-- terminal event for a successful turn.datacarries at minimum%{text: String.t()}with the full assembled assistant text.:error-- terminal event for a failed turn.datacarries%{reason: term()}.
Exactly one terminal event (:result or :error) is emitted per turn.
Summary
Functions
Build an event of the given kind with data.
True if the event is a terminal event (:result or :error).
Types
Functions
Build an event of the given kind with data.
The timestamp is stamped from System.monotonic_time/1 in milliseconds,
so event timestamps are suitable for computing durations within a single
turn but are not wall-clock values.
True if the event is a terminal event (:result or :error).
Terminal events mark the end of a turn. The stream from
GenAgent.Backend.prompt/2 should emit exactly one terminal event.