Skip to content

angee.agents.backends

Inference backend protocol and the bundled built-in backend.

An inference provider row selects one backend via backend_class. Vendor backend addons (openai, anthropic, …) wrap official SDK clients and list models live; the built-in manual backend has no client and leaves the catalogue hand-curated.

InferenceModelSpec

python
@dataclass(frozen=True, slots=True)
class InferenceModelSpec()

One model a backend advertises, in the shape InferenceModel rows carry.

Empty/zero optional fields let the upsert preserve richer hand-entered or seeded metadata instead of overwriting it on a live refresh.

upsert_defaults

python
def upsert_defaults() -> dict[str, Any]

Return the InferenceModel upsert defaults this spec contributes.

Empty/zero optional fields are omitted so a live refresh preserves richer hand-entered or seeded metadata instead of overwriting it.

InferenceRequest

python
@dataclass(frozen=True, slots=True)
class InferenceRequest()

Provider-neutral request for one non-streaming chat completion.

InferenceResponse

python
@dataclass(frozen=True, slots=True)
class InferenceResponse()

Provider-neutral response returned by a backend chat call.

InferenceBackend

python
class InferenceBackend(ImplBase)

The strategy one inference provider resolves to.

Subclasses read the API credential, endpoint, and config directly from the provider row that selected them.

__init__

python
def __init__(provider: Any) -> None

Bind this backend to its provider row.

connect_oauth_client

python
def connect_oauth_client(owner_label: str) -> Any

Return the enabled OAuth client this backend connects its provider through.

The backend's oauth_client hint is the only source; an empty hint is not connectable. The bound provider's vendor slug feeds the {vendor} template.

list_models

python
def list_models() -> Sequence[InferenceModelSpec]

Return the provider's advertised models for catalogue upsert.

chat

python
def chat(request: InferenceRequest) -> InferenceResponse

Send one non-streaming chat request through this provider.

ManualInferenceBackend

python
class ManualInferenceBackend(InferenceBackend)

Built-in backend with no client — its catalogue is curated by hand.

The default registry entry: a provider on this backend lists no models to sync, so its :class:InferenceModel rows are entered through the console. A vendor backend addon supplies the live-listing alternative.

list_models

python
def list_models() -> Sequence[InferenceModelSpec]

Return no models; the catalogue is maintained by hand on this backend.

Released under the AGPL-3.0 License.