Biosimulant runtimeWrite a lab.yaml

How to write a lab.yaml

lab.yaml composes models into a graph with shared runtime settings and explicit wiring. Keep a README.md beside it for the About content users see in Biosimulant.

Annotated example

schema_version: "2.0"
title: "Predator-Prey Ecosystem"
description: "Lotka-Volterra style toy composition"
 
models:
  - path: ../models/environment
    alias: env
    parameters:
      seed: 42
 
  - path: ../models/organism-population
    alias: rabbits
    parameters:
      name: Rabbits
      initial_count: 100
 
  - path: ../models/predation
    alias: predation
    parameters:
      predation_rate: 0.01
 
wiring:
  - from: env.conditions
    to:
      - rabbits.conditions
  - from: rabbits.population_state
    to:
      - predation.prey_state
 
runtime:
  duration: 100.0
  communication_step: 0.1
  settle_steps: 0

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.

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.

Key rules

  • runtime.communication_step is required and must be positive
  • runtime.settle_steps is optional, defaults to 0, and must be a non-negative integer
  • set input values when starting a run; persistent scalar defaults should be model or lab parameters when appropriate
  • the old external tick field is not supported
  • every model entry needs an alias and a relative path; validation rejects package or version on a model entry
  • model entries should not declare legacy per-module timing or ordering fields
  • wiring references use alias.port

For finite downstream report, export, or visualisation work, implement execute() with ExecutionPolicy.ONCE_AFTER_RUN; BioWorld drains any dependent chain automatically. Keep settle_steps only for legacy temporal modules that deliberately need zero-time propagation. Settling does not extend simulated time and does not invoke canonical modules.

Compose child labs

A child lab is a composed subgraph that a parent lab uses through explicit external ports.

Expose the child’s ports

schema_version: "2.0"
title: "E/I Microcircuit"
 
models:
  - path: ../../models/excitatory
    alias: exc
  - path: ../../models/inhibitory
    alias: inh
 
wiring:
  - from: exc.spikes
    to:
      - inh.input_spikes
 
runtime:
  duration: 1.0
  communication_step: 0.001
 
io:
  inputs:
    - name: external_current
      maps_to: exc.current
  outputs:
    - name: exc_spikes
      maps_to: exc.spikes

Without io, the child lab has no external ports for parent wiring.

Reference the child from the parent

children:
  - path: ../ei-microcircuit
    alias: circuit_a
    parameters: {}
 
wiring:
  - from: stim.current
    to:
      - circuit_a.external_current

A child uses either path or package + version, not both. The old lab_id form is rejected.

How children are flattened

During execution, Biosimulant flattens child labs with the same rules as the open-source biosimulant runtime. Child model aliases are scoped as child_alias.model_alias, and parent wiring references to child_alias.external_port_name are remapped through the child lab’s io.maps_to contract. Child lab nesting is limited to depth 5, circular child references are rejected, and unresolved child labs fail validation/execution instead of being silently skipped.

Package-backed child Labs require a sibling biosimulant.lock entry with the same package, exact version, and the Hub archive’s artifact_sha256. See Compose Hub labs locally.

Validate

biosimulant labs validate ./my-lab

To validate and build release packages, see Package and publish.

Next steps