Skip to content

MachinaRuntime

MachinaRuntime is the headless façade used by the MCP server and other non-agent entry points. It owns a ConnectorRegistry and exposes connector lookup by name or by capability without dragging in the LLM, channels, or workflow engine that Agent carries.

Use Agent for conversational and workflow-driven scenarios. Use MachinaRuntime when you want to expose connector capabilities to an external orchestrator (MCP, custom server, batch script) and the LLM lives outside Machina.

MachinaRuntime

MachinaRuntime(*, connectors: dict[str, BaseConnector] | None = None, sandbox_mode: bool = False, primary_cmms_name: str = '')

Runtime facade for connector lifecycle and capability routing.

Parameters:

Name Type Description Default
connectors dict[str, BaseConnector] | None

Named connector instances.

None
sandbox_mode bool

If True, write operations should be blocked.

False
primary_cmms_name str

Name of the connector marked primary: true.

''
Example
runtime = MachinaRuntime.from_config(config)
await runtime.connect_all()
cmms = runtime.get_primary_cmms()
assets = await cmms.read_assets()
await runtime.disconnect_all()

from_config classmethod

from_config(config: MachinaConfig) -> MachinaRuntime

Build a runtime from a MachinaConfig, instantiating connectors.

connect_all async

connect_all() -> None

Connect all registered connectors.

Failed connectors are recorded in self.failed_connectors and logged at ERROR level. The runtime continues with healthy connectors.

disconnect_all async

disconnect_all() -> None

Disconnect all registered connectors.

get_primary_cmms

get_primary_cmms() -> BaseConnector

Return the primary CMMS connector.

If a connector is marked primary: true in config, it is returned. Otherwise falls back to the first connector that supports READ_ASSETS and logs a warning.

Raises:

Type Description
ConnectorError

If no CMMS connector is configured.

find_by_capability

find_by_capability(capability: Capability) -> list[tuple[str, BaseConnector]]

Find all connectors supporting a given capability.