Skip to content

feat: add graceful degradation helpers and no-op fallbacks #410

@imran-siddique

Description

@imran-siddique

Summary

Every toolkit consumer implements the same try/except import pattern for graceful degradation when toolkit packages are optional:

try:
    from agent_os_kernel import PolicyEvaluator
    _TOOLKIT_AVAILABLE = True
except ImportError:
    _TOOLKIT_AVAILABLE = False

This pattern appears in 5+ files in ai-native-team daemon (trust.py, reliability.py, authority.py, governance.py, conversation_guardian.py).

Proposal

The toolkit should provide:

  • governance.available() -> bool — check if toolkit is installed
  • No-op fallback implementations that pass-through without enforcement
  • A single import: from agent_governance_toolkit import get_policy_evaluator (returns real or no-op)
  • Optional dependency marker so consumers can pip install agent-governance-toolkit[full] or agent-governance-toolkit[minimal]

Why This Matters

Graceful degradation is essential for tools that work both with and without the full governance stack. But each consumer reimplements identical try/except blocks, leading to inconsistent fallback behavior and boilerplate.

Real-World Evidence

ai-native-team daemon has this exact pattern in 5 files, each with slightly different fallback behavior. A toolkit-native solution would standardize this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions