ExAgent.Server.Snapshot (ExAgent v3.0.0)

View Source

Version 4 checkpoint of conversational data, with bounded readers for v1/v2/v3.

Stability — Stable.

Restores confirmed history and usage, not live models, tasks or external effects. output_guarded records the Server's history presentation policy. A missing value leaves the policy unknown. A guarded snapshot can include accepted_rows, ordered pairs of zero-based message positions and accepted display text. A missing field has no evidence of acceptance. Custom Stores use serialize/1, deserialize/1 and validate/2 for the snapshots supplied by the Server. The app supplies the live template. The checkpoint can contain application data in its messages, accepted rows, metadata and provider data.

Summary

Functions

Decode stored JSON as a validated Server snapshot.

Build a checkpoint from an agent ID and the current conversation data.

Encode a Server snapshot as portable JSON for a Store.

Validate a snapshot and check its agent ID against the storage key.

Types

t()

@type t() :: %ExAgent.Server.Snapshot{
  accepted_rows: term(),
  agent_id: term(),
  message_history: term(),
  metadata: term(),
  output_guarded: term(),
  provider_state: term(),
  revision: term(),
  saved_at: term(),
  usage: term(),
  version: term()
}

Functions

deserialize(binary)

@spec deserialize(binary()) :: {:ok, t()} | {:error, term()}

Decode stored JSON as a validated Server snapshot.

messages(arg1)

new(opts)

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

Build a checkpoint from an agent ID and the current conversation data.

serialize(snapshot)

@spec serialize(t()) :: binary()

Encode a Server snapshot as portable JSON for a Store.

usage_struct(snapshot)

validate(snapshot, expected_id)

@spec validate(t(), String.t()) :: {:ok, t()} | {:error, term()}

Validate a snapshot and check its agent ID against the storage key.