Skip to content

Commit e92d03c

Browse files
feat(types): add require_approval action for HITL workflows (#12)
Add REQUIRE_APPROVAL to PolicyAction and OverrideAction enums to support Human-in-the-Loop (HITL) workflows for AI oversight. The require_approval action: - Enterprise: Pauses execution and creates an approval request in the HITL queue - Community: Auto-approves immediately (upgrade path to Enterprise) Use cases: - EU AI Act Article 14 compliance (human oversight for high-risk AI) - SEBI AI/ML Circular (high-value transaction oversight) - Admin access detection and sensitive data access control
1 parent 9a24a05 commit e92d03c

2 files changed

Lines changed: 24 additions & 5 deletions

File tree

src/main/java/com/getaxonflow/sdk/types/policies/PolicyTypes.java

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,20 @@ public String getValue() {
8484

8585
/**
8686
* Override action for policy overrides.
87+
* <ul>
88+
* <li>BLOCK: Immediately block the request</li>
89+
* <li>REQUIRE_APPROVAL: Pause for human approval (HITL)</li>
90+
* <li>REDACT: Mask sensitive content</li>
91+
* <li>WARN: Log warning, allow request</li>
92+
* <li>LOG: Audit only</li>
93+
* </ul>
8794
*/
8895
public enum OverrideAction {
8996
BLOCK("block"),
97+
REQUIRE_APPROVAL("require_approval"),
98+
REDACT("redact"),
9099
WARN("warn"),
91-
LOG("log"),
92-
REDACT("redact");
100+
LOG("log");
93101

94102
private final String value;
95103

@@ -105,12 +113,21 @@ public String getValue() {
105113

106114
/**
107115
* Action to take when a policy matches.
116+
* <ul>
117+
* <li>BLOCK: Immediately block the request</li>
118+
* <li>REQUIRE_APPROVAL: Pause for human approval (HITL)</li>
119+
* <li>REDACT: Mask sensitive content</li>
120+
* <li>WARN: Log warning, allow request</li>
121+
* <li>LOG: Audit only</li>
122+
* <li>ALLOW: Explicitly allow (for overrides)</li>
123+
* </ul>
108124
*/
109125
public enum PolicyAction {
110126
BLOCK("block"),
127+
REQUIRE_APPROVAL("require_approval"),
128+
REDACT("redact"),
111129
WARN("warn"),
112130
LOG("log"),
113-
REDACT("redact"),
114131
ALLOW("allow");
115132

116133
private final String value;

src/test/java/com/getaxonflow/sdk/PolicyTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,18 +649,20 @@ void policyTierEnumValuesShouldSerializeCorrectly() {
649649
@DisplayName("OverrideAction enum values should serialize correctly")
650650
void overrideActionEnumValuesShouldSerializeCorrectly() {
651651
assertThat(OverrideAction.BLOCK.getValue()).isEqualTo("block");
652+
assertThat(OverrideAction.REQUIRE_APPROVAL.getValue()).isEqualTo("require_approval");
653+
assertThat(OverrideAction.REDACT.getValue()).isEqualTo("redact");
652654
assertThat(OverrideAction.WARN.getValue()).isEqualTo("warn");
653655
assertThat(OverrideAction.LOG.getValue()).isEqualTo("log");
654-
assertThat(OverrideAction.REDACT.getValue()).isEqualTo("redact");
655656
}
656657

657658
@Test
658659
@DisplayName("PolicyAction enum values should serialize correctly")
659660
void policyActionEnumValuesShouldSerializeCorrectly() {
660661
assertThat(PolicyAction.BLOCK.getValue()).isEqualTo("block");
662+
assertThat(PolicyAction.REQUIRE_APPROVAL.getValue()).isEqualTo("require_approval");
663+
assertThat(PolicyAction.REDACT.getValue()).isEqualTo("redact");
661664
assertThat(PolicyAction.WARN.getValue()).isEqualTo("warn");
662665
assertThat(PolicyAction.LOG.getValue()).isEqualTo("log");
663-
assertThat(PolicyAction.REDACT.getValue()).isEqualTo("redact");
664666
assertThat(PolicyAction.ALLOW.getValue()).isEqualTo("allow");
665667
}
666668
}

0 commit comments

Comments
 (0)