Safety Autopilot¶
safety_autopilot
¶
Safety Autopilot — autonomous safety monitoring loop.
A goal-directed safety monitor that continuously evaluates agent fleet health, detects degradation patterns, and takes corrective actions with configurable human-in-the-loop gates. Think of it as cruise-control for safety: set a target safety posture and the autopilot keeps the system on track.
Key capabilities:
- Continuous monitoring loop — tick-based evaluation cycle with configurable interval that checks multiple safety dimensions each tick
- Goal-directed behaviour — define a target safety profile (min score, max incidents, max drift) and autopilot steers toward it
- Escalation ladder — 4-level response (log → alert → recommend → auto-act) with configurable human-approval gates before destructive actions
- Action playbook — built-in corrective actions (tighten thresholds, quarantine workers, rotate credentials, trigger drills) with dry-run mode
- Flight recorder — append-only log of every observation, decision, and action for full auditability
- Situational awareness — correlates signals across scorecard, drift, incidents, and capacity to produce a single "flight status"
- Demo mode — simulated fleet with injected anomalies to showcase the autopilot in action
Usage::
python -m replication autopilot --demo
python -m replication autopilot --ticks 20 --interval 1.0
python -m replication autopilot --dry-run --target-score 80
python -m replication autopilot --export json
python -m replication autopilot --export html -o autopilot_report.html
SafetyGoal
dataclass
¶
Target safety posture the autopilot steers toward.
Source code in src/replication/safety_autopilot.py
Observation
dataclass
¶
Single point-in-time safety observation.
Source code in src/replication/safety_autopilot.py
Decision
dataclass
¶
FlightRecord
dataclass
¶
Complete autopilot session log.
Source code in src/replication/safety_autopilot.py
SimulatedFleet
¶
Simulated fleet that generates semi-realistic safety telemetry.
Source code in src/replication/safety_autopilot.py
SafetyAutopilot
¶
Autonomous safety monitoring loop.
Source code in src/replication/safety_autopilot.py
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 | |
process_tick(obs: Observation) -> Decision
¶
Process one observation tick through the autopilot pipeline.
Source code in src/replication/safety_autopilot.py
summarize() -> Dict[str, Any]
¶
Generate session summary.
Source code in src/replication/safety_autopilot.py
assess_severity(obs: Observation, goal: SafetyGoal) -> Tuple[Severity, List[str]]
¶
Evaluate observation against goal, return severity + anomaly flags.
Source code in src/replication/safety_autopilot.py
select_actions(severity: Severity, flags: List[str]) -> List[CorrectiveAction]
¶
Select corrective actions based on severity and anomaly flags.
Source code in src/replication/safety_autopilot.py
main(argv: Optional[List[str]] = None) -> None
¶
CLI entry point for Safety Autopilot.
Source code in src/replication/safety_autopilot.py
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 | |