ExAgent.Continuation.Recovery.Policy (ExAgent v3.0.0)

View Source

Versioned decisions for supervised recovery of an uncertain continuation.

Stability — Stable.

Version 1 closes model-only uncertainty by default. It can prepare one linked retry for a declared read, or look up a write's outcome by its saved key. Settling a write requires its declared reconciler and confirmed evidence. An unresolved callback, deferral, or write without a matching lookup stays in the inbox. All operations still require authorization.

Summary

Functions

Build the versioned policy for Continuation.Recovery. With no options, model-only uncertainty closes as :cancelled with its evidence intact.

Bind a custom unary decision function to a versioned policy reference. See ExAgent.Continuation.Recovery for the decision actions and context. Change the version when the function's decisions change.

Types

model_resolver()

@type model_resolver() :: (resolver_context() -> {:ok, ExAgent.t(), map()} | nil)

resolver_context()

@type resolver_context() :: %{
  namespace: String.t(),
  effect: ExAgent.Continuation.effect_summary()
}

t()

@opaque t()

tool_resolver()

@type tool_resolver() :: (resolver_context() -> ExAgent.Tool.t() | nil)

Functions

default(opts \\ [])

@spec default(keyword()) :: t()

Build the versioned policy for Continuation.Recovery. With no options, model-only uncertainty closes as :cancelled with its evidence intact.

  • :model accepts :cancel (default), :leave, or {:retry, resolver}. Selecting retry explicitly accepts possible duplicate provider spend. The resolver returns the effect's trusted agent and continuation binding as {:ok, agent, binding}, or nil. A linked retry uses the saved key when present and otherwise uses the effect ID. A lost retry remains in the inbox. Use a catalogue in place of the resolver to select an exact saved effect leaf.
  • :resolve_tool optionally returns the trusted Tool that matches the saved effect's leaf and name, or nil. ExAgent checks the persisted tool fingerprint and asks the authorizer before invoking its reconciler. A catalogue resolves the exact leaf and selects the tool by name.

Resolvers receive the trusted Store namespace and effect metadata. Use the namespace to choose tenant-specific bindings. Keep the lookup read-only and bounded. The policy never invokes the tool's write callable.

new(reference, decide)

Bind a custom unary decision function to a versioned policy reference. See ExAgent.Continuation.Recovery for the decision actions and context. Change the version when the function's decisions change.