Package dev.agenor.core.hitl
Interface ApprovalDecision
- All Known Implementing Classes:
ApprovalDecision.Approved,ApprovalDecision.Modified,ApprovalDecision.Rejected
public sealed interface ApprovalDecision
permits ApprovalDecision.Approved, ApprovalDecision.Rejected, ApprovalDecision.Modified
Outcome of a human approval request.
Three mutually exclusive variants are modeled as records inside this sealed
interface, enabling exhaustive switch expressions with full compiler
enforcement (Java 21+):
ApprovalDecision decision = gate.requestApproval(request).join();
switch (decision) {
case ApprovalDecision.Approved a -> executeAction(request.payload());
case ApprovalDecision.Rejected r -> log.warn("Rejected: {}", r.reason());
case ApprovalDecision.Modified m -> executeAction(m.newPayload());
}
- Since:
- 0.13.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordThe action is approved; the agent proceeds with the original payload.static final recordThe action is approved with a modified payload; the agent executes withApprovalDecision.Modified.newPayload()instead of the original.static final recordThe action is rejected; the agent must not execute it.