AGENT SKILL

scenario-studio

Define, generate, inspect, and troubleshoot SMARTS scenarios from supported maps, traffic, missions, social agents, bubbles, surface patches, traffic histories, and metadata. Use this route when the task is scenario DSL or generated scenario layout; route live SUMO/TraCI, Envision replay, or environment lifecycle elsewhere.

License 许可
MIT
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
scenario-studio
license
MIT
metadata
{ "disco-role": "operating" }
description
Define, generate, inspect, and troubleshoot SMARTS scenarios from supported maps, traffic, missions, social agents, bubbles, surface patches, traffic histories, and metadata. Use this route when the task is scenario DSL or generated scenario layout; route live SUMO/TraCI, Envision replay, or environment lifecycle elsewhere.
disable-model-invocation
true

02 资源文件 7

03 SKILL.md 正文

Scenario Studio

Use this route when you need a self-contained SMARTS scenario definition or need to explain why generated scenario artifacts are missing or incompatible. The runtime DSL is smarts.sstudio.types (smarts.sstudio.sstypes is the implementation module) and the high-level entry point is smarts.sstudio.genscenario.gen_scenario(scenario, output_dir, seed=42).

Decide the boundary first

  • Use Scenario from smarts.sstudio.types for the authoring DSL. It combines map_spec, named traffic, ego_missions, social_agent_missions, bubbles, friction_maps, traffic_histories, and scenario_metadata.
  • Use the runtime smarts.core.scenario.Scenario only after generation, when SMARTS discovers a map and build/ assets. It is not the authoring dataclass.
  • Use scripts/validate_scenario_layout.py for a read-only layout check and scripts/generate_minimal_scenario.py for a bounded local fixture. Both take explicit paths and never start SUMO, TraCI, Envision, or a network download.
  • Route scl scenario build, scl scenario clean, SUMO/TraCI, Waymo/Argoverse conversion, and other system integrations to cli-integrations.
  • Route Gym/RLlib environment reset/step/close to simulation-environments. Route Envision replay and rendered sensors to sensors-visualization.

Read the linked references before authoring a nontrivial scenario:

  • API reference for live constructor signatures and the stable meaning of each DSL object.
  • Workflows for minimal generation, custom maps, social agents, histories, deterministic rebuilds, and discovery.
  • Data formats for source-vs-build layout and artifact ownership.
  • Maps and traffic for map engines, routes, flows, missions, bubbles, friction, and dataset boundaries.
  • Troubleshooting for actionable recovery.

Minimal authoring contract

  1. Create an application-owned scenario directory and put a scenario.py in it. Keep input maps and data paths explicit; do not depend on the current working directory.
  2. Select a map source: map.net.xml/another .net.xml for SUMO, map.xodr for OpenDRIVE, a Waymo .tfrecord source, an Argoverse map archive, or a MapSpec(source=..., builder_fn=...) for a custom RoadMap implementation.
  3. Define named traffic, missions, and optional social/bubble/history metadata. Use edge/lane/offset tuples only when the referenced roads and lanes exist.
  4. Call gen_scenario(..., output_dir=scenario_dir, seed=<integer>). Set the same seed for comparable generated output; seed random choices before the call as well when authoring code uses Python or NumPy randomness.
  5. Validate the source and then the generated build/ tree. Build assets are generated state, not source code; regenerate after changing the DSL or map.
  6. Before simulation, ensure the selected engine is compatible with the map and manually check that ego mission starts do not overlap traffic starts. Studio does not detect that collision-prone overlap for you.

Fast recipe

from pathlib import Path
from smarts.sstudio import gen_scenario, types as t

root = Path("my_scenario").resolve()
car = t.TrafficActor(name="car")
scenario = t.Scenario(
    map_spec=t.MapSpec(source=str(root / "map.net.xml")),
    traffic={"background": t.Traffic(
        engine="SUMO",
        flows=[t.Flow(
            route=t.Route(begin=("edge_in", 0, "random"),
                          end=("edge_out", 0, "max")),
            rate=60, begin=0, end=60, actors={car: 1.0},
        )]
    )},
    ego_missions=[t.Mission(t.Route(
        begin=("edge_in", 1, 10), end=("edge_out", 1, "max")
    ))],
)
gen_scenario(scenario, root, seed=42)

SUMO traffic requires a SUMO road network and the SUMO Python/runtime integration; use engine="SMARTS" for supported non-SUMO road maps. The recipe is a shape example: replace edge ids with ids from the selected map and install optional dependencies before claiming a successful build.

Generated-artifact explanation

A successful generation normally creates build/build.db, a map artifact under build/map/, route files under build/traffic/, and optional files for missions, social agents, bubbles, friction, histories, and metadata. The exact set is determined by non-empty Scenario fields; see the data-format reference. smarts.core.scenario.Scenario.is_valid_scenario() checks that a map can be built, not that every optional artifact or traffic combination is semantically safe. Missing build/map/map.glb, stale build.db, or absent route files means regenerate/build rather than edit generated pickle/XML files manually.

Checks and handoff

Run the validator from any cwd:

python /path/to/skills/disco/smarts/sub-skills/scenario-studio/scripts/validate_scenario_layout.py \
  --scenario /absolute/path/to/my_scenario --require-build

For a safe local fixture (OpenDRIVE is used only when the installed optional parser can load the supplied map), write to an explicit empty output directory:

python /path/to/skills/disco/smarts/sub-skills/scenario-studio/scripts/generate_minimal_scenario.py \
  --map /absolute/path/to/map.net.xml --output /absolute/path/to/out --seed 42

The helper refuses to overwrite non-empty output unless --force is supplied, uses no external service, and exits nonzero with the failing path or import reason. Treat missing SUMO, Waymo, Argoverse, or dataset packages as explicit integration gaps, not as evidence that core Scenario Studio is broken.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351