mas-lab-component-bench 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. mas_lab_component_bench-0.2.0/.gitignore +86 -0
  2. mas_lab_component_bench-0.2.0/PKG-INFO +19 -0
  3. mas_lab_component_bench-0.2.0/README.md +232 -0
  4. mas_lab_component_bench-0.2.0/pyproject.toml +35 -0
  5. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/README.md +323 -0
  6. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/__init__.py +65 -0
  7. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/analysis.py +199 -0
  8. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/cache/__init__.py +28 -0
  9. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/cache/key_scheme.py +102 -0
  10. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/cache/store.py +198 -0
  11. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/cache/trace_store.py +530 -0
  12. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/cli/__init__.py +41 -0
  13. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/cli/analyze.py +114 -0
  14. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/cli/artifacts.py +156 -0
  15. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/cli/clean.py +171 -0
  16. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/cli/common.py +38 -0
  17. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/cli/declared.py +269 -0
  18. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/cli/export_import.py +1020 -0
  19. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/cli/list.py +109 -0
  20. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/cli/manage.py +175 -0
  21. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/cli/show.py +319 -0
  22. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/cli/steps.py +217 -0
  23. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/cli/tree.py +295 -0
  24. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/codecs/__init__.py +94 -0
  25. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/codecs/base.py +79 -0
  26. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/dataset.py +267 -0
  27. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/dataset_source.py +231 -0
  28. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/engine.py +196 -0
  29. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/execution/__init__.py +16 -0
  30. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/execution/experiment_overlay.py +157 -0
  31. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/execution/overrides.py +50 -0
  32. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/execution/pipeline_attach.py +96 -0
  33. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/execution/plan.py +173 -0
  34. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/experiment.py +648 -0
  35. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/golden/__init__.py +20 -0
  36. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/golden/cache_backup.py +96 -0
  37. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/golden/events.py +149 -0
  38. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/golden/labs.py +132 -0
  39. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/lock.py +224 -0
  40. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/metadata.py +456 -0
  41. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/metadata_integration.py +157 -0
  42. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/migrate.py +207 -0
  43. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/__init__.py +101 -0
  44. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/adapter.py +52 -0
  45. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/artifact.py +312 -0
  46. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/artifact_paths.py +567 -0
  47. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/cache.py +304 -0
  48. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/channel.py +458 -0
  49. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/cli.py +264 -0
  50. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/config.py +30 -0
  51. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/core.py +495 -0
  52. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/counters.py +44 -0
  53. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/digest.py +39 -0
  54. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/executor.py +1044 -0
  55. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/expand.py +61 -0
  56. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/fanout.py +197 -0
  57. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/gather.py +45 -0
  58. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/incremental.py +115 -0
  59. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/keys.py +51 -0
  60. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/kinds.py +57 -0
  61. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/lib/__init__.py +7 -0
  62. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/lib/data_source.py +201 -0
  63. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/lib/plot_lib.py +615 -0
  64. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/lib/plot_specs/ablation_heatmap.yaml +51 -0
  65. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/lib/plot_specs/shapley_bars.yaml +62 -0
  66. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/lib/plot_specs/trajectory_gantt.yaml +68 -0
  67. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/lifecycle.py +83 -0
  68. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/live_sink.py +20 -0
  69. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/models.py +161 -0
  70. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/persist.py +60 -0
  71. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/resolver.py +198 -0
  72. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/resources.py +502 -0
  73. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/run_artifacts.py +183 -0
  74. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/scheduler.py +345 -0
  75. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/schema_validation.py +90 -0
  76. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/store.py +122 -0
  77. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/types.py +68 -0
  78. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/ui_bridge.py +221 -0
  79. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/pipeline/ws.py +179 -0
  80. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/plugins/__init__.py +3 -0
  81. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/plugins/mas.py +62 -0
  82. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/progress.py +256 -0
  83. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/reporting.py +248 -0
  84. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/reproducibility.py +243 -0
  85. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/results.py +346 -0
  86. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/run_manager/__init__.py +17 -0
  87. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/run_manager/discovery.py +58 -0
  88. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/run_manager/display.py +222 -0
  89. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/run_manager/manager.py +507 -0
  90. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/run_manager/models.py +65 -0
  91. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/run_manager/persistence.py +39 -0
  92. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/run_manager/pointer.py +20 -0
  93. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/run_manager/stats.py +84 -0
  94. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/runner.py +186 -0
  95. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/runners/__init__.py +3 -0
  96. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/schedule/__init__.py +13 -0
  97. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/schedule/metadata.py +87 -0
  98. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/schedule/pipeline.py +749 -0
  99. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/schedule/pipeline_resolve.py +137 -0
  100. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/schedule/resume.py +70 -0
  101. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/schedule/run_batch/__init__.py +114 -0
  102. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/schedule/run_batch/execute.py +810 -0
  103. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/schedule/run_batch/finalize.py +183 -0
  104. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/schedule/run_batch/load.py +381 -0
  105. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/schedule/run_batch/pre_hooks.py +123 -0
  106. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/schedule/run_batch/prepare.py +364 -0
  107. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/schedule/run_discovery.py +157 -0
  108. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/schema/__init__.py +37 -0
  109. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/schema/normalized.py +210 -0
  110. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/schema/validation.py +198 -0
  111. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/service_manager.py +658 -0
  112. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/stale_cleanup.py +269 -0
  113. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/state.py +267 -0
  114. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/storage.py +181 -0
  115. mas_lab_component_bench-0.2.0/src/mas/lab/benchmark/worker.py +198 -0
  116. mas_lab_component_bench-0.2.0/src/mas/lab/deprecations.py +103 -0
  117. mas_lab_component_bench-0.2.0/src/mas/lab/flavour/load.py +20 -0
  118. mas_lab_component_bench-0.2.0/src/mas/lab/flavour/resolve.py +51 -0
  119. mas_lab_component_bench-0.2.0/src/mas/lab/infra/README.md +26 -0
  120. mas_lab_component_bench-0.2.0/src/mas/lab/infra/datastore.py +51 -0
  121. mas_lab_component_bench-0.2.0/src/mas/lab/infra/stores.py +63 -0
  122. mas_lab_component_bench-0.2.0/src/mas/lab/inputs/__init__.py +264 -0
  123. mas_lab_component_bench-0.2.0/src/mas/lab/inputs/expectations.py +45 -0
  124. mas_lab_component_bench-0.2.0/src/mas/lab/inputs/fixtures.py +55 -0
  125. mas_lab_component_bench-0.2.0/src/mas/lab/inputs/legacy.py +75 -0
  126. mas_lab_component_bench-0.2.0/src/mas/lab/inputs/refs.py +100 -0
  127. mas_lab_component_bench-0.2.0/src/mas/lab/inputs/schemas.py +82 -0
  128. mas_lab_component_bench-0.2.0/src/mas/lab/lab/__init__.py +39 -0
  129. mas_lab_component_bench-0.2.0/src/mas/lab/lab/config/__init__.py +163 -0
  130. mas_lab_component_bench-0.2.0/src/mas/lab/lab/config/artifact_types.py +205 -0
  131. mas_lab_component_bench-0.2.0/src/mas/lab/lab/config/execution.py +562 -0
  132. mas_lab_component_bench-0.2.0/src/mas/lab/lab/config/experiment_base.py +596 -0
  133. mas_lab_component_bench-0.2.0/src/mas/lab/lab/config/lab_config.py +52 -0
  134. mas_lab_component_bench-0.2.0/src/mas/lab/lab/config/lab_context.py +179 -0
  135. mas_lab_component_bench-0.2.0/src/mas/lab/lab/config/mas_experiment.py +216 -0
  136. mas_lab_component_bench-0.2.0/src/mas/lab/lab/config/pipeline.py +360 -0
  137. mas_lab_component_bench-0.2.0/src/mas/lab/lab/config/scenario.py +224 -0
  138. mas_lab_component_bench-0.2.0/src/mas/lab/lab/config/scenario_loading.py +558 -0
  139. mas_lab_component_bench-0.2.0/src/mas/lab/lab/config/ui.py +39 -0
  140. mas_lab_component_bench-0.2.0/src/mas/lab/labs.py +693 -0
  141. mas_lab_component_bench-0.2.0/src/mas/lab/manifest/README.md +14 -0
  142. mas_lab_component_bench-0.2.0/src/mas/lab/manifest/__init__.py +29 -0
  143. mas_lab_component_bench-0.2.0/src/mas/lab/manifest/load.py +303 -0
  144. mas_lab_component_bench-0.2.0/src/mas/lab/manifests/__init__.py +26 -0
  145. mas_lab_component_bench-0.2.0/src/mas/lab/manifests/composed_manifest.py +276 -0
  146. mas_lab_component_bench-0.2.0/src/mas/lab/manifests/loader.py +49 -0
  147. mas_lab_component_bench-0.2.0/src/mas/lab/manifests/ref_checks.py +271 -0
  148. mas_lab_component_bench-0.2.0/src/mas/lab/manifests/schema/README.md +10 -0
  149. mas_lab_component_bench-0.2.0/src/mas/lab/manifests/validator.py +320 -0
  150. mas_lab_component_bench-0.2.0/src/mas/lab/manifests/versions.py +51 -0
  151. mas_lab_component_bench-0.2.0/src/mas/lab/mas_validator.py +612 -0
  152. mas_lab_component_bench-0.2.0/src/mas/lab/plots/__init__.py +69 -0
  153. mas_lab_component_bench-0.2.0/src/mas/lab/plots/_trajectory_validator.py +318 -0
  154. mas_lab_component_bench-0.2.0/src/mas/lab/plots/_viz_adapters.py +122 -0
  155. mas_lab_component_bench-0.2.0/src/mas/lab/plots/assets/context_provenance.html +675 -0
  156. mas_lab_component_bench-0.2.0/src/mas/lab/plots/assets/d3.min.js +2 -0
  157. mas_lab_component_bench-0.2.0/src/mas/lab/plots/assets/live.html +135 -0
  158. mas_lab_component_bench-0.2.0/src/mas/lab/plots/assets/mas.js +519 -0
  159. mas_lab_component_bench-0.2.0/src/mas/lab/plots/assets/multilevel.html +3053 -0
  160. mas_lab_component_bench-0.2.0/src/mas/lab/plots/communication_flow.py +375 -0
  161. mas_lab_component_bench-0.2.0/src/mas/lab/plots/communication_flow_processor.yaml +17 -0
  162. mas_lab_component_bench-0.2.0/src/mas/lab/plots/context_provenance.py +521 -0
  163. mas_lab_component_bench-0.2.0/src/mas/lab/plots/html_demo.py +186 -0
  164. mas_lab_component_bench-0.2.0/src/mas/lab/plots/kg_adapter.py +971 -0
  165. mas_lab_component_bench-0.2.0/src/mas/lab/plots/kg_widget/__init__.py +208 -0
  166. mas_lab_component_bench-0.2.0/src/mas/lab/plots/kg_widget/kg_composer.css +532 -0
  167. mas_lab_component_bench-0.2.0/src/mas/lab/plots/kg_widget/kg_composer.js +1097 -0
  168. mas_lab_component_bench-0.2.0/src/mas/lab/plots/kg_widget/kg_widget.css +398 -0
  169. mas_lab_component_bench-0.2.0/src/mas/lab/plots/kg_widget/kg_widget.js +1423 -0
  170. mas_lab_component_bench-0.2.0/src/mas/lab/plots/live_html.py +73 -0
  171. mas_lab_component_bench-0.2.0/src/mas/lab/plots/loaders.py +78 -0
  172. mas_lab_component_bench-0.2.0/src/mas/lab/plots/mas_plot.py +500 -0
  173. mas_lab_component_bench-0.2.0/src/mas/lab/plots/message_graph/__init__.py +60 -0
  174. mas_lab_component_bench-0.2.0/src/mas/lab/plots/message_graph/constants.py +50 -0
  175. mas_lab_component_bench-0.2.0/src/mas/lab/plots/message_graph/extract.py +93 -0
  176. mas_lab_component_bench-0.2.0/src/mas/lab/plots/message_graph/helpers.py +36 -0
  177. mas_lab_component_bench-0.2.0/src/mas/lab/plots/message_graph/layout.py +49 -0
  178. mas_lab_component_bench-0.2.0/src/mas/lab/plots/message_graph/plot.py +410 -0
  179. mas_lab_component_bench-0.2.0/src/mas/lab/plots/message_graph/processor.py +71 -0
  180. mas_lab_component_bench-0.2.0/src/mas/lab/plots/message_graph/theme.py +282 -0
  181. mas_lab_component_bench-0.2.0/src/mas/lab/plots/multilevel_context_provenance.py +619 -0
  182. mas_lab_component_bench-0.2.0/src/mas/lab/plots/multilevel_trajectory/__init__.py +118 -0
  183. mas_lab_component_bench-0.2.0/src/mas/lab/plots/multilevel_trajectory/annotations.py +584 -0
  184. mas_lab_component_bench-0.2.0/src/mas/lab/plots/multilevel_trajectory/chart_data.py +568 -0
  185. mas_lab_component_bench-0.2.0/src/mas/lab/plots/multilevel_trajectory/constants.py +156 -0
  186. mas_lab_component_bench-0.2.0/src/mas/lab/plots/multilevel_trajectory/dag.py +2357 -0
  187. mas_lab_component_bench-0.2.0/src/mas/lab/plots/multilevel_trajectory/governance.py +263 -0
  188. mas_lab_component_bench-0.2.0/src/mas/lab/plots/multilevel_trajectory/layout.py +81 -0
  189. mas_lab_component_bench-0.2.0/src/mas/lab/plots/multilevel_trajectory/models.py +225 -0
  190. mas_lab_component_bench-0.2.0/src/mas/lab/plots/multilevel_trajectory/plot.py +218 -0
  191. mas_lab_component_bench-0.2.0/src/mas/lab/plots/multilevel_trajectory/records.py +991 -0
  192. mas_lab_component_bench-0.2.0/src/mas/lab/plots/multilevel_trajectory/svg.py +419 -0
  193. mas_lab_component_bench-0.2.0/src/mas/lab/plots/multilevel_trajectory/test_regression_verifier.py +149 -0
  194. mas_lab_component_bench-0.2.0/src/mas/lab/plots/multilevel_trajectory/tree.py +910 -0
  195. mas_lab_component_bench-0.2.0/src/mas/lab/plots/multilevel_trajectory_processor.py +164 -0
  196. mas_lab_component_bench-0.2.0/src/mas/lab/plots/multilevel_trajectory_processor.yaml +17 -0
  197. mas_lab_component_bench-0.2.0/src/mas/lab/plots/palette.py +84 -0
  198. mas_lab_component_bench-0.2.0/src/mas/lab/plots/pipeline_diagram.py +504 -0
  199. mas_lab_component_bench-0.2.0/src/mas/lab/plots/providers.py +138 -0
  200. mas_lab_component_bench-0.2.0/src/mas/lab/plots/topology.py +463 -0
  201. mas_lab_component_bench-0.2.0/src/mas/lab/plots/trajectory/__init__.py +11 -0
  202. mas_lab_component_bench-0.2.0/src/mas/lab/plots/trajectory/extract.py +213 -0
  203. mas_lab_component_bench-0.2.0/src/mas/lab/plots/trajectory/highlights.py +54 -0
  204. mas_lab_component_bench-0.2.0/src/mas/lab/plots/trajectory/html.py +185 -0
  205. mas_lab_component_bench-0.2.0/src/mas/lab/plots/trajectory/loading.py +77 -0
  206. mas_lab_component_bench-0.2.0/src/mas/lab/plots/trajectory/mermaid.py +99 -0
  207. mas_lab_component_bench-0.2.0/src/mas/lab/plots/trajectory/plot.py +115 -0
  208. mas_lab_component_bench-0.2.0/src/mas/lab/plots/trajectory/svg.py +311 -0
  209. mas_lab_component_bench-0.2.0/src/mas/lab/processors/__init__.py +63 -0
  210. mas_lab_component_bench-0.2.0/src/mas/lab/processors/multilevel_trajectory_plotter.py +105 -0
  211. mas_lab_component_bench-0.2.0/src/mas/lab/processors/multilevel_trajectory_plotter.yaml +23 -0
  212. mas_lab_component_bench-0.2.0/src/mas/lab/processors/trajectory_annotator.py +86 -0
  213. mas_lab_component_bench-0.2.0/src/mas/lab/processors/trajectory_annotator.yaml +16 -0
  214. mas_lab_component_bench-0.2.0/src/mas/lab/processors/trajectory_loader.py +86 -0
  215. mas_lab_component_bench-0.2.0/src/mas/lab/processors/trajectory_loader.yaml +16 -0
  216. mas_lab_component_bench-0.2.0/src/mas/lab/processors/trajectory_plotter.py +129 -0
  217. mas_lab_component_bench-0.2.0/src/mas/lab/processors/trajectory_plotter.yaml +25 -0
  218. mas_lab_component_bench-0.2.0/src/mas/lab/processors/trajectory_plotter_native.py +116 -0
  219. mas_lab_component_bench-0.2.0/src/mas/lab/processors/trajectory_plotter_native.yaml +22 -0
  220. mas_lab_component_bench-0.2.0/src/mas/lab/verification/__init__.py +39 -0
  221. mas_lab_component_bench-0.2.0/src/mas/lab/verification/contracts/__init__.py +33 -0
  222. mas_lab_component_bench-0.2.0/src/mas/lab/verification/contracts/executor.py +423 -0
  223. mas_lab_component_bench-0.2.0/src/mas/lab/verification/contracts/generator.py +216 -0
  224. mas_lab_component_bench-0.2.0/src/mas/lab/verification/contracts/loader.py +133 -0
  225. mas_lab_component_bench-0.2.0/src/mas/lab/verification/contracts/reporter.py +202 -0
  226. mas_lab_component_bench-0.2.0/src/mas/lab/workspace.py +77 -0
  227. mas_lab_component_bench-0.2.0/tests/__init__.py +3 -0
  228. mas_lab_component_bench-0.2.0/tests/fixtures/pipeline_parity/single_run/events.jsonl +7 -0
  229. mas_lab_component_bench-0.2.0/tests/test_artifact_paths.py +386 -0
  230. mas_lab_component_bench-0.2.0/tests/test_artifact_types.py +73 -0
  231. mas_lab_component_bench-0.2.0/tests/test_benchmark_infra_name_refs.py +40 -0
  232. mas_lab_component_bench-0.2.0/tests/test_checkpoint_axis.py +92 -0
  233. mas_lab_component_bench-0.2.0/tests/test_cli_help_smoke.py +21 -0
  234. mas_lab_component_bench-0.2.0/tests/test_cli_manpages.py +82 -0
  235. mas_lab_component_bench-0.2.0/tests/test_cli_pipeline_shortcuts.py +124 -0
  236. mas_lab_component_bench-0.2.0/tests/test_codec_registry_manifest.py +24 -0
  237. mas_lab_component_bench-0.2.0/tests/test_codec_registry_runtime.py +27 -0
  238. mas_lab_component_bench-0.2.0/tests/test_dataset_part_schemas.py +103 -0
  239. mas_lab_component_bench-0.2.0/tests/test_dataset_source.py +322 -0
  240. mas_lab_component_bench-0.2.0/tests/test_declared_artifacts.py +324 -0
  241. mas_lab_component_bench-0.2.0/tests/test_deprecations.py +333 -0
  242. mas_lab_component_bench-0.2.0/tests/test_engine_options.py +143 -0
  243. mas_lab_component_bench-0.2.0/tests/test_eval_judge_load_path.py +143 -0
  244. mas_lab_component_bench-0.2.0/tests/test_eval_mce_cache.py +142 -0
  245. mas_lab_component_bench-0.2.0/tests/test_evaluation_model.py +334 -0
  246. mas_lab_component_bench-0.2.0/tests/test_execution_guard.py +29 -0
  247. mas_lab_component_bench-0.2.0/tests/test_execution_plan.py +108 -0
  248. mas_lab_component_bench-0.2.0/tests/test_experiment_design_schedule.py +129 -0
  249. mas_lab_component_bench-0.2.0/tests/test_experiment_overlay.py +192 -0
  250. mas_lab_component_bench-0.2.0/tests/test_export_source_bundle_safety.py +264 -0
  251. mas_lab_component_bench-0.2.0/tests/test_finalize_status.py +59 -0
  252. mas_lab_component_bench-0.2.0/tests/test_flavour_resolve.py +30 -0
  253. mas_lab_component_bench-0.2.0/tests/test_golden_labs.py +42 -0
  254. mas_lab_component_bench-0.2.0/tests/test_golden_pipeline_path.py +91 -0
  255. mas_lab_component_bench-0.2.0/tests/test_html_demo_plot.py +119 -0
  256. mas_lab_component_bench-0.2.0/tests/test_lab_context.py +152 -0
  257. mas_lab_component_bench-0.2.0/tests/test_lab_run_retry.py +127 -0
  258. mas_lab_component_bench-0.2.0/tests/test_last_run_pointer.py +60 -0
  259. mas_lab_component_bench-0.2.0/tests/test_level_pre_hooks.py +151 -0
  260. mas_lab_component_bench-0.2.0/tests/test_manifest_load.py +37 -0
  261. mas_lab_component_bench-0.2.0/tests/test_migrate_dataset_envelope.py +112 -0
  262. mas_lab_component_bench-0.2.0/tests/test_migrate_experiment_execution.py +99 -0
  263. mas_lab_component_bench-0.2.0/tests/test_multilevel_plot_dfs_axis.py +1512 -0
  264. mas_lab_component_bench-0.2.0/tests/test_multilevel_plot_governance.py +132 -0
  265. mas_lab_component_bench-0.2.0/tests/test_multilevel_plot_hardening.py +213 -0
  266. mas_lab_component_bench-0.2.0/tests/test_multilevel_plot_records_strict.py +109 -0
  267. mas_lab_component_bench-0.2.0/tests/test_pipeline_dataflow_edges.py +84 -0
  268. mas_lab_component_bench-0.2.0/tests/test_pipeline_parity_corpus.py +27 -0
  269. mas_lab_component_bench-0.2.0/tests/test_pipeline_realtime.py +48 -0
  270. mas_lab_component_bench-0.2.0/tests/test_pipeline_registry_generic.py +47 -0
  271. mas_lab_component_bench-0.2.0/tests/test_pipeline_registry_manifest.py +46 -0
  272. mas_lab_component_bench-0.2.0/tests/test_pipeline_resolve.py +342 -0
  273. mas_lab_component_bench-0.2.0/tests/test_plot_governance_facet.py +192 -0
  274. mas_lab_component_bench-0.2.0/tests/test_plot_providers.py +34 -0
  275. mas_lab_component_bench-0.2.0/tests/test_run_input.py +469 -0
  276. mas_lab_component_bench-0.2.0/tests/test_scenario_loading_entry_agent.py +186 -0
  277. mas_lab_component_bench-0.2.0/tests/test_scenario_loading_governance.py +81 -0
  278. mas_lab_component_bench-0.2.0/tests/test_serialize_stream.py +106 -0
  279. mas_lab_component_bench-0.2.0/tests/test_service_manager.py +38 -0
  280. mas_lab_component_bench-0.2.0/tests/test_shipped_envelope.py +99 -0
  281. mas_lab_component_bench-0.2.0/tests/test_show_plots.py +118 -0
  282. mas_lab_component_bench-0.2.0/tests/test_silent_failures.py +73 -0
  283. mas_lab_component_bench-0.2.0/tests/test_stale_cleanup.py +62 -0
  284. mas_lab_component_bench-0.2.0/tests/test_topology_plot.py +62 -0
  285. mas_lab_component_bench-0.2.0/tests/test_trace_cache_portable.py +31 -0
  286. mas_lab_component_bench-0.2.0/tests/test_v2_artifacts.py +181 -0
  287. mas_lab_component_bench-0.2.0/tests/test_v2_channel.py +106 -0
  288. mas_lab_component_bench-0.2.0/tests/test_v2_config.py +29 -0
  289. mas_lab_component_bench-0.2.0/tests/test_v2_executor_equivalence.py +169 -0
  290. mas_lab_component_bench-0.2.0/tests/test_v2_expand_parity.py +109 -0
  291. mas_lab_component_bench-0.2.0/tests/test_v2_fanout.py +292 -0
  292. mas_lab_component_bench-0.2.0/tests/test_v2_kinds_gather.py +101 -0
  293. mas_lab_component_bench-0.2.0/tests/test_v2_more.py +122 -0
  294. mas_lab_component_bench-0.2.0/tests/test_v2_scope_gate.py +136 -0
  295. mas_lab_component_bench-0.2.0/tests/test_v2_store_scheduler.py +128 -0
  296. mas_lab_component_bench-0.2.0/tests/test_v2_ws.py +95 -0
