Skip to content

Scenario Runner (YAML → Execution)

Status & scope

  • Module: lens/scenario.py
  • Milestone: Phase 3

Purpose

Generic executor: scenario YAML in → lens execution → evidence + HTML out. The LLM generates the YAML, the framework executes it. No custom demo code per scenario.

Scenario YAML Format

scenario:
  name: "Covert Movement Portland → Ashland"
  intent: "Route 600km avoiding adversary optical sensors"
  classification: SECRET

area_of_operations:
  bbox: [42.0, -123.5, 46.0, -121.0]
  resolution_m: 5000

data_sources:
  roads:
    type: osm
    path: "dataspace/graphs/oregon_major.graph"
  satellites:
    type: tle
    paths: ["data/tle/planet.tle", "data/tle/weather.tle"]
    swath_width_km: 30
    max_sats: 40
  coverage:
    type: cached
    path: "dataspace/coverage/baseline_24h.json"

lens:
  lens_id: sat_avoidance_v1
  type: traversal
  layers:
    - name: roads
      weight: 0.25
      source: roads
      cost_model: passthrough
    - name: satellite
      weight: 0.50
      source: coverage
      cost_model: linear_scale
      params: { max_cost: 8.0 }
    - name: terrain
      weight: 0.15
      source: dem
      cost_model: linear_scale
    - name: threat
      weight: 0.10
      source: threat_overlay
      cost_model: linear_scale

route:
  origin: { name: "Portland OR", lat: 45.52, lon: -122.68 }
  destination: { name: "Ashland OR", lat: 42.47, lon: -122.71 }

coas:
  - name: "COA 1: FAST"
    weights: { roads: 0.80, satellite: 0.05, terrain: 0.10, threat: 0.05 }
  - name: "COA 2: CONCEALED"
    weights: { roads: 0.20, satellite: 0.50, terrain: 0.15, threat: 0.15 }
  - name: "COA 3: BALANCED"
    weights: { roads: 0.40, satellite: 0.35, terrain: 0.15, threat: 0.10 }

output:
  html: true
  geotiff: false
  evidence: true

Public API

run_scenario(yaml_path) → ScenarioResult

  • Parse scenario YAML.
  • Load data sources (from dataspace or compute).
  • Build mobility surface with layers.
  • Route each COA.
  • Compare COAs.
  • Generate output (HTML, evidence).

ScenarioResult

Field Type
scenario_name str
coa_results list[COAResult]
comparison COAComparison
evidence_block EvidenceBlock
html_path str (if generated)
execution_time_s float

File Layout

lens/
  scenario.py          ← run_scenario(), ScenarioResult

Integration Points

  • Cortex: LLM generates scenario YAML → run_scenario() executes
  • Beacon: HTML output renders in monitor page or opens standalone
  • component.prism.operational-lifecycle: Uses dataspace for cached data sources

DO NOT

  • Hardcode scenarios in Python — everything from YAML
  • Build a UI for scenario editing — LLM or human writes the YAML
  • Execute without evidence — every scenario produces frozen blocks

Depends on: component.prism.mobility-surface, component.prism.operational-lifecycle, component.prism.scoring-engine, component.prism.universal-lens-parser