ExAgent.Tool.ResultStore behaviour (ExAgent v3.0.0)

View Source

Storage for the UTF-8 representation of a large tool return.

Stability — Candidate.

Configure ExAgent.Tool.OutputLimit with offload: {module, handle}. The runtime supplies the run ID and a fresh random reference on each write. Implementations must key reads by both, enforce bounded retention, detach slices, and return {:error, :expired} for missing or foreign keys. The supplied ETS implementation is ephemeral. The optional PostgreSQL implementation retains results across application restarts. References are ordinary text in history and can outlive a store. Treat stored results as private tool data.

Summary

Callbacks

Erase all results for one run in this store for ExAgent.Retention.erase/3.

Fetch the text for this run or report an expired or unavailable result.

Store the full text under the supplied run ID and unique reference.

Types

ref_id()

@type ref_id() :: String.t()

scope()

@type scope() :: String.t()

t()

@type t() :: {module(), term()}

Callbacks

erase_run(term, scope)

(optional)
@callback erase_run(term(), scope()) :: ExAgent.Retention.outcome() | {:error, term()}

Erase all results for one run in this store for ExAgent.Retention.erase/3.

fetch(term, scope, ref_id)

@callback fetch(term(), scope(), ref_id()) ::
  {:ok, String.t()} | {:error, :expired | :unavailable}

Fetch the text for this run or report an expired or unavailable result.

put(term, scope, ref_id, t)

@callback put(term(), scope(), ref_id(), String.t()) ::
  :ok | {:error, :too_large | :unavailable}

Store the full text under the supplied run ID and unique reference.