ExAgent. Catalog
(ExAgent v3.0.0)
View Source
Trusted, versioned definitions for resuming and recovering persisted runs.
Stability — Stable.
Build a catalogue in the host for the authorized namespace. Keep every definition version that can still have open work. A lookup selects the exact reference and checks the policy and model references when supplied. The catalogue is host configuration and contains executable code. Workflow entries and handoff policy bindings retain the candidate tier of those integrations.
Summary
Functions
Return {:ok, catalogue} when a host callback returns a catalogue and
:error for other terms. Use resolve/2 to check its saved definition
and bindings.
Derive a versioned definition reference for a durable agent.
Build a catalogue from {reference, agent, binding, tools} entries.
The shorthand {reference, agent, binding} uses the agent's declared tools.
Each definition reference must be unique. The binding contains the matching
:definition, :policy, :model_ref and :model_codec, and may include
:rehydrate_tools and :max_checkpoint_bytes. Supply run IDs, Store scopes
and execution options to the operation using the catalogue.
Resolve an exact definition reference or the identity reported for a run
or effect leaf. The lookup checks every supplied binding field and reports
{:definition_unavailable, ref} for an absent version or
{:definition_incompatible, field} for a mismatched binding. It does
not run a model, tool, or codec.
Types
@type agent_entry() :: %{ kind: :agent, agent: ExAgent.t(), binding: map(), tools: %{required(String.t()) => ExAgent.Tool.t()}, handoff_policies: %{required(String.t()) => definition_ref()} }
@type definition_ref() :: ExAgent.Continuation.versioned_reference()
@type entry() :: agent_entry() | workflow_entry()
@type identity() :: %{ optional(:handoff_policies) => %{required(String.t()) => definition_ref()}, :definition => definition_ref(), optional(:kind) => :agent | :composition | :flow, optional(:policy) => definition_ref(), optional(:model_ref) => definition_ref() | nil }
@opaque t()
@type workflow_entry() :: %{ kind: :composition | :flow, workflow: ExAgent.Coordination.Composition.t() | ExAgent.Coordination.Flow.t(), binding: map(), handoff_policies: %{} }
Functions
Return {:ok, catalogue} when a host callback returns a catalogue and
:error for other terms. Use resolve/2 to check its saved definition
and bindings.
@spec fingerprint(keyword()) :: {:ok, definition_ref()} | {:error, term()}
Derive a versioned definition reference for a durable agent.
Supply :id, :agent, the :policy and :model_ref references, and the
:model_codec used by the continuation. Pass the turn's :permissions
and optional :rehydrate_tools when they are configured.
The version hashes a canonical JSON description of the declared inventory (including capability tools), output, handoffs, agent name, model settings, rate limiter, usage limits, step and retry limits, tool timeout, retention limits, policy, model binding and codec. Model settings use JSON-portable data. Functions contribute their module, name and arity. Keep the versioned policy or model reference current for behavior changes inside the same function, including changes to captured values. The fingerprint does not call tools, output functions or the codec, or send model requests.
codec = ExAgent.Models.ReqLLM.codec()
policy = %{"id" => "review-policy", "version" => "1"}
model = %{"id" => "review-model", "version" => "1"}
ExAgent.Catalog.fingerprint(id: "review", agent: agent, policy: policy,
model_ref: model, model_codec: codec)
@spec new([ {definition_ref(), ExAgent.t(), map()} | {definition_ref(), ExAgent.t(), map(), [ExAgent.Tool.t()]} | {definition_ref(), ExAgent.Coordination.Composition.t() | ExAgent.Coordination.Flow.t(), map()} ]) :: t()
Build a catalogue from {reference, agent, binding, tools} entries.
The shorthand {reference, agent, binding} uses the agent's declared tools.
Each definition reference must be unique. The binding contains the matching
:definition, :policy, :model_ref and :model_codec, and may include
:rehydrate_tools and :max_checkpoint_bytes. Supply run IDs, Store scopes
and execution options to the operation using the catalogue.
The separately indexed tools are for host lookups such as write
reconciliation. The agent still runs with its own definition and bindings.
A Composition or Flow root can use {reference, workflow, binding}
with its definition and policy. Resolve it using the details from
Continuation.get/2 before calling the respective workflow's resume.
@spec resolve(t(), definition_ref() | identity()) :: {:ok, entry()} | {:error, {:definition_unavailable, definition_ref()} | {:definition_incompatible, atom()}}
Resolve an exact definition reference or the identity reported for a run
or effect leaf. The lookup checks every supplied binding field and reports
{:definition_unavailable, ref} for an absent version or
{:definition_incompatible, field} for a mismatched binding. It does
not run a model, tool, or codec.