Legion.Store.Payload (Legion v0.5.0)

View Source

Data supplied to and returned from a Legion.Store.

Payloads are partial updates: agent_id is required, while a nil value for every other field means the store must preserve its existing value. A conversation_state holds the persisted messages, bindings, and executor checkpoint. Its :executor_state value is :nonexistent for an ordinary snapshot or a map when step persistence captures an interrupted turn.

See Legion.Store for the full store contract.

Summary

Types

executor_state()

@type executor_state() :: %{
  phase: :awaiting_llm | :completing,
  iteration: non_neg_integer(),
  retries: non_neg_integer()
}

state()

@type state() :: %{
  messages: [map()],
  bindings: term(),
  executor_state: executor_state() | :nonexistent
}

status()

@type status() :: :idle | :running

t()

@type t() :: %Legion.Store.Payload{
  agent_id: Legion.Store.agent_id(),
  agent_module: module() | nil,
  conversation_state: state() | nil,
  parent_agent_id: Legion.Store.agent_id() | nil,
  started_at: NaiveDateTime.t() | nil,
  status: status() | nil,
  usage: [map()] | nil
}