MingaAgent.InferenceRoute behaviour (minga_sdk v0.1.0)

Copy Markdown View Source

Contract for a contributed model route that supplies model streams to Minga's native agent loop.

A route produces model output only. Minga runs every tool, approval, retry, compaction, and history step. A route never executes a tool. The contract uses only Minga-owned values, so it stays stable when Minga changes its internal model library.

This is a compile-time stub. At runtime, the real behaviour in Minga's BEAM VM is used.

Summary

Types

availability()

@type availability() ::
  {:ready, account_label :: String.t()}
  | {:unavailable, reason :: atom(), remedy :: String.t()}

error_kind()

@type error_kind() ::
  :auth_failed
  | :rate_limited
  | :unreachable
  | :invalid_model
  | :context_transition_required
  | :request_admission_refused
  | :provider_error
  | :tool_error
  | :internal_error
  | :unknown

route_credential()

@type route_credential() :: MingaAgent.InferenceRoute.Credential.t() | nil

Callbacks

availability(route_id, credential)

@callback availability(route_id :: String.t(), credential :: route_credential()) ::
  availability()

classify_error(term)

@callback classify_error(term()) :: {error_kind(), message :: String.t()}

models(config)

@callback models(config :: keyword()) :: [MingaAgent.InferenceRoute.Model.t()]

stream(t)

@callback stream(MingaAgent.InferenceRoute.Request.t()) ::
  {:ok, MingaAgent.InferenceRoute.Response.t()} | {:error, term()}