AgentSea.Gateway.Router behaviour (agentsea_gateway v0.1.0)

Copy Markdown

Routing-strategy behaviour. A strategy orders the available candidates; the gateway then tries them in that order, failing over to the next when one errors. Strategies are pure — they receive the candidates and a context (:counter, live :health) and return a reordered list.

Summary

Types

A configured provider candidate.

Types

candidate()

@type candidate() :: %{
  :name => term(),
  :module => module(),
  :model => String.t(),
  optional(:opts) => keyword()
}

A configured provider candidate.

ctx()

@type ctx() :: %{optional(:counter) => non_neg_integer(), optional(:health) => map()}

Callbacks

order(list, ctx)

@callback order([candidate()], ctx()) :: [candidate()]