src.ai.decisions package#

AI Decision Components.

class src.ai.decisions.HybridDecisionFramework[source]#

Bases: object

Hybrid decision framework that merges rule-based safety with AI optimization.

Core principle: Rules provide mandatory safety constraints that AI cannot override. AI provides optimization and enhancement when rules allow the assignment.

__init__()[source]#
Return type:

None

async make_assignment_decision(task, context)[source]#

Make hybrid assignment decision combining rules with AI optimization.

Parameters:
Return type:

AssignmentDecision

Returns:

Assignment decision with reasoning and AI enhancements

async evaluate_assignment_quality(task, agent_id, assignment_outcome)[source]#

Evaluate the quality of a completed assignment for learning.

Parameters:
Return type:

Dict[str, Any]

Returns:

Assignment quality evaluation

async get_framework_stats()[source]#

Get framework performance statistics.

Return type:

Dict[str, Any]

async adjust_weights(rule_weight, ai_weight)[source]#

Adjust confidence weights (with safety constraints).

Parameters:
Return type:

bool

Returns:

True if weights were adjusted, False if rejected for safety

class src.ai.decisions.AssignmentDecision[source]#

Bases: object

Final decision on task assignment.

Represents the complete decision including rule validation, AI enhancement, and audit information.

allow#

Whether to allow the assignment

Type:

bool

confidence#

Overall confidence in decision (0.0-1.0)

Type:

float

reason#

Primary reason for the decision

Type:

str

ai_suggestions#

AI optimization suggestions if rules passed

Type:

AIOptimizationResult, optional

optimization_score#

AI’s score for assignment quality

Type:

float, optional

confidence_breakdown#

Detailed confidence components

Type:

dict, optional

safety_critical#

Whether safety rules were involved

Type:

bool

mandatory_rule_applied#

Whether mandatory rules were applied

Type:

bool

timestamp#

When the decision was made (auto-set)

Type:

datetime

__post_init__()[source]#

Automatically sets timestamp if not provided

Return type:

None

Examples

>>> decision = AssignmentDecision(
...     allow=True,
...     confidence=0.92,
...     reason="All validations passed"
... )
>>> print(f"Decision at {decision.timestamp}: {decision.allow}")
allow: bool#
confidence: float#
reason: str#
ai_suggestions: AIOptimizationResult | None = None#
optimization_score: float | None = None#
confidence_breakdown: Dict[str, float] | None = None#
safety_critical: bool = False#
mandatory_rule_applied: bool = False#
timestamp: datetime | None = None#
__post_init__()[source]#

Set timestamp if not provided.

Return type:

None

__init__(allow, confidence, reason, ai_suggestions=None, optimization_score=None, confidence_breakdown=None, safety_critical=False, mandatory_rule_applied=False, timestamp=None)#
Parameters:
Return type:

None

Submodules#