This example turns a human-written run.yaml into a content-addressed lock,
checks the lock, and proves that compiling through it produces the same
ExecutionPlan.
What a lock protects
A Run lock records the fully resolved plan, selected component versions,
resource locations, and SHA-256 digests. Use it when a successful run must be
repeated later or on another controlled machine. Editing run.yaml, changing a
component selection, or changing a locked asset makes verification fail instead
of silently running something different.
The lock is generated output. Do not edit it by hand.
Prerequisites
- Python 3.11 or 3.12
- FastSim
0.1.0a6 - No simulator is started by this example
From this directory, run:
python main.py
Expected result:
Valid: True
Same plan: True
The generated lock is written to output/run.lock.yaml. The output/
directory is intentionally ignored by Git.
Code flow
project = load_project(RUN_FILE)
Finds .fastsim/project.yaml, which defines the trusted demo registry.
compiler = project.compiler()
compiled = compiler.compile_file(RUN_FILE)
Resolves the readable configuration into one immutable plan.
compiled.write_lock(LOCK_FILE)
Writes the plan and its resource integrity data atomically.
verification = compiler.verify_lock(LOCK_FILE)
Checks the lock structure, plan digest, and every referenced local resource.
locked = compiler.compile_locked(RUN_FILE, LOCK_FILE)
Compiles the Run only if the current configuration still matches the accepted lock.
The equivalent CLI commands are:
fastsim config lock run.yaml --output output/run.lock.yaml
fastsim config verify-lock output/run.lock.yaml
fastsim run run.yaml --lock output/run.lock.yaml --duration 3
The last command starts Isaac Lab and therefore requires the matching backend adapter. The Python example deliberately checks reproducibility without paying simulator startup cost.
Verification level
Automated: Python compilation, Run compilation, lock write, integrity verification, and locked recompilation. No native simulator is required.