Biosimulant runtimelab.yaml schema

lab.yaml Schema

lab.yaml describes a composed simulation: model instances, wiring, runtime, and optional child labs.

Put a README.md beside each root or owned child lab.yaml. Biosimulant shows it in the lab About view and falls back to generated details from lab.yaml when it is missing. Keep README images under assets/ and reference them with relative paths such as ![Run results](assets/results.png), not base64.

Schema

schema_version: "2.0"
title: string
description: string
 
models:
  - path: string
    alias: string
    parameters: object
 
wiring:
  - from: string
    to:
      - string
 
runtime:
  duration: number
  communication_step: number
  settle_steps: number
  environment: object  # optional; see Lab environment
 
io:
  inputs:
    - name: string
      maps_to: string
  outputs:
    - name: string
      maps_to: string
 
children:
  - path: string
    alias: string
    parameters: object
  - package: string
    version: string
    alias: string
    parameters: object
    # A matching biosimulant.lock entry is required.

CPU/GPU requirements for managed runs

Before creating or updating a Lab, discover live profiles with the MCP tool compute_profile_list (or GET /v1/compute-profiles). Read authoring topic compute through get_biosimulant_authoring_contract for the enforced contract. Declare requirements separately from a recommended profile:

hardware:
  compute:
    device: gpu
    cpu_cores: 4.0
    memory_mb: 16384
    gpu_count: 1
    recommended_profile: gpu-t4

device is required inside hardware.compute: cpu means CPU-only, gpu requires GPU allocation, and either declares support for both. For a CPU Lab, use device: cpu and omit gpu_count and gpu_type. cpu_cores is a positive, finite minimum allocation; memory_mb is positive integer minimum host RAM in MiB, and gpu_count is a positive integer minimum count for GPU profiles. Optional gpu_type requires an exact catalog GPU type. recommended_profile is an advisory catalog name, not a hard requirement. Unknown compute fields, invalid minima and contradictory CPU/GPU declarations block managed validation.

Aggregate component requirements into the Lab declaration and reassess them when updating components, dependencies or the workload. A CUDA-only component requires gpu; use either only when both execution paths work. Update the manifest through an approval-bound immutable revision. These declarations are enforced for managed runs; local host capability checks remain separate. CPU processor models and GPU VRAM minimums are not currently selectable or enforceable and must not be claimed.

Pass a discovered item id as compute_profile_id to MCP run_prepare, POST /v1/run-plans, or each experiment arm. Explicit selection overrides the recommendation but must satisfy requirements; unavailable or incompatible explicit profiles are never silently replaced. Omitting the ID uses a compatible recommendation, then the compatible default/catalog order. Legacy Labs retain their existing default behavior. Discovery reports configuration and account access, not guaranteed live capacity.

Packages from outside PyPI and CUDA base images are described by reference in runtime.environment; see Lab environment.

Review the prepared profile, provider, CPU, RAM, GPU type/count, timeout and provider-cost estimate before approval. Provider selection is controlled by the platform. Users need no Modal account or local repository. A hardware or provider configuration change after preparation invalidates the approval.

Runtime

runtime.communication_step is required and must be positive. runtime.settle_steps is optional, must be a non-negative integer, and defaults to 0.

runtime:
  duration: 10.0
  communication_step: 0.1
  settle_steps: 0

Set input values at run time through the run modal or run payloads. Use parameters for persistent scalar defaults that belong in the lab manifest.

Finite downstream report, export, or visualisation modules should implement execute() with ExecutionPolicy.ONCE_AFTER_RUN. BioWorld drains arbitrary chains of those modules automatically after the final simulation boundary. settle_steps remains available for legacy temporal modules that deliberately need zero-time propagation. Settling does not extend simulated time and does not invoke canonical modules.

The old external tick field is not supported.

Execution timing

Biosimulant sorts a lab into one of three timings using the biosim.execution_policy each model declares in its model.yaml (see Execution policy). The timing tells tools whether duration, communication step and settle steps matter for a run.

