Analysis
Turns evaluation results into diagnoses: why traces failed, which failures share a cause, and what to change.
uaef.analysis.root_cause
Root cause analyzer for evaluation failures.
FailureCategory
Bases: BaseModel
Category of failure with associated metrics.
Attributes:
| Name | Type | Description |
|---|---|---|
category |
str
|
Type of failure (tool_selection, reasoning, context, response) |
failed_metrics |
List[str]
|
List of metric names that failed in this category |
severity |
str
|
Severity level (low, medium, high, critical) |
description |
str
|
Human-readable description of the failure |
Source code in uaef/analysis/root_cause.py
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 | |
Config
Pydantic configuration.
Source code in uaef/analysis/root_cause.py
36 37 38 39 40 41 42 43 44 45 | |
FailurePattern
Bases: BaseModel
Pattern identified across multiple evaluation failures.
Attributes:
| Name | Type | Description |
|---|---|---|
pattern_type |
str
|
Type of pattern (e.g., "consistent_tool_error", "context_loss") |
frequency |
int
|
Number of evaluations exhibiting this pattern |
affected_metrics |
List[str]
|
List of metrics commonly affected |
description |
str
|
Description of the pattern |
severity |
str
|
Average severity across occurrences |
recommendations |
List[str]
|
Recommendations to address this pattern |
Source code in uaef/analysis/root_cause.py
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 | |
Config
Pydantic configuration.
Source code in uaef/analysis/root_cause.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
RootCauseAnalyzer
Analyzer for identifying root causes of evaluation failures.
Provides methods for: - Analyzing individual evaluation failures - Identifying patterns across multiple failures - Categorizing failures by type - Generating actionable recommendations
Source code in uaef/analysis/root_cause.py
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 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | |
analyze_failure(evaluation_result)
Analyze a single failed evaluation to identify root causes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
evaluation_result
|
EvaluationResult
|
EvaluationResult with failures |
required |
Returns:
| Type | Description |
|---|---|
RootCauseReport
|
RootCauseReport with identified root causes and recommendations |
Raises:
| Type | Description |
|---|---|
ValueError
|
If evaluation_result passed (no failures to analyze) |
Example
analyzer = RootCauseAnalyzer() report = analyzer.analyze_failure(failed_evaluation) print(f"Primary root cause: {report.primary_root_cause}") print(f"Recommendations: {report.recommendations}")
Source code in uaef/analysis/root_cause.py
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 | |
identify_failure_patterns(evaluation_results)
Identify patterns across multiple evaluation failures.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
evaluation_results
|
List[EvaluationResult]
|
List of EvaluationResult instances (passed and failed) |
required |
Returns:
| Type | Description |
|---|---|
List[FailurePattern]
|
List of FailurePattern instances, sorted by frequency (descending) |
Example
analyzer = RootCauseAnalyzer() patterns = analyzer.identify_failure_patterns(evaluation_results) for pattern in patterns: ... print(f"{pattern.pattern_type}: {pattern.frequency} occurrences")
Source code in uaef/analysis/root_cause.py
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | |
RootCauseReport
Bases: BaseModel
Root cause analysis report for a failed evaluation.
Attributes:
| Name | Type | Description |
|---|---|---|
evaluation_id |
str
|
ID of the evaluated trace |
trace_id |
str
|
ID of the agent trace |
failure_categories |
List[FailureCategory]
|
List of identified failure categories |
primary_root_cause |
str
|
Most likely root cause |
recommendations |
List[str]
|
List of actionable recommendations |
details |
Dict[str, Any]
|
Additional details about the analysis |
Source code in uaef/analysis/root_cause.py
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 | |
Config
Pydantic configuration.
Source code in uaef/analysis/root_cause.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
uaef.analysis.clustering
Failure clustering for identifying common failure modes.
FailureCluster
Bases: BaseModel
A cluster of similar failures.
Attributes:
| Name | Type | Description |
|---|---|---|
cluster_id |
int
|
Unique identifier for this cluster |
size |
int
|
Number of failures in this cluster |
evaluation_ids |
List[str]
|
List of evaluation IDs in this cluster |
common_failures |
List[str]
|
List of failure messages common to this cluster |
common_metrics |
List[str]
|
Metrics that commonly failed in this cluster |
severity |
str
|
Average severity of failures in this cluster |
summary |
str
|
Human-readable summary of the cluster |
representative_failure |
Optional[str]
|
Most representative failure in the cluster |
Source code in uaef/analysis/clustering.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 70 71 72 73 74 75 76 77 78 79 | |
Config
Pydantic configuration.
Source code in uaef/analysis/clustering.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
FailureClusterer
Clusterer for identifying common failure modes across evaluations.
Provides methods for: - Clustering failures based on similarity - Supporting multiple clustering algorithms (k-means, hierarchical) - Generating cluster summaries - Identifying common failure patterns
Source code in uaef/analysis/clustering.py
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 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 | |
cluster_failures(evaluation_results, method='hierarchical', n_clusters=None)
Cluster failures based on similarity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
evaluation_results
|
List[EvaluationResult]
|
List of evaluation results to cluster |
required |
method
|
Literal['kmeans', 'hierarchical']
|
Clustering method ("kmeans" or "hierarchical") |
'hierarchical'
|
n_clusters
|
Optional[int]
|
Number of clusters for k-means (auto-detected if None) |
None
|
Returns:
| Type | Description |
|---|---|
List[FailureCluster]
|
List of failure clusters |
Raises:
| Type | Description |
|---|---|
ValueError
|
If inputs are invalid or clustering fails |
Source code in uaef/analysis/clustering.py
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 | |
uaef.analysis.trends
Trend analyzer for tracking metric changes over time.
Anomaly
Bases: BaseModel
Detected anomaly in metric values.
Attributes:
| Name | Type | Description |
|---|---|---|
metric_name |
str
|
Name of the metric with anomaly |
value |
float
|
Anomalous value |
timestamp |
datetime
|
When the anomaly occurred |
expected_range |
Tuple[float, float]
|
Expected range (min, max) based on historical data |
z_score |
float
|
Z-score of the anomalous value |
severity |
Literal['low', 'medium', 'high', 'critical']
|
Severity level (low, medium, high, critical) |
description |
str
|
Human-readable description of the anomaly |
Source code in uaef/analysis/trends.py
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 | |
Config
Pydantic configuration.
Source code in uaef/analysis/trends.py
108 109 110 111 112 113 114 115 116 117 118 119 120 | |
MetricTrend
Bases: BaseModel
Trend information for a specific metric.
Attributes:
| Name | Type | Description |
|---|---|---|
metric_name |
str
|
Name of the metric |
values |
List[float]
|
List of metric values over time |
timestamps |
List[datetime]
|
List of timestamps corresponding to values |
trend_direction |
Literal['improving', 'declining', 'stable']
|
Overall trend direction (improving, declining, stable) |
slope |
float
|
Linear regression slope (positive = improving) |
mean |
float
|
Mean value across all data points |
std_dev |
float
|
Standard deviation |
min_value |
float
|
Minimum value |
max_value |
float
|
Maximum value |
change_percentage |
float
|
Percentage change from first to last value |
Source code in uaef/analysis/trends.py
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 | |
Config
Pydantic configuration.
Source code in uaef/analysis/trends.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
TrendAnalyzer
Analyzer for tracking metric trends over time.
Provides methods for: - Analyzing metric trends across experiment runs - Detecting anomalies using statistical methods - Tracking metric changes over time - Generating trend reports with visualizations
Source code in uaef/analysis/trends.py
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 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 | |
analyze_metric_trends(evaluation_results, metric_name=None)
Analyze metric trends over time across evaluation results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
evaluation_results
|
List[EvaluationResult]
|
List of evaluation results ordered by time |
required |
metric_name
|
Optional[str]
|
Specific metric to analyze (None = analyze all metrics) |
None
|
Returns:
| Type | Description |
|---|---|
TrendReport
|
TrendReport with trend analysis for requested metrics |
Raises:
| Type | Description |
|---|---|
ValueError
|
If insufficient data or invalid inputs |
Example
analyzer = TrendAnalyzer() report = analyzer.analyze_metric_trends(results, "tool_accuracy") print(f"Trend: {report.metric_trends['tool_accuracy'].trend_direction}") print(f"Change: {report.metric_trends['tool_accuracy'].change_percentage:.1f}%")
Source code in uaef/analysis/trends.py
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 299 300 301 302 303 304 305 | |
detect_anomalies(evaluation_results, metric_name=None, method='zscore')
Detect statistical anomalies in metric values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
evaluation_results
|
List[EvaluationResult]
|
List of evaluation results |
required |
metric_name
|
Optional[str]
|
Specific metric to check (None = check all metrics) |
None
|
method
|
Literal['zscore', 'iqr']
|
Anomaly detection method ("zscore" or "iqr") |
'zscore'
|
Returns:
| Type | Description |
|---|---|
List[Anomaly]
|
List of detected anomalies |
Raises:
| Type | Description |
|---|---|
ValueError
|
If insufficient data or invalid inputs |
Example
analyzer = TrendAnalyzer() anomalies = analyzer.detect_anomalies(results, method="zscore") for anomaly in anomalies: ... print(f"{anomaly.metric_name}: {anomaly.description}")
Source code in uaef/analysis/trends.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | |
TrendReport
Bases: BaseModel
Comprehensive trend analysis report.
Attributes:
| Name | Type | Description |
|---|---|---|
metric_trends |
Dict[str, MetricTrend]
|
Dictionary mapping metric names to their trends |
anomalies |
List[Anomaly]
|
List of detected anomalies |
summary |
str
|
High-level summary of trends |
time_range |
Tuple[datetime, datetime]
|
Time range covered by the analysis (start, end) |
total_data_points |
int
|
Total number of data points analyzed |
metrics_analyzed |
int
|
Number of unique metrics analyzed |
Source code in uaef/analysis/trends.py
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 | |
Config
Pydantic configuration.
Source code in uaef/analysis/trends.py
158 159 160 161 162 163 164 165 166 167 168 169 | |
uaef.analysis.improvement_tracker
Improvement tracker for monitoring recommendation implementation and impact.
ImprovementDelta
Bases: BaseModel
Calculated improvement delta for a metric.
Attributes:
| Name | Type | Description |
|---|---|---|
metric_name |
str
|
Name of the metric |
baseline_value |
float
|
Value before implementation |
post_implementation_value |
float
|
Value after implementation |
absolute_change |
float
|
Absolute change (post - baseline) |
percentage_change |
float
|
Percentage change ((post - baseline) / baseline * 100) |
improved |
bool
|
Whether the metric improved (positive change) |
Source code in uaef/analysis/improvement_tracker.py
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 | |
Config
Pydantic configuration.
Source code in uaef/analysis/improvement_tracker.py
117 118 119 120 121 122 123 124 125 126 127 128 | |
ImprovementReport
Bases: BaseModel
Report showing before/after comparison for a recommendation.
Attributes:
| Name | Type | Description |
|---|---|---|
recommendation_id |
UUID
|
ID of the tracked recommendation |
recommendation_title |
str
|
Title of the recommendation |
recommendation_category |
str
|
Category of the recommendation |
status |
Literal['pending', 'in_progress', 'completed']
|
Current implementation status |
metric_deltas |
List[ImprovementDelta]
|
List of improvement deltas for affected metrics |
overall_improvement |
str
|
Overall improvement summary |
implementation_duration_days |
Optional[float]
|
Days from start to completion (if completed) |
created_at |
datetime
|
When tracking started |
completed_at |
Optional[datetime]
|
When implementation completed (if completed) |
notes |
str
|
Implementation notes |
Source code in uaef/analysis/improvement_tracker.py
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 | |
Config
Pydantic configuration.
Source code in uaef/analysis/improvement_tracker.py
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 | |
ImprovementTracker
Tracker for monitoring recommendation implementation and measuring impact.
Tracks: - Recommendation implementation status (pending, in_progress, completed) - Baseline metrics before implementation - Post-implementation metrics - Improvement deltas and percentage changes - Multiple recommendations simultaneously
Provides: - Before/after comparison reports - Impact measurement for completed recommendations - Status tracking across multiple recommendations
Source code in uaef/analysis/improvement_tracker.py
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 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 | |
generate_improvement_report(recommendation_id)
Generate an improvement report for a tracked recommendation.
Shows before/after comparison with improvement deltas.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recommendation_id
|
UUID
|
ID of the tracked recommendation |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ImprovementReport |
ImprovementReport
|
Report with before/after comparison |
Raises:
| Type | Description |
|---|---|
ValueError
|
If recommendation ID not found or not completed |
Example
report = tracker.generate_improvement_report(rec_id) for delta in report.metric_deltas: ... print(f"{delta.metric_name}: {delta.percentage_change:.1f}%")
Source code in uaef/analysis/improvement_tracker.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | |
generate_summary_report()
Generate a summary report of all tracked recommendations.
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dictionary with summary statistics and reports |
Example
summary = tracker.generate_summary_report() print(f"Total tracked: {summary['total_tracked']}") print(f"Completed: {summary['completed_count']}")
Source code in uaef/analysis/improvement_tracker.py
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | |
get_all_tracked_recommendations()
Get all tracked recommendations.
Returns:
| Type | Description |
|---|---|
List[RecommendationStatus]
|
List of all RecommendationStatus objects |
Example
all_recs = tracker.get_all_tracked_recommendations() for rec in all_recs: ... print(f"{rec.recommendation.title}: {rec.status}")
Source code in uaef/analysis/improvement_tracker.py
430 431 432 433 434 435 436 437 438 439 440 441 442 | |
get_recommendations_by_status(status)
Get tracked recommendations filtered by status.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
status
|
Literal['pending', 'in_progress', 'completed']
|
Status to filter by |
required |
Returns:
| Type | Description |
|---|---|
List[RecommendationStatus]
|
List of RecommendationStatus objects with the specified status |
Example
pending = tracker.get_recommendations_by_status("pending") print(f"Pending recommendations: {len(pending)}")
Source code in uaef/analysis/improvement_tracker.py
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | |
mark_completed(recommendation_id, post_implementation_evaluation_results, notes='')
Mark a recommendation as completed and record post-implementation metrics.
Calculates improvement deltas and generates a before/after report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recommendation_id
|
UUID
|
ID of the tracked recommendation |
required |
post_implementation_evaluation_results
|
List[EvaluationResult]
|
Evaluation results after implementation |
required |
notes
|
str
|
Optional notes about the implementation |
''
|
Returns:
| Name | Type | Description |
|---|---|---|
ImprovementReport |
ImprovementReport
|
Report showing before/after comparison |
Raises:
| Type | Description |
|---|---|
ValueError
|
If recommendation ID not found or no post-implementation results |
Example
report = tracker.mark_completed(rec_id, post_results, "Tool added successfully") print(f"Overall improvement: {report.overall_improvement}")
Source code in uaef/analysis/improvement_tracker.py
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | |
mark_in_progress(recommendation_id, notes='')
Mark a recommendation as in progress.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recommendation_id
|
UUID
|
ID of the tracked recommendation |
required |
notes
|
str
|
Optional notes about the implementation |
''
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If recommendation ID not found or already completed |
Example
tracker.mark_in_progress(rec_id, "Started implementing tool")
Source code in uaef/analysis/improvement_tracker.py
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 299 300 301 302 303 | |
start_tracking(recommendation, baseline_evaluation_results)
Start tracking a recommendation implementation.
Records baseline metrics from evaluation results before implementation begins.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recommendation
|
Recommendation
|
The recommendation to track |
required |
baseline_evaluation_results
|
List[EvaluationResult]
|
Evaluation results before implementation |
required |
Returns:
| Name | Type | Description |
|---|---|---|
UUID |
UUID
|
Recommendation tracking ID |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no baseline evaluation results provided |
Example
tracker = ImprovementTracker() rec_id = tracker.start_tracking(recommendation, baseline_results) print(f"Tracking recommendation: {rec_id}")
Source code in uaef/analysis/improvement_tracker.py
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 | |
RecommendationStatus
Bases: BaseModel
Status tracking for a recommendation implementation.
Attributes:
| Name | Type | Description |
|---|---|---|
recommendation_id |
UUID
|
Unique identifier for this recommendation tracking |
recommendation |
Recommendation
|
The recommendation being tracked |
status |
Literal['pending', 'in_progress', 'completed']
|
Current implementation status |
baseline_metrics |
Dict[str, float]
|
Metric values before implementation |
post_implementation_metrics |
Dict[str, float]
|
Metric values after implementation (if completed) |
created_at |
datetime
|
When tracking started |
started_at |
Optional[datetime]
|
When implementation started (if in_progress or completed) |
completed_at |
Optional[datetime]
|
When implementation completed (if completed) |
notes |
str
|
Implementation notes or observations |
Source code in uaef/analysis/improvement_tracker.py
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 | |
Config
Pydantic configuration.
Source code in uaef/analysis/improvement_tracker.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
uaef.analysis.recommendations
Recommendation engine for agent improvement insights.
Recommendation
Bases: BaseModel
A specific, actionable recommendation for agent improvement.
Attributes:
| Name | Type | Description |
|---|---|---|
category |
Literal['prompt', 'tool', 'architecture', 'reasoning', 'context', 'safety']
|
Category of recommendation (prompt, tool, architecture, reasoning) |
priority |
Literal['critical', 'high', 'medium', 'low']
|
Priority level (critical, high, medium, low) |
title |
str
|
Short title of the recommendation |
description |
str
|
Detailed description of the issue and recommendation |
rationale |
str
|
Why this recommendation is being made |
impact |
str
|
Expected impact if implemented |
examples |
List[str]
|
Examples from high-scoring test cases (if applicable) |
affected_metrics |
List[str]
|
Metrics that would improve with this recommendation |
implementation_steps |
List[str]
|
Specific steps to implement the recommendation |
Source code in uaef/analysis/recommendations.py
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 | |
Config
Pydantic configuration.
Source code in uaef/analysis/recommendations.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
RecommendationEngine
Engine for generating actionable recommendations for agent improvement.
Integrates with RootCauseAnalyzer, FailureClusterer, and TrendAnalyzer to: - Identify systemic issues across evaluations - Generate category-specific recommendations - Prioritize recommendations by impact - Provide examples from successful test cases - Suggest specific implementation steps
Source code in uaef/analysis/recommendations.py
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 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 | |
generate_recommendations(evaluation_results, include_examples=True)
Generate comprehensive recommendations based on evaluation results.
Analyzes failure patterns, clusters, and trends to provide: - Specific, actionable recommendations - Prioritization by impact - Examples from high-scoring test cases - Implementation guidance
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
evaluation_results
|
List[EvaluationResult]
|
List of evaluation results to analyze |
required |
include_examples
|
bool
|
Whether to include examples from successful cases |
True
|
Returns:
| Type | Description |
|---|---|
RecommendationReport
|
RecommendationReport with prioritized recommendations |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no evaluation results provided or analysis fails |
Example
engine = RecommendationEngine() report = engine.generate_recommendations(evaluation_results) for rec in report.recommendations[:3]: ... print(f"{rec.priority}: {rec.title}")
Source code in uaef/analysis/recommendations.py
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 299 300 301 302 303 304 305 306 307 308 309 | |
RecommendationReport
Bases: BaseModel
Comprehensive recommendation report for agent improvement.
Attributes:
| Name | Type | Description |
|---|---|---|
recommendations |
List[Recommendation]
|
List of recommendations sorted by priority |
summary |
str
|
High-level summary of key findings |
total_evaluations |
int
|
Total number of evaluations analyzed |
failed_evaluations |
int
|
Number of failed evaluations |
success_rate |
float
|
Overall success rate (0-1) |
top_issues |
List[str]
|
Top 3 most common issues identified |
improvement_potential |
str
|
Estimated improvement potential if recommendations implemented |
Source code in uaef/analysis/recommendations.py
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 | |
Config
Pydantic configuration.
Source code in uaef/analysis/recommendations.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
uaef.insights.generator
LLM-powered insight generation for evaluation reports.
Reads a report.md file, sends it to Bedrock, and writes insights.md to the same report directory.
generate_insights(report_dir, *, report_type=None, model_id=None)
Generate LLM-powered insights for an existing report.
Reads report.md from the given report directory, sends it to Bedrock for analysis, and writes insights.md to the same directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
report_dir
|
str
|
Path to the report directory (must contain report.md) |
required |
report_type
|
Optional[str]
|
"single" or "comparison" (auto-detected if None) |
None
|
model_id
|
Optional[str]
|
Override the model ID from config (optional) |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Path to the generated insights.md file |
Examples:
>>> from uaef.insights import generate_insights
>>> insights_path = generate_insights("output/reports/full_report_20260602_125549")
Source code in uaef/insights/generator.py
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 | |