ExAgent.RequestError (ExAgent v2.2.0)

View Source

Structured error returned by providers for transport/API failures.

Every provider wraps failures in this struct so callers can pattern-match on a single shape instead of opaque tuples. ExAgent.run/3 surfaces it (wrapped in {:error, {:model_request_failed, %RequestError{}}}) rather than raising.

transport is set (for example to :econnrefused, :closed or :timeout) when the connection failed without an HTTP response; it is nil otherwise.

Summary

Types

t()

@type t() :: %ExAgent.RequestError{
  body: term() | nil,
  model: struct() | nil,
  partial_response: ExAgent.Message.Response.t() | nil,
  provider: atom(),
  reason: atom() | tuple(),
  status: pos_integer() | nil,
  transport: atom() | nil
}