For the complete documentation index, see llms.txt. This page is also available as Markdown.

aiGateway

Resolves an IGateway instance by name — a gateway bx-ai ships in core, or one registered by an external gateway module.

Resolves an IGateway instance by name — a gateway bx-ai ships in core, or one registered by an external gateway module.

Syntax

aiGateway( name, options, register, module )

Parameters

Parameter
Type
Required
Default
Description

name

string

A core gateway name (mock, cli, http), a name registered in aiGatewayRegistry(), or a full class path

options

struct

{}

Configuration passed to the gateway's configure(). Shape is gateway-specific

register

boolean

false

Auto-register the constructed instance into aiGatewayRegistry(), same pattern as aiAgent()/aiTool()

module

string

""

Namespaces the registry key when register: true (name or name@module)

Returns

A configured IGateway instance.

Throws

GatewayNotSupported when the name matches no core gateway, nothing is registered under it, and it is not an instantiable class path.

Resolution Order

  1. Core gatewaysmock, cli, http

  2. Registered gateways — anything a module put in aiGatewayRegistry()

  3. Class path — the name is tried as a directly-instantiable class

  4. Otherwise GatewayNotSupported

Examples

Core Gateways

Presenting Approvals Through a Gateway

An Externally-Registered Gateway

Auto-Registering on Construction

Checking Capabilities

Events

Fires onGatewayCreate with { gateway } on every resolution path.

Last updated