ExAgent.Compaction.Memo (ExAgent v3.0.0)

View Source

A bounded, host-supervised store that lets ExAgent.Compaction.Summary reuse its last summary instead of summarizing on every request.

Stability — Candidate.

children = [{ExAgent.Compaction.Memo, name: MyApp.CompactionMemo, max_entries: 2_000}]

%ExAgent.Compaction.Capability{
  compactor: ExAgent.Compaction.Summary,
  opts: [summarize: &my_summarize/1, memo: MyApp.CompactionMemo]
}

Each entry holds one summary text and a SHA-256 digest of the messages it replaced, keyed by a digest of the conversation's first message. Conversations with the same first message share an entry. Reuse requires the covered messages to match at the same positions and to remain the earliest messages eligible for summarization. Callers sharing the store can then receive the same summary even if their summarizers differ. Use a separate store for each summarization policy and version. When :max_entries (default 1024) is exceeded, the oldest conversation is evicted. Entries live in memory only: after a restart the next compaction summarizes once and stores a new entry. Summaries can contain conversation content; size the store, and its process ownership, like any other in-memory cache of it.

Summary

Functions

Returns a specification to start this module under a supervisor.

Number of stored conversations.

Start the store with optional :name and :max_entries (a positive integer). Unknown or duplicate options raise ArgumentError before the store starts.

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

size(memo)

Number of stored conversations.

start_link(opts \\ [])

Start the store with optional :name and :max_entries (a positive integer). Unknown or duplicate options raise ArgumentError before the store starts.