ExAgent.Models.Test (ExAgent v2.2.1)

View Source

A deterministic, in-process model for development and tests.

Drop-in replacement for a real provider: it never hits the network and returns scripted (or default) Message.Responses. This is the workhorse that lets the agent loop be developed and unit-tested offline.

Configuration:

  • %Test{} — always replies with a generic text response.
  • %Test{label: "x"} — replies with the fixed string "x" as text.
  • %Test{script: [...]} — returns each item in order; an item may be a Message.Response, a string (wrapped as a text part), a {:tool_calls, [ToolCall]} tuple, or a function fn messages, params -> item.

An initially empty script uses the label or generic response. A nonempty script must cover every expected model request, including requests after tools and corrective output. Exhausting it fails the request; it does not silently supply a generic response. Two-argument functions receive the message list and parameters.

Summary

Types

script_item()

t()

@type t() :: %ExAgent.Models.Test{
  index: non_neg_integer(),
  label: String.t() | nil,
  received: [term()],
  script: [script_item()]
}