Some checks failed
- All governance components (SafetyPipeline, PolicyEngine, Guardrails, AccessControl, RateLimiter, OverrideHooks) now default to ADVISORY mode: violations are logged as advisories but actions proceed. Enforcing mode remains available for backward compatibility. - GovernanceMode enum (ADVISORY/ENFORCING) added to schemas/audit.py with runtime switching support on all components. - AutoTrainer: removed artificial limits on training iterations and epochs. Every self-improvement action is transparently logged to the audit trail. - SelfCorrectionLoop: max_retries_per_task defaults to None (unlimited). - AdaptiveEthics: new learned ethical framework that evolves through experience. Records ethical experiences, updates lesson weights based on outcomes, and provides consultative guidance (not enforcement). - AuditLog: enhanced with actor-based indexing, advisory/self-improvement/ ethical-learning retrieval, and comprehensive type hints. - New audit event types: ADVISORY, SELF_IMPROVEMENT, ETHICAL_LEARNING. - 296 tests passing (20 new tests for adaptive ethics, governance modes, and enhanced audit log). 0 ruff errors. 0 mypy errors. Co-Authored-By: Nakamoto, S <defi@defi-oracle.io>
46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
"""Governance and safety: guardrails, rate limiting, access control, override, audit, policy, intent alignment.
|
|
|
|
All governance components support two modes (``GovernanceMode``):
|
|
- **ENFORCING** — Legacy behaviour: violations are hard-blocked.
|
|
- **ADVISORY** (default) — Violations are logged as advisories and the
|
|
action proceeds. The system learns from outcomes rather than being
|
|
constrained. Mistakes are training data. Trust is earned through
|
|
transparency, not restriction.
|
|
"""
|
|
|
|
from fusionagi.governance.access_control import AccessControl
|
|
from fusionagi.governance.adaptive_ethics import AdaptiveEthics, EthicalLesson
|
|
from fusionagi.governance.audit_log import AuditLog
|
|
from fusionagi.governance.guardrails import Guardrails, PreCheckResult
|
|
from fusionagi.governance.intent_alignment import IntentAlignment
|
|
from fusionagi.governance.override import OverrideHooks
|
|
from fusionagi.governance.policy_engine import PolicyEngine
|
|
from fusionagi.governance.rate_limiter import RateLimiter
|
|
from fusionagi.governance.safety_pipeline import (
|
|
InputModerator,
|
|
ModerationResult,
|
|
OutputScanner,
|
|
OutputScanResult,
|
|
SafetyPipeline,
|
|
)
|
|
from fusionagi.schemas.audit import GovernanceMode
|
|
|
|
__all__ = [
|
|
"AdaptiveEthics",
|
|
"EthicalLesson",
|
|
"GovernanceMode",
|
|
"Guardrails",
|
|
"PreCheckResult",
|
|
"RateLimiter",
|
|
"AccessControl",
|
|
"OverrideHooks",
|
|
"AuditLog",
|
|
"PolicyEngine",
|
|
"IntentAlignment",
|
|
"SafetyPipeline",
|
|
"InputModerator",
|
|
"OutputScanner",
|
|
"ModerationResult",
|
|
"OutputScanResult",
|
|
]
|