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
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
Core gateways —
mock,cli,httpRegistered gateways — anything a module put in
aiGatewayRegistry()Class path — the name is tried as a directly-instantiable class
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.
Related
Last updated