# load

Loads a Cartesi machine instance from a previously stored directory, with optional runtime configuration. Returns a [CartesiMachine](/cm/api/cartesi-machine) instance. This is the main entry point for restoring a machine from a saved state.

## Function Signature

```ts
load(dir: string, runtimeConfig?: MachineRuntimeConfig): CartesiMachine
```

## Example

```ts twoslash
import { load, BreakReason } from "@deroll/cm";

// Load a machine from a previously stored directory
const machine = load("my-machine-snapshot");

// Run the machine until it yields or halts (default is MAX_MCYCLE)
const reason = machine.run();
if (reason === BreakReason.Halted) {
    console.log("Machine halted");
}
```