@@ -0,0 +1,86 @@
1
+ *.pyc
2
+ __pycache__/
3
+ *.egg-info/
4
+ .DS_Store
5
+ dist/
6
+ build/
7
+ .venv/
8
+ .demo-ui/
9
+ .demo-ui-mock/
10
+ .env
11
+ .env.local
12
+ .env.*.local
13
+ config.yaml
14
+ !lab/src/mas/lab/templates/**/config.yaml
15
+ !docs/tutorials/**/config.yaml
16
+ !labs/**/config.yaml
17
+ !library-samples/sample-workspace/config.yaml
18
+ .mypy_cache/
19
+ .ruff_cache/
20
+ .pytest_cache/
21
+ .test-venv/
22
+ node_modules/
23
+ *.log
24
+ docs/tutorials/**/logs/
25
+ .hypothesis/
26
+ compliance-report.json
27
+ COMPLIANCE_REPORT.md
28
+ compliance/results/
29
+
30
+ # MkDocs build output
31
+ site/
32
+
33
+ .vscode/
34
+ .cursor/
35
+ .claude/
36
+
37
+ # Test / coverage artifacts
38
+ .coverage
39
+ coverage.xml
40
+ coverage.json
41
+ **/coverage.json
42
+
43
+ # LaTeX build artifacts
44
+ *.fdb_latexmk
45
+ *.fls
46
+ *.aux
47
+ *.out
48
+ *.toc
49
+ *.synctex.gz
50
+
51
+ # Run output / artifacts
52
+ **/output/*.jsonl
53
+ **/output/benchmark
54
+ **/output/meta.json
55
+ **/output/current_run_id.txt
56
+ **/output/*/
57
+ .tutorial-cache/
58
+ tests/.tutorial-engine-cache/
59
+ .demo-cache/
60
+ # Local mas-ctl chat traces next to an agent (fixtures live under fixtures/ or T01 traces/)
61
+ docs/tutorials/**/agents/**/traces/
62
+
63
+ # Backup files
64
+ *.bak
65
+ *.bak2
66
+
67
+ # Legacy dead code (removed from repo)
68
+ lab/src/mas/lab/_cli_legacy.py
69
+ .deepeval/
70
+ ~/.mas/
71
+
72
+
73
+ # Docker local secrets + data (never commit)
74
+ docker/.env
75
+ docker/data/*
76
+ !docker/data/.gitkeep
77
+
78
+ # Local protocol compliance checkouts and reports
79
+ compliance/vendor/
80
+
81
+ # Local harness playbooks (not published)
82
+ AGENTS.md
83
+ # .agents/
84
+ COVERAGE_REPORT.md
85
+ MANIFEST_SCHEMA_MAPPING.md
86
+ .lycheecache
@@ -0,0 +1,19 @@
1
+ Metadata-Version: 2.5
2
+ Name: mas-lab-component-bench
3
+ Version: 0.2.0
4
+ Summary: Benchmark engine, pipeline execution, plots and validation for MAS Lab.
5
+ License: Apache-2.0
6
+ Requires-Python: >=3.11
7
+ Requires-Dist: click>=8.0
8
+ Requires-Dist: huggingface-hub>=0.30.0
9
+ Requires-Dist: jsonschema>=4.0
10
+ Requires-Dist: mas-lab-component-core
11
+ Requires-Dist: mas-lab-ctl
12
+ Requires-Dist: mas-lab-library-eval
13
+ Requires-Dist: mas-lab-runtime
14
+ Requires-Dist: openai>=1.0.0
15
+ Requires-Dist: pandas>=2.0.0
16
+ Requires-Dist: playwright>=1.40
17
+ Requires-Dist: plotnine>=0.12.0
18
+ Requires-Dist: psutil>=5.9.0
19
+ Requires-Dist: scipy>=1.10.0
@@ -0,0 +1,232 @@
1
+ <!--
2
+ Copyright (c) 2026 Cisco Systems, Inc. and its affiliates
3
+ SPDX-License-Identifier: Apache-2.0
4
+ -->
5
+ # lab/components/bench
6
+
7
+ Runs reproducible benchmark experiments: scenarios x dataset items x runs, then pipeline steps on the resulting `events.jsonl` logs. Runs resume from the trace cache when inputs match.
8
+
9
+ Use it when you compare multi-agent system (MAS) variants, for example an ablation, and need statistics and plots. Terms are in the [glossary](../../../docs/glossary.md). The user guide is [lab/docs/benchmark.md](../../docs/benchmark.md).
10
+
11
+ ## Quick start
12
+
13
+ ```bash
14
+ uv pip install mas-lab # full stack (meta-package)
15
+ uv pip install -e lab/components/bench # or this component alone
16
+
17
+ mas-lab benchmark run my-experiment.yaml --dry-run # validate config, show plan
18
+ mas-lab benchmark run my-experiment.yaml --progress # execute (resumes a prior run)
19
+ mas-lab benchmark follow my-experiment.yaml # watch progress from a second terminal
20
+ mas-lab benchmark show last # inspect results
21
+ ```
22
+
23
+ ## Experiment YAML
24
+
25
+ ```yaml
26
+ experiment:
27
+ name: my-trip-planner-ablation
28
+ default_flavour: local
29
+ application:
30
+ manifest: path/to/mas.yaml
31
+ configs_dir: ./overlays
32
+ scenarios:
33
+ - id: baseline
34
+ overlays: {logic: [], control: [], infra: []}
35
+ - id: with-mitigation
36
+ overlays: {logic: [], control: [full_mitigation], infra: []}
37
+ dataset:
38
+ path: ./datasets/queries.yaml
39
+ limit: 20
40
+ run:
41
+ n_runs: 5
42
+ artifacts:
43
+ trace: trace
44
+ df: dataframe
45
+ post:
46
+ - {name: extract-trace-stats, type: extract_trace_stats, in: trace, out: df}
47
+ item:
48
+ artifacts: {df: dataframe}
49
+ post:
50
+ - {name: gather-item, type: gather_level, in: df, out: df, depends_on: [extract-trace-stats]}
51
+ scenario:
52
+ artifacts: {df: dataframe}
53
+ post:
54
+ - {name: gather-scenario, type: gather_level, in: df, out: df, depends_on: [gather-item]}
55
+ post:
56
+ - {name: gather-experiment, type: gather_level, in: df, out: df, depends_on: [gather-scenario]}
57
+ execution:
58
+ strategy: coverage
59
+ ```
60
+
61
+ ## Commands
62
+
63
+ ### `benchmark run`
64
+
65
+ Executes an experiment. A run with `run.n_runs: 5` resumes from where it stopped. Results go under the lab output root derived from `experiment.name` (override with `-o`).
66
+
67
+ ```bash
68
+ mas-lab benchmark run experiment.yaml
69
+ mas-lab benchmark run experiment.yaml --force # always start fresh
70
+ mas-lab benchmark run experiment.yaml --dry-run # validate + plan only
71
+ mas-lab benchmark run experiment.yaml --single-run # 1 scenario, handy for CI
72
+ mas-lab benchmark run experiment.yaml --limit-scenarios 10
73
+ mas-lab benchmark run experiment.yaml --sample-scenarios 20 --seed 42
74
+ mas-lab benchmark run experiment.yaml --max-runs 3
75
+ mas-lab benchmark run experiment.yaml --strategy depth # depth-first (default: coverage)
76
+ mas-lab benchmark run experiment.yaml -o /tmp/results
77
+ ```
78
+
79
+ | Flag | Default | Description |
80
+ |------|---------|-------------|
81
+ | `--force` | off | Always create a new run |
82
+ | `--benchmark-id` | - | Resume a specific benchmark by ID |
83
+ | `--progress / --no-progress` | progress | Real-time progress bar |
84
+ | `--dry-run` | off | Validate config + show plan, no execution |
85
+ | `--max-runs` | from YAML `run.n_runs` | Override `n_runs` |
86
+ | `--limit-scenarios` | - | Limit to first N scenarios |
87
+ | `--sample-scenarios` | - | Randomly sample N scenarios |
88
+ | `--single-run` | off | Run exactly 1 scenario |
89
+ | `-o / --output-dir` | derived from `experiment.name` | Output directory |
90
+ | `--trace-cache` | `$XDG_CACHE_HOME/mas/traces` | Override trace-cache directory |
91
+ | `--force-lock` | off | Break existing lock |
92
+ | `--flavour` | `local` | Runtime flavour YAML name |
93
+ | `--strategy` | `coverage` | `coverage` (breadth-first) or `depth` (depth-first) |
94
+
95
+ ### Other `benchmark` commands
96
+
97
+ ```bash
98
+ # list: --status running|completed|failed|partial, --limit (20), --format simple|markdown|csv|json|jsonl
99
+ mas-lab benchmark list --status completed --limit 10 --format markdown
100
+
101
+ # show: one run, or a section of it
102
+ mas-lab benchmark show <id>
103
+ mas-lab benchmark show last plots # also: events-trace, otel-traces
104
+ mas-lab benchmark show last --format json
105
+
106
+ # follow: poll run_info.json files and stream a tally until all runs finish
107
+ mas-lab benchmark follow experiment.yaml --interval 10
108
+ mas-lab benchmark follow experiment.yaml --once # single snapshot
109
+
110
+ # analyze: regenerate plots and statistics from existing output (no re-execution)
111
+ mas-lab benchmark analyze <id> --experiment-yaml path/to/experiment.yaml
112
+
113
+ # update: edit metadata of a run
114
+ mas-lab benchmark update <id> --name "Final ablation v2" --add-tag ablation --remove-tag wip
115
+
116
+ # step: inspect and restart individual pipeline steps of a run
117
+ mas-lab benchmark step list <id>
118
+ mas-lab benchmark step show <id> <step_id>
119
+ mas-lab benchmark step restart <id> <step_id>
120
+
121
+ # pipeline: run a standalone post-processing pipeline YAML on existing output
122
+ mas-lab benchmark pipeline validate pipeline.yaml # schema check
123
+ mas-lab benchmark pipeline show pipeline.yaml # step graph
124
+ mas-lab benchmark pipeline plan pipeline.yaml # execution plan
125
+ mas-lab benchmark pipeline run pipeline.yaml
126
+ ```
127
+
128
+ ## Post-processing pipeline
129
+
130
+ A pipeline YAML declares steps and their dependencies. Steps run in topological order; independent steps run in parallel.
131
+
132
+ ```yaml
133
+ name: post-process
134
+ steps:
135
+ - name: extract
136
+ type: extract_trajectories
137
+
138
+ - name: stats
139
+ type: extract_trace_stats
140
+ depends_on: [extract]
141
+
142
+ - name: eval
143
+ type: eval_mce
144
+ scope: run # scores ONE run per invocation; needs run-level context
145
+ depends_on: [extract]
146
+ config:
147
+ metrics: [goal_success_rate]
148
+
149
+ - name: plot
150
+ type: plot
151
+ depends_on: [eval]
152
+ config:
153
+ spec: shapley_bars
154
+ ```
155
+
156
+ Step implementations are library plugins registered in the runtime registry through the `types:` / `plugins:` block of [`library-lab/library.yaml`](../../../library-lab/library.yaml). `mas-lab benchmark pipeline validate` lists the registered step types. The full catalog is in [pipeline-steps.md](../../docs/pipeline-steps.md). Steps such as `embed_states` and `list_clickhouse_sessions` can live in your own package and register through entry points.
157
+
158
+ | Category | Step types |
159
+ |----------|------------|
160
+ | `extract/` | `extract_trace_stats`, `extract_mealy_stats`, `extract_trajectories` (builds `trajectories.jsonl` from `events.jsonl`) |
161
+ | `eval/` | `eval_mce` (MCE LLM-as-judge scoring on `events.jsonl`), `collect_metrics`, `compute_ci` |
162
+ | `viz/` | `plot` (declarative figure from a `plot_library/` spec: `shapley_bars`, `ablation_heatmap`, `trajectory_gantt`), `plot_trajectory` (per-run SVG), `plot_multilevel_trajectory` (swimlane HTML/SVG), `ci_plot` |
163
+ | `data/` | `to_dataframe`, `serialize`, `processor` (run a registered trajectory processor by name) |
164
+ | `services/` | `service_start`, `export_otel` |
165
+ | other | `experiment` (run a MAS scenario via `mas-ctl`), `dataset` (load / filter a scenario dataset), `annotate_metrics` (attach scores to run metadata), `embed_trajectories` (embed trajectory strings for manifold analysis) |
166
+
167
+ Shared helpers are in `pipeline/lib/` (`data_source`, `plot_lib`, `plot_specs/`).
168
+
169
+ ## Related commands
170
+
171
+ Score one trace with MCE metrics (for batches, use the `eval_mce` step; see [library-eval](../../../library-eval/README.md)):
172
+
173
+ ```bash
174
+ mas-lab eval path/to/traces/events.jsonl --metric groundedness --json
175
+ ```
176
+
177
+ Draw visualisations directly from a trace file:
178
+
179
+ ```bash
180
+ mas-lab plot trajectory events.jsonl -o trajectory.png
181
+ mas-lab plot multilevel-trajectory events.jsonl -o multilevel.png
182
+ mas-lab plot communication-flow events.jsonl -o flow.png
183
+ mas-lab plot list output/benchmark/runs/
184
+ ```
185
+
186
+ ## Python API
187
+
188
+ Prefer `mas-lab benchmark run experiment.yaml`. For an in-process run:
189
+
190
+ ```python
191
+ from pathlib import Path
192
+ from mas.lab.benchmark.worker import run_benchmark_sync
193
+
194
+ ok = run_benchmark_sync(
195
+ Path("labs/design-space.lab/02-topologies/experiment.yaml"),
196
+ flavour_name="local",
197
+ output_dir=Path.home() / ".local/share/mas/labs/my-run",
198
+ )
199
+ ```
200
+
201
+ ## Package layout
202
+
203
+ ```
204
+ components/bench/src/mas/lab/benchmark/
205
+ +-- dataset.py dataset loading, filtering, sampling
206
+ +-- experiment.py ExperimentRunner + ExperimentConfig
207
+ +-- metadata.py BenchmarkMetadata (run_info.json)
208
+ +-- lock.py advisory file lock (concurrent-run safety)
209
+ +-- deduplication.py trace-cache dedup (skip already-seen prompts)
210
+ +-- analysis.py statistical analysis helpers
211
+ +-- migrate.py run directory migration utilities
212
+ +-- pipeline/
213
+ +-- pipeline.py pipeline loader + validator
214
+ +-- executor.py topological executor (parallel)
215
+ +-- registry.py step-type registry
216
+ +-- cache.py step output cache
217
+ +-- steps/ experiment.py, extract_trajectories.py, eval_mce.py,
218
+ plot_multilevel_trajectory.py, ...
219
+ ```
220
+
221
+ ## Documentation
222
+
223
+ | Document | Description |
224
+ |----------|-------------|
225
+ | [benchmark.md](../../docs/benchmark.md) | Benchmark guide: quickstart, concepts, lifecycle |
226
+ | [pipeline.md](../../docs/pipeline.md) | Pipeline architecture and YAML schema |
227
+ | [pipeline-steps.md](../../docs/pipeline-steps.md) | Step type reference |
228
+ | [pipeline-processors.md](../../docs/pipeline-processors.md) | Processor registry and plot library |
229
+ | [library-eval/README.md](../../../library-eval/README.md) | MCE metrics and `mas-lab eval` |
230
+ | [designing-experiments.md](../../docs/designing-experiments.md) | Designing ablations and Shapley experiments |
231
+ | [benchmark-state-architecture.md](../../docs/benchmark-state-architecture.md) | Run state machine and locking |
232
+ | [multi-scenario-format.md](../../docs/multi-scenario-format.md) | Multi-scenario dataset format |
@@ -0,0 +1,35 @@
1
+ # Copyright (c) 2026 Cisco Systems, Inc. and its affiliates
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ [build-system]
4
+ requires = ["hatchling"]
5
+ build-backend = "hatchling.build"
6
+
7
+ [project]
8
+ name = "mas-lab-component-bench"
9
+ version = "0.2.0"
10
+ description = "Benchmark engine, pipeline execution, plots and validation for MAS Lab."
11
+ requires-python = ">=3.11"
12
+ license = {text = "Apache-2.0"}
13
+
14
+ dependencies = [
15
+ "mas-lab-component-core",
16
+ "mas-lab-library-eval",
17
+ "mas-lab-runtime",
18
+ "mas-lab-ctl",
19
+ "jsonschema>=4.0",
20
+ "click>=8.0",
21
+ "huggingface_hub>=0.30.0",
22
+ "openai>=1.0.0",
23
+ "pandas>=2.0.0",
24
+ "plotnine>=0.12.0",
25
+ "scipy>=1.10.0",
26
+ "psutil>=5.9.0",
27
+ "playwright>=1.40",
28
+ # MCE evaluation metrics are provided by mas-lab-library-eval (workspace member)
29
+ ]
30
+
31
+ [tool.hatch.build.targets.wheel]
32
+ packages = ["src/mas"]
33
+
34
+ [project.entry-points."mas.lab.runners"]
35
+ native = "mas.lab.benchmark.plugins.mas:MasRuntimeRunner"
@@ -0,0 +1,323 @@
1
+ <!--
2
+ Copyright (c) 2026 Cisco Systems, Inc. and its affiliates
3
+ SPDX-License-Identifier: Apache-2.0
4
+ -->
5
+ # Benchmark Framework - Reusable Components
6
+
7
+ **Composable primitives for agent evaluation.**
8
+
9
+ ## Philosophy
10
+
11
+ This framework follows these principles:
12
+
13
+ 1. **Declarative over imperative** - Configure via YAML/JSON, not code
14
+ 2. **Incremental over monolithic** - Add runs without rerunning everything
15
+ 3. **Composable over all-in-one** - Mix and match components
16
+ 4. **Human-readable over optimized** - Folder names you can understand
17
+ 5. **DataFrame-native over custom formats** - Leverage pandas/polars ecosystem
18
+
19
+ ## Components
20
+
21
+ ### 1. Dataset (`dataset.py`)
22
+
23
+ Loads and manipulates evaluation datasets.
24
+
25
+ ```python
26
+ from mas.lab.benchmark import Dataset
27
+
28
+ # Load from JSON
29
+ dataset = Dataset.from_json("math_problems.json")
30
+
31
+ # Filter by category
32
+ arithmetic = dataset.filter(category="arithmetic")
33
+
34
+ # Iterate
35
+ for item in dataset:
36
+ print(item.id, item.prompt)
37
+ ```
38
+
39
+ **JSON Format:**
40
+ ```json
41
+ {
42
+ "name": "dataset_name",
43
+ "version": "v1",
44
+ "items": [
45
+ {
46
+ "id": "001",
47
+ "prompt": "Question text",
48
+ "category": "category_name",
49
+ "expected_answer": "Answer",
50
+ "metadata_key": "metadata_value"
51
+ }
52
+ ]
53
+ }
54
+ ```
55
+
56
+ ### 2. ResultStorage (`storage.py`)
57
+
58
+ Manages human-readable folder structure.
59
+
60
+ ```python
61
+ from mas.lab.benchmark import ResultStorage, RunMetadata
62
+
63
+ storage = ResultStorage("./results")
64
+
65
+ # Generate run ID
66
+ run_id = storage.generate_run_id("cot", run_number=1)
67
+ # → "cot_run_001_20260218_143022"
68
+
69
+ # Save run
70
+ metadata = RunMetadata(
71
+ dataset_name="math",
72
+ item_id="001",
73
+ run_id=run_id,
74
+ pattern="cot",
75
+ timestamp="2026-02-18T14:30:22",
76
+ config={"model": "gpt-4"},
77
+ success=True,
78
+ latency_ms=1234.5
79
+ )
80
+
81
+ storage.save_run(
82
+ dataset_name="math",
83
+ item_id="001",
84
+ run_id=run_id,
85
+ metadata=metadata,
86
+ events_file=Path("events.jsonl"),
87
+ artifacts={"log": Path("agent.log")}
88
+ )
89
+
90
+ # List all runs
91
+ runs = storage.list_runs("math")
92
+ # → [("math", "001", "cot_run_001_20260218_143022"), ...]
93
+ ```
94
+
95
+ **Folder Structure:**
96
+ ```
97
+ results/
98
+ {dataset_name}/
99
+ {item_id}/
100
+ {run_id}/
101
+ metadata.json
102
+ events.jsonl
103
+ artifacts/
104
+ consolidated.parquet
105
+ ```
106
+
107
+ ### 3. MultiRunOrchestrator (`runner.py`)
108
+
109
+ Coordinates N runs per item across patterns.
110
+
111
+ ```python
112
+ from mas.lab.benchmark import MultiRunOrchestrator
113
+
114
+ orchestrator = MultiRunOrchestrator(
115
+ storage=storage,
116
+ n_runs=3,
117
+ pause_between_runs=1.0
118
+ )
119
+
120
+ # Define agent factory
121
+ async def agent_factory(pattern_name, pattern_config):
122
+ # Your agent creation logic
123
+ return agent
124
+
125
+ # Run benchmark
126
+ summary = await orchestrator.run_dataset(
127
+ dataset=dataset,
128
+ patterns={
129
+ "cot": {"manifest": "cot.yaml"},
130
+ "react": {"manifest": "react.yaml"}
131
+ },
132
+ agent_factory=agent_factory
133
+ )
134
+ ```
135
+
136
+ ### 4. ResultAnalyzer (`analysis.py`)
137
+
138
+ Consolidates results into DataFrame.
139
+
140
+ ```python
141
+ from mas.lab.benchmark import ResultAnalyzer
142
+
143
+ analyzer = ResultAnalyzer(storage)
144
+
145
+ # Consolidate all runs
146
+ df = analyzer.consolidate_results(
147
+ dataset_name="math",
148
+ include_events=True, # Parse event logs
149
+ cache=True # Save as Parquet
150
+ )
151
+
152
+ # Compute statistics
153
+ stats = analyzer.compute_statistics(df)
154
+ # pattern latency_ms_mean success_rate mean_tokens
155
+ # 0 cot 1234.5 0.95 567
156
+ # 1 react 890.2 0.92 423
157
+
158
+ # Compare patterns
159
+ comparison = analyzer.compare_patterns(df, ["cot", "react"], "latency_ms")
160
+ ```
161
+
162
+ **DataFrame Schema:**
163
+ ```python
164
+ df.columns
165
+ # ['dataset_name', 'item_id', 'run_id', 'pattern',
166
+ # 'timestamp', 'success', 'latency_ms', 'error',
167
+ # 'total_tokens', 'prompt_tokens', 'completion_tokens',
168
+ # 'tool_calls', 'llm_calls',
169
+ # 'config_*']
170
+ ```
171
+
172
+ ### 5. Pipeline plots (`plotnine` / `plot` steps)
173
+
174
+ Paper figures use **`type: plotnine`** in `experiment.yaml` experiment-level `post:`.
175
+ Ad-hoc charts from step data use **`type: plot`** with **`config.spec`** (plot library).
176
+
177
+ See [pipeline-steps.md](../../../../../../docs/pipeline-steps.md) and `labs/*/experiment.yaml` for examples.
178
+
179
+ ## Complete Example
180
+
181
+ ```python
182
+ import asyncio
183
+ from pathlib import Path
184
+ from mas.lab.benchmark import (
185
+ Dataset, ResultStorage, MultiRunOrchestrator,
186
+ ResultAnalyzer,
187
+ )
188
+
189
+ async def my_agent_factory(pattern_name, pattern_config):
190
+ # Your agent creation logic
191
+ pass
192
+
193
+ async def main():
194
+ # 1. Load dataset
195
+ dataset = Dataset.from_yaml("dataset.yaml")
196
+
197
+ # 2. Setup storage
198
+ storage = ResultStorage("./results")
199
+
200
+ # 3. Run benchmark
201
+ orchestrator = MultiRunOrchestrator(storage, n_runs=3)
202
+ await orchestrator.run_dataset(
203
+ dataset,
204
+ patterns={"cot": {}, "react": {}},
205
+ agent_factory=my_agent_factory
206
+ )
207
+
208
+ # 4. Analyze
209
+ analyzer = ResultAnalyzer(storage)
210
+ df = analyzer.consolidate_results(dataset.name)
211
+ stats = analyzer.compute_statistics(df)
212
+ print(stats)
213
+ # Plots: declare plotnine / plot steps in experiment.yaml post:
214
+
215
+ asyncio.run(main())
216
+ ```
217
+
218
+ ## Incremental Updates
219
+
220
+ ### Add Items
221
+ ```python
222
+ # Load existing dataset
223
+ dataset = Dataset.from_json("dataset.json")
224
+
225
+ # Add new items
226
+ dataset.items.append(DatasetItem(id="006", prompt="New question"))
227
+
228
+ # Save
229
+ dataset.to_json("dataset.json")
230
+
231
+ # Run benchmark (only new items executed)
232
+ await orchestrator.run_dataset(dataset, patterns, agent_factory)
233
+ ```
234
+
235
+ ### Add Runs
236
+ ```python
237
+ # Increase n_runs
238
+ orchestrator = MultiRunOrchestrator(storage, n_runs=5) # Was 3
239
+
240
+ # Run again - adds run_004, run_005 to existing items
241
+ await orchestrator.run_dataset(dataset, patterns, agent_factory)
242
+ ```
243
+
244
+ ### Add Patterns
245
+ ```python
246
+ # Add new pattern
247
+ patterns = {
248
+ "cot": {...},
249
+ "react": {...},
250
+ "planner": {...} # NEW
251
+ }
252
+
253
+ # Run again - only planner executed on all items
254
+ await orchestrator.run_dataset(dataset, patterns, agent_factory)
255
+ ```
256
+
257
+ ### Regenerate Plots
258
+ ```python
259
+ # Re-run pipeline post steps only (content-addressed trace cache skips LLM calls)
260
+ # mas-lab benchmark run experiment.yaml --force-post
261
+ ```
262
+
263
+ ## Advanced Usage
264
+
265
+ ### Custom Metrics
266
+
267
+ Extend `ResultAnalyzer._extract_event_metrics()`:
268
+
269
+ ```python
270
+ def _extract_event_metrics(self, events_file: Path) -> Dict[str, Any]:
271
+ metrics = super()._extract_event_metrics(events_file)
272
+
273
+ # Add custom metrics
274
+ metrics["my_custom_metric"] = ...
275
+
276
+ return metrics
277
+ ```
278
+
279
+ ### Custom Plots
280
+
281
+ Add a `plotnine` step in experiment-level `post:` or a plot-library YAML under
282
+ `pipeline/steps/plot_library/`. See `labs/design-space.lab/01-design-patterns/experiment.yaml`.
283
+
284
+ ### Parallel Execution
285
+
286
+ ```python
287
+ # Run patterns in parallel
288
+ import asyncio
289
+
290
+ async def run_pattern(pattern_name, pattern_config):
291
+ await orchestrator.run_dataset(
292
+ dataset,
293
+ patterns={pattern_name: pattern_config},
294
+ agent_factory=agent_factory
295
+ )
296
+
297
+ await asyncio.gather(
298
+ run_pattern("cot", {...}),
299
+ run_pattern("react", {...}),
300
+ )
301
+ ```
302
+
303
+ ## Dependencies
304
+
305
+ ```bash
306
+ pip install pandas pyarrow plotnine pyyaml
307
+ ```
308
+
309
+ ## Testing
310
+
311
+ ```bash
312
+ cd mas-lab
313
+ pytest tests/benchmark/
314
+ ```
315
+
316
+ ## Contributing
317
+
318
+ When adding new components:
319
+
320
+ 1. Follow existing patterns (DataClass for data, Class for behavior)
321
+ 2. Add docstrings with examples
322
+ 3. Write tests in `tests/benchmark/`
323
+ 4. Update this documentation