Raxol.Agent.ThreadEvent (Raxol Agent v2.6.0)

Copy Markdown View Source

One entry in a Raxol.Agent.ThreadLog.

Append-only, keyed on {thread_id, sequence}. The adapter assigns sequence atomically on append/4; callers supply thread_id, kind, payload, and optional metadata.

Kinds

KindPayload shapeUse
:directivethe Directive struct emittedrecord the agent's intent to fire an effect
:tool_call%{name, arguments}record an LLM tool invocation request
:tool_result%{name, result}record the result of a tool call
:messagethe message string or structa raw conversation message preserved before compaction
:state_snapshotthe agent state mapa periodic snapshot for audit / replay
:summarythe compactor's summary stringthe marker left when ContextCompactor summarized older messages
:sandbox_deny%{dimension, reason}record a sandbox denial
:policy_result%{policy, decision, ...}record a policy outcome (cache hit, retry attempt, timeout, ...)

Adapters MAY round-trip arbitrary additional kinds; the canonical set above is what the framework emits.

Metadata

Arbitrary map. The framework attaches :causation_id when available (chained from the CloudEvents envelope). Callers may attach anything; adapters preserve it verbatim.

Summary

Functions

Construct a ThreadEvent. Used by adapters when materializing events from storage; callers use the ThreadLog.append/4 dispatcher instead (which produces these via the adapter).

Types

kind()

@type kind() ::
  :directive
  | :tool_call
  | :tool_result
  | :message
  | :state_snapshot
  | :summary
  | :sandbox_deny
  | :policy_result
  | atom()

t()

@type t() :: %Raxol.Agent.ThreadEvent{
  kind: kind(),
  metadata: map(),
  payload: term(),
  recorded_at: DateTime.t(),
  sequence: non_neg_integer(),
  thread_id: binary()
}

Functions

new(opts)

@spec new(keyword()) :: t()

Construct a ThreadEvent. Used by adapters when materializing events from storage; callers use the ThreadLog.append/4 dispatcher instead (which produces these via the adapter).