TimingWhenRun settings
finiteEvery model declares a policy and none declares each_windowStudio, Desktop and biosimulant labs serve hide duration, communication step and settle steps when you run the lab
temporalAt least one model declares each_windowShown
unknownNo model declares each_window and at least one model doesn’t declare a policyShown

Timing only changes which settings the Run dialog shows. The runtime block keeps the same rules for every lab:

  • runtime.communication_step is still required in lab.yaml, and biosim.communication_step is still required in each model.yaml.
  • runtime.duration must stay positive. A zero-duration run only sets modules up, so run-once modules never run.

When no module runs each window, BioWorld crosses the whole run in one step instead of stepping through empty communication windows. Before-run modules run at the start and after-run modules run at the end, as before.

A lab can’t override a model’s policy. You can mix policies in one lab, but data can only move forward through the phases:

Source policyCan feed
once_before_runAny policy
each_windoweach_window or once_after_run
once_after_runonce_after_run only

Modules that run once can’t form a cycle. Cycles between each_window modules are still allowed.

When you validate a lab source directory, biosimulant labs validate prints the lab’s timing, names any models that don’t declare a policy, and reports invalid wiring between models that do. With --json, the timing is under metadata.execution. A package-backed child lab counts as undeclared.

Run input files

biosimulant labs run --run-input-file inputs.json overrides runtime values, initial inputs and model parameters for one run without changing lab.yaml. The file is a JSON object with optional parameters and simulation_config keys, the same shape Studio and Desktop send:

{
  "simulation_config": {
    "runtime": {
      "duration": 20.0,
      "initial_inputs": { "stimulus": 1.5 }
    }
  },
  "parameters": {
    "neuron": { "gain": 2.0 }
  }
}
  • Runtime values (duration, communication_step, settle_steps) can go under simulation_config.runtime or directly under simulation_config. If both are set, simulation_config.runtime wins.
  • Initial inputs can go under simulation_config.runtime.initial_inputs, simulation_config.initial_inputs or parameters.initial_inputs, merged in that order so a later location wins. Use a public lab input name or an alias.port reference as the key.
  • Model parameters can be keyed by alias, as parameters.<alias> or parameters.per_model.<alias>. They’re merged onto that model’s parameters in lab.yaml.

Models

Each models[] entry creates one module instance in the lab.

FieldMeaning
pathRelative path to a local model directory
aliasUnique name used in wiring
parametersConstructor overrides merged into biosim.init_kwargs

Model entries use path only. Validation rejects package or version on a model entry. To reuse a published Lab, add it under children.

Current-kernel labs should not declare per-entry timing or ordering fields. Promote model-specific configuration to parameters, and expose runtime values as typed io.inputs.

Wiring

Connections use alias.port references:

wiring:
  - from: retina.visual_stream
    to:
      - lgn.retina
  - from: lgn.thalamus
    to:
      - sc.vision

Fan-out is supported by listing multiple destinations under to.

Composability

Expose lab-level ports with an io block:

io:
  inputs:
    - name: stimulus
      maps_to: neuron.current
  outputs:
    - name: spike_train
      maps_to: recorder.spikes

Parent labs wire to child_alias.external_port_name.

Nested child labs

children:
  - path: ../labs/microcircuit
    alias: circuit_a
    parameters: {}

Children can be addressed in wiring just like models:

wiring:
  - from: stim.current
    to:
      - circuit_a.stimulus

Package-backed child Labs use an exact package + version and require a matching entry in the sibling biosimulant.lock with artifact_sha256. The archive is verified and resolved into the parent Lab’s .biosimulant/dependencies/ state. Path-backed children remain supported for existing self-contained Labs. See Compose Hub labs locally.

For portable local package builds, prefer path-based children. Package-backed children always need an explicit version; they never fall back to latest.

See also

Environment preparation

runtime.setup.command is an optional nonempty argument list run before Lab dependencies and model imports. runtime.setup.timeout_seconds defaults to 900 and accepts 1–3600. python selects the Lab interpreter. Inline Python and optional files are supported. See Lab environment for lifecycle, portability, permissions, locks and runner support.