Skip to main content
All MuBit SDKs (Python, Node.js, Rust) share a consistent configuration model based on environment variables and constructor options.

Environment variables

VariableRequiredDefaultDescription
MUBIT_API_KEYyesAPI key in format mbt_<instance>_<key_id>_<secret>
MUBIT_ENDPOINTnohttps://api.mubit.aiBase endpoint for both HTTP and gRPC (SDK resolves protocol automatically)
MUBIT_TRANSPORTnoautoTransport selection: auto, http, or grpc
MUBIT_HTTP_ENDPOINTnohttps://api.mubit.aiOverride HTTP-specific endpoint
MUBIT_GRPC_ENDPOINTnogrpc.api.mubit.ai:443Override gRPC-specific endpoint
When MUBIT_ENDPOINT is set, it serves as the default for both HTTP and gRPC. The protocol-specific overrides (MUBIT_HTTP_ENDPOINT, MUBIT_GRPC_ENDPOINT) take precedence when set.

Transport selection

The transport option controls how the SDK communicates with MuBit:
ValueBehavior
auto (default)SDK probes the endpoint and selects gRPC if available, falling back to HTTP
httpForce HTTP/REST transport
grpcForce gRPC transport
from mubit import Client

# Auto transport (default)
client = Client(api_key="mbt_...")

# Force gRPC
client = Client(api_key="mbt_...", transport="grpc")

# Force HTTP with custom endpoint
client = Client(
    api_key="mbt_...",
    transport="http",
    endpoint="https://custom.api.mubit.ai",
)

Endpoint defaults

ContextHTTP endpointgRPC endpoint
Hosted (production)https://api.mubit.aigrpc.api.mubit.ai:443
Hosted (dev)https://api.dev.mubit.aigrpc.api.dev.mubit.ai:443
Localhttp://127.0.0.1:3000127.0.0.1:50051
Both hosted endpoints use TLS. Local endpoints are plaintext by default.

Constructor options

Beyond environment variables, SDK constructors accept these options:
OptionTypeDescription
api_keystringAPI key (overrides MUBIT_API_KEY)
endpointstringBase endpoint (overrides MUBIT_ENDPOINT)
transportstringTransport selection (overrides MUBIT_TRANSPORT)
run_idstringDefault run ID for all operations
agent_idstringDefault agent ID
user_idstringDefault user ID for scoping

Resolution order

Configuration resolves in this order (first wins):
  1. Explicit constructor argument
  2. Protocol-specific env var (MUBIT_HTTP_ENDPOINT / MUBIT_GRPC_ENDPOINT)
  3. Base env var (MUBIT_ENDPOINT)
  4. Built-in default (https://api.mubit.ai)

Next steps