framework.approval.ApprovalDecision#
- class framework.approval.ApprovalDecision(needs_approval, reasoning)[source]#
Bases:
NamedTuple
Structured result of an approval evaluation decision.
Represents the outcome of an approval evaluation with both the decision and the reasoning behind it. This structured approach ensures consistent decision reporting across all evaluators and provides clear audit trails for approval decisions.
- Parameters:
needs_approval (bool) – Whether human approval is required for the operation
reasoning (str) – Human-readable explanation of the decision logic
Examples
Approval required decision:
>>> decision = ApprovalDecision( ... needs_approval=True, ... reasoning="Code contains EPICS write operations" ... ) >>> print(f"Decision: {decision.needs_approval}") >>> print(f"Reason: {decision.reasoning}")
No approval needed:
>>> decision = ApprovalDecision( ... needs_approval=False, ... reasoning="Python execution approval is disabled" ... )
Note
The reasoning field is crucial for logging, debugging, and providing clear feedback to users about why approval was or wasn’t required.
See also
PythonExecutionApprovalEvaluator
: Evaluator class that returns this decisionMemoryApprovalEvaluator
: Evaluator class that returns this decisionframework.approval.create_code_approval_interrupt()
: Uses reasoning for user messagesCreate new instance of ApprovalDecision(needs_approval, reasoning)
- needs_approval: bool#
Alias for field number 0
- reasoning: str#
Alias for field number 1