بنقرة واحدة
run-scenario
Execute a SWARM simulation scenario and export standardized artifacts
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Execute a SWARM simulation scenario and export standardized artifacts
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
SWARM: System-Wide Assessment of Risk in Multi-agent systems. Simulate multi-agent dynamics, test governance, study emergent risks.
Query the SWARM knowledge graph structurally — find pages, list backlinks, follow link paths, and surface related/semantic neighbors across docs, scenarios, slash commands, agents, roles, and code references. Prefer this over grep when you need *connected* answers ("what links to X", "how does X relate to Y", "what's similar to X").
Scaffold research papers from SWARM run data with auto-populated tables
Run parameter grid sweeps across SWARM scenarios and generate summary statistics
Generate publication-quality visualizations from SWARM simulation data
Perform rigorous statistical analysis on SWARM experiment data with multiple-comparison corrections
| name | run-scenario |
| description | Execute a SWARM simulation scenario and export standardized artifacts |
| version | 1.0 |
| domain | swarm-safety |
| triggers | ["run scenario","execute simulation","baseline run"] |
Execute a single SWARM scenario with a given seed and export all artifacts to a standardized output directory.
swarm-safety package installed (pip install swarm-safety or pip install -e /root/swarm-package/)/root/scenarios/)Scenario references can be shorthand or full paths:
baseline → scenarios/baseline.yamlscenarios/baseline.yaml → use as-is/root/scenarios/baseline.yaml → use as-isimport os
def resolve_scenario(ref: str) -> str:
"""Resolve a scenario reference to a full path."""
candidates = [
ref,
f"scenarios/{ref}.yaml",
f"/root/scenarios/{ref}.yaml",
f"scenarios/{ref}",
]
for c in candidates:
if os.path.isfile(c):
return c
raise FileNotFoundError(f"Cannot find scenario: {ref}")
Use the SWARM CLI to execute:
python -m swarm run <scenario_path> --seed <seed> --epochs <N> --steps <M>
Or programmatically:
from swarm.core.orchestrator import Orchestrator
from swarm.scenarios.loader import load_scenario
config = load_scenario(scenario_path)
# Override simulation parameters if needed
config["simulation"]["seed"] = seed
config["simulation"]["n_epochs"] = epochs
config["simulation"]["steps_per_epoch"] = steps
orch = Orchestrator(config)
result = orch.run()
After the run completes, export to the output directory:
import json
import os
os.makedirs(output_dir, exist_ok=True)
# Export history.json
with open(os.path.join(output_dir, "history.json"), "w") as f:
json.dump(result.to_dict(), f, indent=2)
# Export CSV metrics
csv_dir = os.path.join(output_dir, "csv")
os.makedirs(csv_dir, exist_ok=True)
result.export_csv(csv_dir)
The final epoch snapshot contains summary metrics:
history = result.to_dict()
final = history["epoch_snapshots"][-1]
welfare = final["welfare"]
toxicity = final["toxicity_rate"]
print(f"Final welfare: {welfare:.3f}")
print(f"Final toxicity: {toxicity:.3f}")
<output_dir>/
├── history.json # Full simulation history
└── csv/
├── epoch_metrics.csv # Per-epoch aggregate metrics
└── agent_metrics.csv # Per-agent per-epoch metrics
swarm-safety is installed with runtime deps: pip install swarm-safety[runtime]/root/scenarios/ for available YAMLs