Skip to content

Commit 2919295

Browse files
l46kokcopybara-github
authored andcommitted
Add agent_tool_execution_governance aggregate policy to conformance test
PiperOrigin-RevId: 963051344
1 parent 01bcc1c commit 2919295

4 files changed

Lines changed: 159 additions & 0 deletions

File tree

conformance/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ exports_files(
2121
)
2222

2323
_TEST_DIRS = [
24+
"agent_tool_execution_governance",
2425
"context_pb",
2526
"k8s",
2627
"limits",
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: agent_tool_execution_governance
16+
variables:
17+
- name: "request.is_emergency"
18+
type_name: "bool"
19+
- name: "request.env"
20+
type_name: "string"
21+
- name: "tool.is_mutation"
22+
type_name: "bool"
23+
- name: "tool.call.args"
24+
type_name: "map"
25+
params:
26+
- type_name: "string"
27+
- type_name: "dyn"
28+
functions:
29+
- name: "classifier.has_credit_card"
30+
overloads:
31+
- id: "classifier_has_credit_card"
32+
args:
33+
- type_name: "dyn"
34+
return:
35+
type_name: "bool"
36+
- name: "classifier.has_email_or_phone"
37+
overloads:
38+
- id: "classifier_has_email_or_phone"
39+
args:
40+
- type_name: "dyn"
41+
return:
42+
type_name: "bool"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: agent_tool_execution_governance
16+
rule:
17+
aggregate:
18+
# Dimension 1: Approval Requirements (First-Match Escalation)
19+
- rule:
20+
match:
21+
- condition: "request.is_emergency"
22+
output: "'REQUIRE_VP_APPROVAL'"
23+
- condition: "tool.is_mutation && request.env == 'prod'"
24+
output: "'REQUIRE_TECH_LEAD_2FA'"
25+
- condition: "tool.is_mutation"
26+
output: "'REQUIRE_PEER_CONFIRMATION'"
27+
28+
# Dimension 2: Data Redaction (First-Match Specificity)
29+
- rule:
30+
match:
31+
- condition: "classifier.has_credit_card(tool.call.args)"
32+
output: "'REDACT_PCI'"
33+
- condition: "classifier.has_email_or_phone(tool.call.args)"
34+
output: "'REDACT_PII'"
35+
36+
# Dimension 3: Rate Limiting (First-Match Threshold Ladder)
37+
- rule:
38+
match:
39+
- condition: "tool.call.args.batch_size > 10000"
40+
output: "'THROTTLE_TIER_3'"
41+
- condition: "tool.call.args.batch_size > 1000"
42+
output: "'THROTTLE_TIER_2'"
43+
- condition: "tool.call.args.batch_size > 100"
44+
output: "'THROTTLE_TIER_1'"
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
description: "Tests governance policy evaluation with multi-dimensional aggregate rules"
16+
section:
17+
- name: "emergency_approval"
18+
tests:
19+
- name: "emergency_trumps_all_approval_rules"
20+
input:
21+
request.is_emergency:
22+
value: true
23+
request.env:
24+
value: "prod"
25+
tool.is_mutation:
26+
value: true
27+
tool.call.args:
28+
expr: "{'batch_size': 50}"
29+
output:
30+
expr: "['REQUIRE_VP_APPROVAL']"
31+
- name: "prod_mutation_with_pci_and_throttling"
32+
tests:
33+
- name: "prod_mutation_pci_tier2"
34+
input:
35+
request.is_emergency:
36+
value: false
37+
request.env:
38+
value: "prod"
39+
tool.is_mutation:
40+
value: true
41+
tool.call.args:
42+
expr: "{'batch_size': dyn(1500), 'cc': dyn('411111111111')}"
43+
output:
44+
expr: "['REQUIRE_TECH_LEAD_2FA', 'REDACT_PCI', 'THROTTLE_TIER_2']"
45+
- name: "dev_mutation_with_pii_and_tier1"
46+
tests:
47+
- name: "dev_mutation_pii_tier1"
48+
input:
49+
request.is_emergency:
50+
value: false
51+
request.env:
52+
value: "dev"
53+
tool.is_mutation:
54+
value: true
55+
tool.call.args:
56+
expr: "{'batch_size': dyn(500), 'email': dyn('user@example.com')}"
57+
output:
58+
expr: "['REQUIRE_PEER_CONFIRMATION', 'REDACT_PII', 'THROTTLE_TIER_1']"
59+
- name: "read_only_tool"
60+
tests:
61+
- name: "no_rules_matched"
62+
input:
63+
request.is_emergency:
64+
value: false
65+
request.env:
66+
value: "prod"
67+
tool.is_mutation:
68+
value: false
69+
tool.call.args:
70+
expr: "{'batch_size': 10}"
71+
output:
72+
expr: "[]"

0 commit comments

Comments
 (0)