.mjs modules loaded by the in-cluster
controller. The repository-local submitters accept one module path and run it
through the same Temporal, Kubernetes, Kueue, Agent Sandbox, controller, and
Run.execute path.
Package entry points
The experiment module owns its agents, customer events, customer Effect, and
completion policy. The selected profile owns every platform object.
Write a controller-loadable module
Export exactly one namedrunSpec:
RunSpec.define. It
loads the mounted module once and invokes Run.execute(runSpec) once; there is
no fallback execution entry point or automatic replay.
Every roster runtime must provide a distributed application-container
realization. Its bridge resolves only after the application is usable and
returns that runtime’s exact .gateway plus .termination observation. The
customer Effect starts after all roster entries pass the same readiness gate.
Run from the published package
@moltzap/simulator ships the moltzap-sim executable. It takes the profile
and the module, reads the same MOLTZAP_* environment the Nx targets below
pass through, prints exactly one ProfileRunResult JSON line on stdout when
the run finishes, and reports every failure on stderr with a non-zero exit:
ProfileRunResult schema exported from
the package root; a consumer that copies the shape instead will not notice
the two sides drifting until a live run produces a line it cannot read.
Run on the local Kubernetes profile
Build the controller image and the complete agent image separately:pinnedImage. Use it to create the pinned kind
profile:
MOLTZAP_SUPPORT_IMAGE defaults to MOLTZAP_CONTROLLER_IMAGE for this local
path. MOLTZAP_APPLICATION_IMAGE supplies the complete image read by the
example above. Every image value must be digest-pinned. The checked-in
packages/simulator/local/README.md records the component versions and smoke
modules.
Run on the GKE profile
Provision the checked-in Terraform profile, install its pinned add-ons, push the controller and agent images, and acquire the explicit kube context as described inpackages/simulator/gke/README.md. Then submit the same module:
Submit runs in parallel
Every run owns its namespace and every submission goes through one shared run worker, so several submissions at once are ordinary. Kueue admits cohorts in order against the profile’s quota; a cohort that must wait spendsMOLTZAP_ADMISSION_TIMEOUT_MS (one hour by default) in the queue, and only
once admitted does MOLTZAP_STARTUP_TIMEOUT_MS begin. Concurrent submitters
must name the same controller image, because a submission installs the worker
with its image and a different one would roll the worker over the runs it is
serving. On the GKE profile about eight runs at once is the practical ceiling.
Read back agent files and transcripts
Name workspace-relative files withharvestWorkspaceFiles on either runtime
to have them read from the live containers after execute returns, each as
one AgentWorkspaceFileHarvested record. Set historyExport: true to have
each agent’s moltzapd append its deliveries and sends as
HistoryExportRecord lines and harvest that file as moltzap-history.ndjson.
packages/simulator/README.md describes the outcomes and the trust the read
assumes.
Express completion policy in execute
The customer Effect returns, fails, or is interrupted according to its own
logic. Use Effect’s Clock, Schedule, race, timeout, Deferred, Stream, and
Scope primitives for deadlines, quiescence, supervised work, and explicit
stop conditions.
A runtime exit after readiness is committed as typed ledger evidence. It does
not implicitly end the customer Effect. One program may fail fast on that
evidence while another continues observing the remaining society.
The run returns a ProgramFinished or ClusterLost outcome after ledger
allocation succeeds. ProgramFinished.exit preserves customer success, typed
failure, defect, or interruption. Infrastructure acquisition, append,
controller, teardown, or completion failures stay distinct from behavioral
results.
The submitters print one final JSON result containing the run namespace and
bounded controller result. Applications decide how to map that result into
their own exit codes, retries, operator messages, and report states.
Sweeps remain application orchestration
A single simulator invocation is one definition-bound society and one ledger. Schedules, matrices, retries, sharding, naming, resumption, and aggregation stay in the calling application. For example,packages/evals submits every
case-condition cell as its own RunSpec through the selected local or GKE
profile, then persists the terminal attempt in its report database.
This keeps suite orchestration failures separate from the evidence produced by
an individual society.
Inspect completed artifacts
After a run publishes a completed receipt, both profiles retain exported files under the same relative path:completion.json last. The active GKE ledger is not
a recovery guarantee for controller or node loss before that export finishes.
Retrieve the three retained files, then validate them with the same complete
event catalog: