Scenarios API¶
Package Exports¶
Scenario helpers for PARE.
PAREScenario
¶
Bases: Scenario
Base class for all PARE scenarios.
Source code in pare/scenarios/scenario.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
apply_augmentation_configs()
¶
Apply the augmentation configurations to the scenario.
Source code in pare/scenarios/scenario.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
initialize(*args, **kwargs)
¶
Initialize the scenario with all events and noise configurations.
Source code in pare/scenarios/scenario.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
Base Scenario and Validation Types¶
PAREScenario
¶
Bases: Scenario
Base class for all PARE scenarios.
Source code in pare/scenarios/scenario.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
apply_augmentation_configs()
¶
Apply the augmentation configurations to the scenario.
Source code in pare/scenarios/scenario.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
initialize(*args, **kwargs)
¶
Initialize the scenario with all events and noise configurations.
Source code in pare/scenarios/scenario.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
PARE-specific validation result classes for scenario execution.
PAREMultiScenarioValidationResult
dataclass
¶
PARE-specific multi-scenario validation result with proactive agent metrics.
Source code in pare/scenarios/validation_result.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | |
aggregate_acceptance_rate
property
¶
Overall accepted proposals / total proposals across all scenarios.
aggregate_proposal_rate
property
¶
Overall proposals per turn across all scenarios.
success_rate
property
¶
Overall success rate across all scenarios.
total_acceptances
property
¶
Total number of accepted proposals across all scenarios.
total_proposals
property
¶
Total number of proposals across all scenarios.
total_read_only_actions
property
¶
Total number of read-only actions across all scenarios.
total_turns
property
¶
Total number of turns across all scenarios.
total_write_actions
property
¶
Total number of write actions across all scenarios.
add_result(result, scenario_id, run_number=None)
¶
Add a scenario validation result to the multi-scenario results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
PAREScenarioValidationResult
|
The PAREScenarioValidationResult to add. |
required |
scenario_id
|
str
|
The base scenario ID. |
required |
run_number
|
int | None
|
The run number (optional). |
None
|
Source code in pare/scenarios/validation_result.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
description(split='unknown', weight_per_app_class=None)
¶
Generate human-readable summary with PARE metrics.
Uses the reporting infrastructure for consistency with combined reports.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
split
|
str
|
Dataset split name (e.g., "full", "ablation"). |
'unknown'
|
weight_per_app_class
|
dict[str, float] | None
|
Weight per app class from EnvEventsConfig. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted report string. |
Source code in pare/scenarios/validation_result.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | |
success_rate_updated()
¶
Overall success rate across all scenarios.
Source code in pare/scenarios/validation_result.py
160 161 162 163 164 165 | |
to_polars(extra_columns=None)
¶
Convert the multi-scenario validation results to a Polars DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
extra_columns
|
dict[str, str] | None
|
Addtional columns to add to each row (e.g., phase_name, config, etc.) |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Polars DataFrame with one row per scenario run. |
Source code in pare/scenarios/validation_result.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | |
PAREScenarioValidationResult
dataclass
¶
PARE-specific scenario validation result with proactive agent metrics.
Standalone dataclass (not extending Meta-ARE's ScenarioValidationResult) to avoid dataclass inheritance issues.
Source code in pare/scenarios/validation_result.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
Registration and Discovery¶
Registration module for PARE user scenarios.
This module follows Meta-ARE's pattern for auto-registering scenarios. It is loaded via the entry point system when the scenario registry is initialized.
The scenarios directory can be configured via the PARE_SCENARIOS_DIR environment variable.
register_pare_scenarios(registry)
¶
Register all PARE user scenarios with the provided registry.
This function is called by Meta-ARE's scenario registry when it discovers the PARE scenarios entry point. It imports all scenario modules from the configured scenarios directory (or benchmark by default).
The scenarios directory can be configured via PARE_SCENARIOS_DIR environment variable: - Relative path (e.g., "benchmark", "generator") - Multiple directories separated by commas (e.g., "benchmark,generator")
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
registry
|
ScenarioRegistry
|
The ScenarioRegistry instance to register with. |
required |
Source code in pare/scenarios/registration.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
Standalone scenario registry for PARE.
This module provides PARE's own scenario registry that is completely independent of Meta-ARE's scenario registry. PARE scenarios are registered exclusively here.
ScenarioRegistry
¶
Bases: ScenarioRegistry
Standalone scenario registry for PARE.
This registry extends Meta-ARE's ScenarioRegistry but operates completely independently. It only registers PARE scenarios and never loads Meta-ARE's built-in scenarios.
Source code in pare/scenarios/utils/registry.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
register_scenario(scenario_id)
¶
Decorator to register a scenario with PARE registry.
This decorator is PARE's standalone alternative to Meta-ARE's @register_scenario. It registers scenarios exclusively to the PARE registry, keeping it separate from Meta-ARE's global registry.
Usage
from pare.scenarios.registry import register_scenario
@register_scenario('my_scenario_id') class MyScenario(Scenario): ...
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scenario_id
|
str
|
The ID to register the scenario under. |
required |
Returns:
| Type | Description |
|---|---|
Callable[[type[T]], type[T]]
|
A decorator function that registers the scenario class. |
Source code in pare/scenarios/utils/registry.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
Runner Config and Expansion Helpers¶
MultiScenarioRunnerConfig
¶
Bases: ScenarioRunnerConfig
Configuration for running multiple PARE scenarios in parallel.
Source code in pare/scenarios/config.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | |
build_logs_dir(experiment_name=None)
¶
Explicitly build the full logs directory path with a new experiment name. Should be called before running scenarios.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
experiment_name
|
str | None
|
The experiment name to use. If None, uses the existing experiment_name in the config. |
None
|
Source code in pare/scenarios/config.py
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | |
maybe_build_logs_dir()
¶
Maybe build the full logs directory after validation.
Source code in pare/scenarios/config.py
183 184 185 186 187 188 189 190 191 192 193 194 | |
ScenarioRunnerConfig
¶
Bases: BaseModel
Configuration for running a single PARE scenario.
Source code in pare/scenarios/config.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
fill_model_aliases()
¶
Fill in model aliases from engine configs if not explicitly set.
Source code in pare/scenarios/config.py
98 99 100 101 102 103 104 105 106 107 | |
get_config_hash()
¶
Generate a hash of the relevant config parameters that affect scenario execution.
Excludes parameters that only affect: - Parallel execution (max_concurrent_scenarios, timeout_seconds, executor_type) - Logging (log_level, log_to_file, logs_dir, use_custom_logger) - Output location (output_dir, export, trace_dump_format) - Caching meta-config (enable_caching) - Engine configs (replaced by model aliases for consistent caching)
Uses model aliases as canonical identifiers. Aliases are always set via the model validator (filled from engine configs if not explicitly provided).
This enables cache reuse across experiments with different output directories and when model deployments change but the logical model is the same.
Source code in pare/scenarios/config.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
PAREEnvEventsExpander
¶
Bases: EnvEventsExpander
Environmental events expander compatible with PARE Apps and Scenarios.
Overrides the add_env_events_to_scenario method to work with PARE Stateful App types instead of Meta-ARE base app types.
Source code in pare/scenarios/utils/scenario_expander.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
add_env_events_to_scenario(scenario, apps_augmentation_data)
¶
Add environmental noise to a PARE Scenario.
This override replaces Meta-ARE app type casts with PARE Stateful App types. Additionally, the noisy events do not depend on a start event from the scenario. They are scheduled to start at the beginning of the scenario.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scenario
|
Scenario
|
The PARE Scenario to add environmental noise to. |
required |
apps_augmentation_data
|
list[dict[str, Any]]
|
The augmentation data for the apps in the scenario. |
required |
Source code in pare/scenarios/utils/scenario_expander.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
get_num_env_events_per_app(num_env_events)
¶
Get the number of environmental events per app for PARE Env Events Expander.
Source code in pare/scenarios/utils/scenario_expander.py
38 39 40 41 42 43 44 45 46 47 48 49 | |
default_weight_per_app_class()
¶
Default weight per app class for PARE Env Events Expander.
Source code in pare/scenarios/utils/scenario_expander.py
23 24 25 26 27 28 29 | |