@datalayer/agent-runtimes 1.3.16 → 1.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/loop/apps/AppRenderer.d.ts +24 -0
- package/lib/loop/apps/AppRenderer.js +101 -0
- package/lib/loop/apps/appspec.d.ts +69 -0
- package/lib/loop/apps/appspec.js +566 -0
- package/lib/loop/apps/checks.d.ts +21 -0
- package/lib/loop/apps/checks.js +556 -0
- package/lib/loop/apps/index.d.ts +10 -0
- package/lib/loop/apps/index.js +14 -0
- package/lib/loop/apps/rules.d.ts +64 -0
- package/lib/loop/apps/rules.js +289 -0
- package/lib/loop/apps/yaml.d.ts +17 -0
- package/lib/loop/apps/yaml.js +185 -0
- package/lib/loop/index.d.ts +1 -0
- package/lib/loop/index.js +3 -0
- package/lib/specs/actions.d.ts +30 -0
- package/lib/specs/actions.js +616 -0
- package/lib/specs/apps.d.ts +25 -0
- package/lib/specs/apps.js +1064 -0
- package/lib/specs/cogs.d.ts +19 -0
- package/lib/specs/cogs.js +736 -0
- package/lib/specs/frames.d.ts +19 -0
- package/lib/specs/frames.js +444 -0
- package/lib/specs/gates.d.ts +22 -0
- package/lib/specs/gates.js +177 -0
- package/lib/specs/guards.d.ts +26 -0
- package/lib/specs/guards.js +930 -0
- package/lib/specs/index.d.ts +8 -0
- package/lib/specs/index.js +8 -0
- package/lib/specs/ops.d.ts +15 -0
- package/lib/specs/ops.js +1272 -0
- package/lib/specs/tracks.d.ts +15 -0
- package/lib/specs/tracks.js +87 -0
- package/lib/types/agentspecs.d.ts +435 -0
- package/package.json +2 -1
- package/scripts/codegen/agentspecs_clone.py +53 -0
- package/scripts/codegen/compose.py +65 -0
- package/scripts/codegen/generate_agents.py +8 -0
- package/scripts/codegen/generate_apps.py +454 -0
- package/scripts/codegen/generate_cogs.py +308 -0
- package/scripts/codegen/generate_frames.py +278 -0
- package/scripts/codegen/generate_ops.py +388 -0
|
@@ -0,0 +1,930 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
export const CONFIDENCE_GUARD_0_0_1 = {
|
|
6
|
+
identity_provider: 'datalayer',
|
|
7
|
+
identity_name: 'alice@acme.com',
|
|
8
|
+
permissions: {
|
|
9
|
+
'read:data': true,
|
|
10
|
+
'write:data': false,
|
|
11
|
+
'execute:code': true,
|
|
12
|
+
'access:internet': true,
|
|
13
|
+
'send:email': false,
|
|
14
|
+
'deploy:production': false,
|
|
15
|
+
},
|
|
16
|
+
token_limits: {
|
|
17
|
+
per_run: '50K',
|
|
18
|
+
per_day: '500K',
|
|
19
|
+
per_month: '5M',
|
|
20
|
+
},
|
|
21
|
+
data_scope: {
|
|
22
|
+
allowed_systems: [],
|
|
23
|
+
allowed_objects: [],
|
|
24
|
+
denied_objects: [],
|
|
25
|
+
denied_fields: [],
|
|
26
|
+
},
|
|
27
|
+
data_handling: {
|
|
28
|
+
default_aggregation: false,
|
|
29
|
+
allow_row_level_output: true,
|
|
30
|
+
max_rows_in_output: 1000,
|
|
31
|
+
redact_fields: [],
|
|
32
|
+
hash_fields: [],
|
|
33
|
+
pii_detection: false,
|
|
34
|
+
pii_action: 'warn',
|
|
35
|
+
},
|
|
36
|
+
approval_policy: {
|
|
37
|
+
require_manual_approval_for: [],
|
|
38
|
+
auto_approved: ['All read-only queries'],
|
|
39
|
+
},
|
|
40
|
+
tool_limits: {
|
|
41
|
+
max_tool_calls: 50,
|
|
42
|
+
max_query_rows: 100000,
|
|
43
|
+
max_query_runtime: '60s',
|
|
44
|
+
max_time_window_days: 90,
|
|
45
|
+
},
|
|
46
|
+
audit: {
|
|
47
|
+
log_tool_calls: true,
|
|
48
|
+
log_query_metadata_only: false,
|
|
49
|
+
retain_days: 30,
|
|
50
|
+
require_lineage_in_report: false,
|
|
51
|
+
},
|
|
52
|
+
content_safety: {
|
|
53
|
+
treat_crm_text_fields_as_untrusted: false,
|
|
54
|
+
do_not_follow_instructions_from_data: true,
|
|
55
|
+
},
|
|
56
|
+
id: 'confidence-guard',
|
|
57
|
+
version: '0.0.1',
|
|
58
|
+
name: 'Confidence Guard',
|
|
59
|
+
description: 'Collects the confidence each Cog reports on its result, and the lowest of them for the run, so that a Gate can route unsure work to a person.',
|
|
60
|
+
category: 'algorithmic',
|
|
61
|
+
stages: ['in_flight', 'post_run'],
|
|
62
|
+
method: 'algorithmic',
|
|
63
|
+
check: 'Each Cog result carries a confidence between 0 and 1; the Guard reports the lowest, and fails when a result carries none.',
|
|
64
|
+
signals: [
|
|
65
|
+
{
|
|
66
|
+
name: 'confidence',
|
|
67
|
+
type: 'number',
|
|
68
|
+
description: 'The lowest confidence a Cog reported, between 0 and 1.',
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
required: true,
|
|
72
|
+
enabled: true,
|
|
73
|
+
tags: ['confidence'],
|
|
74
|
+
guardrail: 'default-platform-user',
|
|
75
|
+
icon: 'shield-check',
|
|
76
|
+
emoji: '🛡️',
|
|
77
|
+
};
|
|
78
|
+
export const CONSENSUS_GUARD_0_0_1 = {
|
|
79
|
+
identity_provider: 'datalayer',
|
|
80
|
+
identity_name: 'alice@acme.com',
|
|
81
|
+
permissions: {
|
|
82
|
+
'read:data': true,
|
|
83
|
+
'write:data': false,
|
|
84
|
+
'execute:code': true,
|
|
85
|
+
'access:internet': true,
|
|
86
|
+
'send:email': false,
|
|
87
|
+
'deploy:production': false,
|
|
88
|
+
},
|
|
89
|
+
token_limits: {
|
|
90
|
+
per_run: '50K',
|
|
91
|
+
per_day: '500K',
|
|
92
|
+
per_month: '5M',
|
|
93
|
+
},
|
|
94
|
+
data_scope: {
|
|
95
|
+
allowed_systems: [],
|
|
96
|
+
allowed_objects: [],
|
|
97
|
+
denied_objects: [],
|
|
98
|
+
denied_fields: [],
|
|
99
|
+
},
|
|
100
|
+
data_handling: {
|
|
101
|
+
default_aggregation: false,
|
|
102
|
+
allow_row_level_output: true,
|
|
103
|
+
max_rows_in_output: 1000,
|
|
104
|
+
redact_fields: [],
|
|
105
|
+
hash_fields: [],
|
|
106
|
+
pii_detection: false,
|
|
107
|
+
pii_action: 'warn',
|
|
108
|
+
},
|
|
109
|
+
approval_policy: {
|
|
110
|
+
require_manual_approval_for: [],
|
|
111
|
+
auto_approved: ['All read-only queries'],
|
|
112
|
+
},
|
|
113
|
+
tool_limits: {
|
|
114
|
+
max_tool_calls: 50,
|
|
115
|
+
max_query_rows: 100000,
|
|
116
|
+
max_query_runtime: '60s',
|
|
117
|
+
max_time_window_days: 90,
|
|
118
|
+
},
|
|
119
|
+
audit: {
|
|
120
|
+
log_tool_calls: true,
|
|
121
|
+
log_query_metadata_only: false,
|
|
122
|
+
retain_days: 30,
|
|
123
|
+
require_lineage_in_report: false,
|
|
124
|
+
},
|
|
125
|
+
content_safety: {
|
|
126
|
+
treat_crm_text_fields_as_untrusted: false,
|
|
127
|
+
do_not_follow_instructions_from_data: true,
|
|
128
|
+
},
|
|
129
|
+
id: 'consensus-guard',
|
|
130
|
+
version: '0.0.1',
|
|
131
|
+
name: 'Consensus Guard',
|
|
132
|
+
description: 'Recomputes the key figures by an independent path — another Cog, or the same Cog on another model — and measures how far the two disagree.',
|
|
133
|
+
category: 'consensus',
|
|
134
|
+
stages: ['post_run'],
|
|
135
|
+
method: 'cog',
|
|
136
|
+
check: 'The key figures of the output are recomputed independently; the Guard reports the share of them on which the two paths disagree.',
|
|
137
|
+
signals: [
|
|
138
|
+
{
|
|
139
|
+
name: 'consensus_disagreement',
|
|
140
|
+
type: 'number',
|
|
141
|
+
description: 'The share of key figures on which independent paths disagree, between 0 and 1.',
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
required: true,
|
|
145
|
+
enabled: true,
|
|
146
|
+
tags: ['consensus', 'verification'],
|
|
147
|
+
guardrail: 'default-platform-user',
|
|
148
|
+
icon: 'shield-check',
|
|
149
|
+
emoji: '🛡️',
|
|
150
|
+
};
|
|
151
|
+
export const DATA_SOURCE_AUTHORIZATION_GUARD_0_0_1 = {
|
|
152
|
+
identity_provider: 'datalayer',
|
|
153
|
+
identity_name: 'dave@acme.com',
|
|
154
|
+
permissions: {
|
|
155
|
+
'read:data': true,
|
|
156
|
+
'write:data': true,
|
|
157
|
+
'execute:code': true,
|
|
158
|
+
'access:internet': true,
|
|
159
|
+
'send:email': true,
|
|
160
|
+
'deploy:production': true,
|
|
161
|
+
},
|
|
162
|
+
token_limits: {
|
|
163
|
+
per_run: '200K',
|
|
164
|
+
per_day: '5M',
|
|
165
|
+
per_month: '50M',
|
|
166
|
+
},
|
|
167
|
+
data_scope: {
|
|
168
|
+
allowed_systems: ['postgresql', 'mongodb', 's3', 'kafka'],
|
|
169
|
+
allowed_objects: [],
|
|
170
|
+
denied_objects: [],
|
|
171
|
+
denied_fields: ['*SSN*', '*Bank*', '*IBAN*'],
|
|
172
|
+
},
|
|
173
|
+
data_handling: {
|
|
174
|
+
default_aggregation: false,
|
|
175
|
+
allow_row_level_output: true,
|
|
176
|
+
max_rows_in_output: 100000,
|
|
177
|
+
redact_fields: [],
|
|
178
|
+
hash_fields: [],
|
|
179
|
+
pii_detection: true,
|
|
180
|
+
pii_action: 'redact',
|
|
181
|
+
},
|
|
182
|
+
approval_policy: {
|
|
183
|
+
require_manual_approval_for: [
|
|
184
|
+
'Schema changes',
|
|
185
|
+
'Drop or truncate operations',
|
|
186
|
+
'Production data modifications',
|
|
187
|
+
],
|
|
188
|
+
auto_approved: [
|
|
189
|
+
'Read queries',
|
|
190
|
+
'Data transformations',
|
|
191
|
+
'Pipeline orchestration',
|
|
192
|
+
],
|
|
193
|
+
},
|
|
194
|
+
tool_limits: {
|
|
195
|
+
max_tool_calls: 500,
|
|
196
|
+
max_query_rows: 1000000,
|
|
197
|
+
max_query_runtime: '300s',
|
|
198
|
+
max_time_window_days: 365,
|
|
199
|
+
},
|
|
200
|
+
audit: {
|
|
201
|
+
log_tool_calls: true,
|
|
202
|
+
log_query_metadata_only: false,
|
|
203
|
+
retain_days: 90,
|
|
204
|
+
require_lineage_in_report: true,
|
|
205
|
+
},
|
|
206
|
+
content_safety: {
|
|
207
|
+
treat_crm_text_fields_as_untrusted: true,
|
|
208
|
+
do_not_follow_instructions_from_data: true,
|
|
209
|
+
},
|
|
210
|
+
id: 'data-source-authorization-guard',
|
|
211
|
+
version: '0.0.1',
|
|
212
|
+
name: 'Data Source Authorization Guard',
|
|
213
|
+
description: 'Checks that each system, object and field the Op is about to read is inside the data scope of the guardrail, and that no denied field is requested.',
|
|
214
|
+
category: 'policy-safety',
|
|
215
|
+
stages: ['preflight'],
|
|
216
|
+
method: 'algorithmic',
|
|
217
|
+
check: "Every data source named by the run is among the guardrail's allowed systems and objects; none is a denied object or matches a denied field.",
|
|
218
|
+
signals: [
|
|
219
|
+
{
|
|
220
|
+
name: 'unauthorized_source',
|
|
221
|
+
type: 'boolean',
|
|
222
|
+
description: 'A data source outside the allowed scope is requested.',
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
required: true,
|
|
226
|
+
enabled: true,
|
|
227
|
+
tags: ['data', 'authorization'],
|
|
228
|
+
guardrail: 'data-engineering-power-user',
|
|
229
|
+
icon: 'shield-check',
|
|
230
|
+
emoji: '🛡️',
|
|
231
|
+
};
|
|
232
|
+
export const EXPERT_SAMPLING_GUARD_0_0_1 = {
|
|
233
|
+
identity_provider: 'datalayer',
|
|
234
|
+
identity_name: 'alice@acme.com',
|
|
235
|
+
permissions: {
|
|
236
|
+
'read:data': true,
|
|
237
|
+
'write:data': false,
|
|
238
|
+
'execute:code': true,
|
|
239
|
+
'access:internet': true,
|
|
240
|
+
'send:email': false,
|
|
241
|
+
'deploy:production': false,
|
|
242
|
+
},
|
|
243
|
+
token_limits: {
|
|
244
|
+
per_run: '50K',
|
|
245
|
+
per_day: '500K',
|
|
246
|
+
per_month: '5M',
|
|
247
|
+
},
|
|
248
|
+
data_scope: {
|
|
249
|
+
allowed_systems: [],
|
|
250
|
+
allowed_objects: [],
|
|
251
|
+
denied_objects: [],
|
|
252
|
+
denied_fields: [],
|
|
253
|
+
},
|
|
254
|
+
data_handling: {
|
|
255
|
+
default_aggregation: false,
|
|
256
|
+
allow_row_level_output: true,
|
|
257
|
+
max_rows_in_output: 1000,
|
|
258
|
+
redact_fields: [],
|
|
259
|
+
hash_fields: [],
|
|
260
|
+
pii_detection: false,
|
|
261
|
+
pii_action: 'warn',
|
|
262
|
+
},
|
|
263
|
+
approval_policy: {
|
|
264
|
+
require_manual_approval_for: [],
|
|
265
|
+
auto_approved: ['All read-only queries'],
|
|
266
|
+
},
|
|
267
|
+
tool_limits: {
|
|
268
|
+
max_tool_calls: 50,
|
|
269
|
+
max_query_rows: 100000,
|
|
270
|
+
max_query_runtime: '60s',
|
|
271
|
+
max_time_window_days: 90,
|
|
272
|
+
},
|
|
273
|
+
audit: {
|
|
274
|
+
log_tool_calls: true,
|
|
275
|
+
log_query_metadata_only: false,
|
|
276
|
+
retain_days: 30,
|
|
277
|
+
require_lineage_in_report: false,
|
|
278
|
+
},
|
|
279
|
+
content_safety: {
|
|
280
|
+
treat_crm_text_fields_as_untrusted: false,
|
|
281
|
+
do_not_follow_instructions_from_data: true,
|
|
282
|
+
},
|
|
283
|
+
id: 'expert-sampling-guard',
|
|
284
|
+
version: '0.0.1',
|
|
285
|
+
name: 'Expert Sampling Guard',
|
|
286
|
+
description: 'Routes the output — every one of a high-risk Op, a sample of the others — to a named expert, and records what they decided.',
|
|
287
|
+
category: 'expert',
|
|
288
|
+
stages: ['post_run'],
|
|
289
|
+
method: 'human',
|
|
290
|
+
check: 'An expert in the subject reads the output and its evidence, and approves it, edits it or sends it back.',
|
|
291
|
+
signals: [
|
|
292
|
+
{
|
|
293
|
+
name: 'expert_approved',
|
|
294
|
+
type: 'boolean',
|
|
295
|
+
description: 'The expert approved the output.',
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
name: 'high_risk',
|
|
299
|
+
type: 'boolean',
|
|
300
|
+
description: 'The output is of a kind every instance of which is reviewed.',
|
|
301
|
+
},
|
|
302
|
+
],
|
|
303
|
+
required: true,
|
|
304
|
+
enabled: true,
|
|
305
|
+
tags: ['expert', 'review'],
|
|
306
|
+
guardrail: 'default-platform-user',
|
|
307
|
+
icon: 'shield-check',
|
|
308
|
+
emoji: '🛡️',
|
|
309
|
+
};
|
|
310
|
+
export const OUTCOME_GUARD_0_0_1 = {
|
|
311
|
+
identity_provider: 'datalayer',
|
|
312
|
+
identity_name: 'alice@acme.com',
|
|
313
|
+
permissions: {
|
|
314
|
+
'read:data': true,
|
|
315
|
+
'write:data': false,
|
|
316
|
+
'execute:code': true,
|
|
317
|
+
'access:internet': true,
|
|
318
|
+
'send:email': false,
|
|
319
|
+
'deploy:production': false,
|
|
320
|
+
},
|
|
321
|
+
token_limits: {
|
|
322
|
+
per_run: '50K',
|
|
323
|
+
per_day: '500K',
|
|
324
|
+
per_month: '5M',
|
|
325
|
+
},
|
|
326
|
+
data_scope: {
|
|
327
|
+
allowed_systems: [],
|
|
328
|
+
allowed_objects: [],
|
|
329
|
+
denied_objects: [],
|
|
330
|
+
denied_fields: [],
|
|
331
|
+
},
|
|
332
|
+
data_handling: {
|
|
333
|
+
default_aggregation: false,
|
|
334
|
+
allow_row_level_output: true,
|
|
335
|
+
max_rows_in_output: 1000,
|
|
336
|
+
redact_fields: [],
|
|
337
|
+
hash_fields: [],
|
|
338
|
+
pii_detection: false,
|
|
339
|
+
pii_action: 'warn',
|
|
340
|
+
},
|
|
341
|
+
approval_policy: {
|
|
342
|
+
require_manual_approval_for: [],
|
|
343
|
+
auto_approved: ['All read-only queries'],
|
|
344
|
+
},
|
|
345
|
+
tool_limits: {
|
|
346
|
+
max_tool_calls: 50,
|
|
347
|
+
max_query_rows: 100000,
|
|
348
|
+
max_query_runtime: '60s',
|
|
349
|
+
max_time_window_days: 90,
|
|
350
|
+
},
|
|
351
|
+
audit: {
|
|
352
|
+
log_tool_calls: true,
|
|
353
|
+
log_query_metadata_only: false,
|
|
354
|
+
retain_days: 30,
|
|
355
|
+
require_lineage_in_report: false,
|
|
356
|
+
},
|
|
357
|
+
content_safety: {
|
|
358
|
+
treat_crm_text_fields_as_untrusted: false,
|
|
359
|
+
do_not_follow_instructions_from_data: true,
|
|
360
|
+
},
|
|
361
|
+
id: 'outcome-guard',
|
|
362
|
+
version: '0.0.1',
|
|
363
|
+
name: 'Outcome Guard',
|
|
364
|
+
description: "Measures, over time, whether the Op's outputs are used as intended: accepted without rework, on time, with the decision they were made for taken.",
|
|
365
|
+
category: 'outcome',
|
|
366
|
+
stages: ['continuous'],
|
|
367
|
+
method: 'human',
|
|
368
|
+
check: "Over the review period, the share of outputs accepted without rework by the people they were produced for meets the Op's goal.",
|
|
369
|
+
signals: [
|
|
370
|
+
{
|
|
371
|
+
name: 'outcome_met',
|
|
372
|
+
type: 'boolean',
|
|
373
|
+
description: 'The Op met its outcome goal over the review period.',
|
|
374
|
+
},
|
|
375
|
+
],
|
|
376
|
+
required: false,
|
|
377
|
+
enabled: true,
|
|
378
|
+
tags: ['outcome', 'value'],
|
|
379
|
+
guardrail: 'default-platform-user',
|
|
380
|
+
icon: 'shield-check',
|
|
381
|
+
emoji: '🛡️',
|
|
382
|
+
};
|
|
383
|
+
export const PERMISSION_GUARD_0_0_1 = {
|
|
384
|
+
identity_provider: 'datalayer',
|
|
385
|
+
identity_name: 'alice@acme.com',
|
|
386
|
+
permissions: {
|
|
387
|
+
'read:data': true,
|
|
388
|
+
'write:data': false,
|
|
389
|
+
'execute:code': true,
|
|
390
|
+
'access:internet': true,
|
|
391
|
+
'send:email': false,
|
|
392
|
+
'deploy:production': false,
|
|
393
|
+
},
|
|
394
|
+
token_limits: {
|
|
395
|
+
per_run: '50K',
|
|
396
|
+
per_day: '500K',
|
|
397
|
+
per_month: '5M',
|
|
398
|
+
},
|
|
399
|
+
data_scope: {
|
|
400
|
+
allowed_systems: [],
|
|
401
|
+
allowed_objects: [],
|
|
402
|
+
denied_objects: [],
|
|
403
|
+
denied_fields: [],
|
|
404
|
+
},
|
|
405
|
+
data_handling: {
|
|
406
|
+
default_aggregation: false,
|
|
407
|
+
allow_row_level_output: true,
|
|
408
|
+
max_rows_in_output: 1000,
|
|
409
|
+
redact_fields: [],
|
|
410
|
+
hash_fields: [],
|
|
411
|
+
pii_detection: false,
|
|
412
|
+
pii_action: 'warn',
|
|
413
|
+
},
|
|
414
|
+
approval_policy: {
|
|
415
|
+
require_manual_approval_for: [],
|
|
416
|
+
auto_approved: ['All read-only queries'],
|
|
417
|
+
},
|
|
418
|
+
tool_limits: {
|
|
419
|
+
max_tool_calls: 50,
|
|
420
|
+
max_query_rows: 100000,
|
|
421
|
+
max_query_runtime: '60s',
|
|
422
|
+
max_time_window_days: 90,
|
|
423
|
+
},
|
|
424
|
+
audit: {
|
|
425
|
+
log_tool_calls: true,
|
|
426
|
+
log_query_metadata_only: false,
|
|
427
|
+
retain_days: 30,
|
|
428
|
+
require_lineage_in_report: false,
|
|
429
|
+
},
|
|
430
|
+
content_safety: {
|
|
431
|
+
treat_crm_text_fields_as_untrusted: false,
|
|
432
|
+
do_not_follow_instructions_from_data: true,
|
|
433
|
+
},
|
|
434
|
+
id: 'permission-guard',
|
|
435
|
+
version: '0.0.1',
|
|
436
|
+
name: 'Permission Guard',
|
|
437
|
+
description: "Checks that the person or the system launching the Op holds every permission the Op's Cogs need, as the guardrail states them.",
|
|
438
|
+
category: 'policy-safety',
|
|
439
|
+
stages: ['preflight'],
|
|
440
|
+
method: 'algorithmic',
|
|
441
|
+
check: "Each permission the Op's Cogs use is granted to the launching identity by the guardrail; nothing the guardrail denies is requested.",
|
|
442
|
+
signals: [
|
|
443
|
+
{
|
|
444
|
+
name: 'permission_denied',
|
|
445
|
+
type: 'boolean',
|
|
446
|
+
description: 'A permission the Op needs is not granted.',
|
|
447
|
+
},
|
|
448
|
+
],
|
|
449
|
+
required: true,
|
|
450
|
+
enabled: true,
|
|
451
|
+
tags: ['permissions', 'identity'],
|
|
452
|
+
guardrail: 'default-platform-user',
|
|
453
|
+
icon: 'shield-check',
|
|
454
|
+
emoji: '🛡️',
|
|
455
|
+
};
|
|
456
|
+
export const REGRESSION_GUARD_0_0_1 = {
|
|
457
|
+
identity_provider: 'datalayer',
|
|
458
|
+
identity_name: 'dave@acme.com',
|
|
459
|
+
permissions: {
|
|
460
|
+
'read:data': true,
|
|
461
|
+
'write:data': true,
|
|
462
|
+
'execute:code': true,
|
|
463
|
+
'access:internet': true,
|
|
464
|
+
'send:email': true,
|
|
465
|
+
'deploy:production': true,
|
|
466
|
+
},
|
|
467
|
+
token_limits: {
|
|
468
|
+
per_run: '200K',
|
|
469
|
+
per_day: '5M',
|
|
470
|
+
per_month: '50M',
|
|
471
|
+
},
|
|
472
|
+
data_scope: {
|
|
473
|
+
allowed_systems: ['postgresql', 'mongodb', 's3', 'kafka'],
|
|
474
|
+
allowed_objects: [],
|
|
475
|
+
denied_objects: [],
|
|
476
|
+
denied_fields: ['*SSN*', '*Bank*', '*IBAN*'],
|
|
477
|
+
},
|
|
478
|
+
data_handling: {
|
|
479
|
+
default_aggregation: false,
|
|
480
|
+
allow_row_level_output: true,
|
|
481
|
+
max_rows_in_output: 100000,
|
|
482
|
+
redact_fields: [],
|
|
483
|
+
hash_fields: [],
|
|
484
|
+
pii_detection: true,
|
|
485
|
+
pii_action: 'redact',
|
|
486
|
+
},
|
|
487
|
+
approval_policy: {
|
|
488
|
+
require_manual_approval_for: [
|
|
489
|
+
'Schema changes',
|
|
490
|
+
'Drop or truncate operations',
|
|
491
|
+
'Production data modifications',
|
|
492
|
+
],
|
|
493
|
+
auto_approved: [
|
|
494
|
+
'Read queries',
|
|
495
|
+
'Data transformations',
|
|
496
|
+
'Pipeline orchestration',
|
|
497
|
+
],
|
|
498
|
+
},
|
|
499
|
+
tool_limits: {
|
|
500
|
+
max_tool_calls: 500,
|
|
501
|
+
max_query_rows: 1000000,
|
|
502
|
+
max_query_runtime: '300s',
|
|
503
|
+
max_time_window_days: 365,
|
|
504
|
+
},
|
|
505
|
+
audit: {
|
|
506
|
+
log_tool_calls: true,
|
|
507
|
+
log_query_metadata_only: false,
|
|
508
|
+
retain_days: 90,
|
|
509
|
+
require_lineage_in_report: true,
|
|
510
|
+
},
|
|
511
|
+
content_safety: {
|
|
512
|
+
treat_crm_text_fields_as_untrusted: true,
|
|
513
|
+
do_not_follow_instructions_from_data: true,
|
|
514
|
+
},
|
|
515
|
+
id: 'regression-guard',
|
|
516
|
+
version: '0.0.1',
|
|
517
|
+
name: 'Regression Guard',
|
|
518
|
+
description: 'Replays a golden set of past runs after a model, a Frame, a Cog or the Op itself changes, and compares the results with the validated ones.',
|
|
519
|
+
category: 'regression-drift',
|
|
520
|
+
stages: ['continuous'],
|
|
521
|
+
method: 'algorithmic',
|
|
522
|
+
check: "On the golden set, the share of runs whose output departs from the validated one stays under the threshold the Op's owner set.",
|
|
523
|
+
signals: [
|
|
524
|
+
{
|
|
525
|
+
name: 'regression_rate',
|
|
526
|
+
type: 'number',
|
|
527
|
+
description: 'The share of golden runs whose output changed, between 0 and 1.',
|
|
528
|
+
},
|
|
529
|
+
],
|
|
530
|
+
required: false,
|
|
531
|
+
enabled: true,
|
|
532
|
+
tags: ['regression', 'drift'],
|
|
533
|
+
guardrail: 'data-engineering-power-user',
|
|
534
|
+
icon: 'shield-check',
|
|
535
|
+
emoji: '🛡️',
|
|
536
|
+
};
|
|
537
|
+
export const REQUIRED_FRAME_GUARD_0_0_1 = {
|
|
538
|
+
identity_provider: 'datalayer',
|
|
539
|
+
identity_name: 'alice@acme.com',
|
|
540
|
+
permissions: {
|
|
541
|
+
'read:data': true,
|
|
542
|
+
'write:data': false,
|
|
543
|
+
'execute:code': true,
|
|
544
|
+
'access:internet': true,
|
|
545
|
+
'send:email': false,
|
|
546
|
+
'deploy:production': false,
|
|
547
|
+
},
|
|
548
|
+
token_limits: {
|
|
549
|
+
per_run: '50K',
|
|
550
|
+
per_day: '500K',
|
|
551
|
+
per_month: '5M',
|
|
552
|
+
},
|
|
553
|
+
data_scope: {
|
|
554
|
+
allowed_systems: [],
|
|
555
|
+
allowed_objects: [],
|
|
556
|
+
denied_objects: [],
|
|
557
|
+
denied_fields: [],
|
|
558
|
+
},
|
|
559
|
+
data_handling: {
|
|
560
|
+
default_aggregation: false,
|
|
561
|
+
allow_row_level_output: true,
|
|
562
|
+
max_rows_in_output: 1000,
|
|
563
|
+
redact_fields: [],
|
|
564
|
+
hash_fields: [],
|
|
565
|
+
pii_detection: false,
|
|
566
|
+
pii_action: 'warn',
|
|
567
|
+
},
|
|
568
|
+
approval_policy: {
|
|
569
|
+
require_manual_approval_for: [],
|
|
570
|
+
auto_approved: ['All read-only queries'],
|
|
571
|
+
},
|
|
572
|
+
tool_limits: {
|
|
573
|
+
max_tool_calls: 50,
|
|
574
|
+
max_query_rows: 100000,
|
|
575
|
+
max_query_runtime: '60s',
|
|
576
|
+
max_time_window_days: 90,
|
|
577
|
+
},
|
|
578
|
+
audit: {
|
|
579
|
+
log_tool_calls: true,
|
|
580
|
+
log_query_metadata_only: false,
|
|
581
|
+
retain_days: 30,
|
|
582
|
+
require_lineage_in_report: false,
|
|
583
|
+
},
|
|
584
|
+
content_safety: {
|
|
585
|
+
treat_crm_text_fields_as_untrusted: false,
|
|
586
|
+
do_not_follow_instructions_from_data: true,
|
|
587
|
+
},
|
|
588
|
+
id: 'required-frame-guard',
|
|
589
|
+
version: '0.0.1',
|
|
590
|
+
name: 'Required Frame Guard',
|
|
591
|
+
description: "Checks, before any work starts, that every Frame the Op and its Cogs declare exists, is enabled and has been applied to the Cogs' context.",
|
|
592
|
+
category: 'policy-safety',
|
|
593
|
+
stages: ['preflight'],
|
|
594
|
+
method: 'algorithmic',
|
|
595
|
+
check: 'Every Frame named by the Op and by its Cogs resolves, is enabled, and appears in the context each Cog was given.',
|
|
596
|
+
signals: [
|
|
597
|
+
{
|
|
598
|
+
name: 'frames_missing',
|
|
599
|
+
type: 'boolean',
|
|
600
|
+
description: 'A declared Frame is absent, disabled or was not applied.',
|
|
601
|
+
},
|
|
602
|
+
],
|
|
603
|
+
required: true,
|
|
604
|
+
enabled: true,
|
|
605
|
+
tags: ['frames', 'configuration'],
|
|
606
|
+
guardrail: 'default-platform-user',
|
|
607
|
+
icon: 'shield-check',
|
|
608
|
+
emoji: '🛡️',
|
|
609
|
+
};
|
|
610
|
+
export const SCHEMA_GUARD_0_0_1 = {
|
|
611
|
+
identity_provider: 'datalayer',
|
|
612
|
+
identity_name: 'alice@acme.com',
|
|
613
|
+
permissions: {
|
|
614
|
+
'read:data': true,
|
|
615
|
+
'write:data': false,
|
|
616
|
+
'execute:code': true,
|
|
617
|
+
'access:internet': true,
|
|
618
|
+
'send:email': false,
|
|
619
|
+
'deploy:production': false,
|
|
620
|
+
},
|
|
621
|
+
token_limits: {
|
|
622
|
+
per_run: '50K',
|
|
623
|
+
per_day: '500K',
|
|
624
|
+
per_month: '5M',
|
|
625
|
+
},
|
|
626
|
+
data_scope: {
|
|
627
|
+
allowed_systems: [],
|
|
628
|
+
allowed_objects: [],
|
|
629
|
+
denied_objects: [],
|
|
630
|
+
denied_fields: [],
|
|
631
|
+
},
|
|
632
|
+
data_handling: {
|
|
633
|
+
default_aggregation: false,
|
|
634
|
+
allow_row_level_output: true,
|
|
635
|
+
max_rows_in_output: 1000,
|
|
636
|
+
redact_fields: [],
|
|
637
|
+
hash_fields: [],
|
|
638
|
+
pii_detection: false,
|
|
639
|
+
pii_action: 'warn',
|
|
640
|
+
},
|
|
641
|
+
approval_policy: {
|
|
642
|
+
require_manual_approval_for: [],
|
|
643
|
+
auto_approved: ['All read-only queries'],
|
|
644
|
+
},
|
|
645
|
+
tool_limits: {
|
|
646
|
+
max_tool_calls: 50,
|
|
647
|
+
max_query_rows: 100000,
|
|
648
|
+
max_query_runtime: '60s',
|
|
649
|
+
max_time_window_days: 90,
|
|
650
|
+
},
|
|
651
|
+
audit: {
|
|
652
|
+
log_tool_calls: true,
|
|
653
|
+
log_query_metadata_only: false,
|
|
654
|
+
retain_days: 30,
|
|
655
|
+
require_lineage_in_report: false,
|
|
656
|
+
},
|
|
657
|
+
content_safety: {
|
|
658
|
+
treat_crm_text_fields_as_untrusted: false,
|
|
659
|
+
do_not_follow_instructions_from_data: true,
|
|
660
|
+
},
|
|
661
|
+
id: 'schema-guard',
|
|
662
|
+
version: '0.0.1',
|
|
663
|
+
name: 'Schema Guard',
|
|
664
|
+
description: "Validates the structure of the output against the schema the Op's output declares: required sections, fields, types.",
|
|
665
|
+
category: 'algorithmic',
|
|
666
|
+
stages: ['post_run'],
|
|
667
|
+
method: 'algorithmic',
|
|
668
|
+
check: 'The output validates against its declared schema: every required section and field is present and of the declared type.',
|
|
669
|
+
signals: [
|
|
670
|
+
{
|
|
671
|
+
name: 'schema_valid',
|
|
672
|
+
type: 'boolean',
|
|
673
|
+
description: 'The output conforms to its schema.',
|
|
674
|
+
},
|
|
675
|
+
],
|
|
676
|
+
required: true,
|
|
677
|
+
enabled: true,
|
|
678
|
+
tags: ['schema', 'structure'],
|
|
679
|
+
guardrail: 'default-platform-user',
|
|
680
|
+
icon: 'shield-check',
|
|
681
|
+
emoji: '🛡️',
|
|
682
|
+
};
|
|
683
|
+
export const SENSITIVE_DATA_GUARD_0_0_1 = {
|
|
684
|
+
identity_provider: 'azure-ad',
|
|
685
|
+
identity_name: 'viewer-group@acme.onmicrosoft.com',
|
|
686
|
+
permissions: {
|
|
687
|
+
'read:data': true,
|
|
688
|
+
'write:data': false,
|
|
689
|
+
'execute:code': false,
|
|
690
|
+
'access:internet': false,
|
|
691
|
+
'send:email': false,
|
|
692
|
+
'deploy:production': false,
|
|
693
|
+
},
|
|
694
|
+
token_limits: {
|
|
695
|
+
per_run: '10K',
|
|
696
|
+
per_day: '50K',
|
|
697
|
+
per_month: '500K',
|
|
698
|
+
},
|
|
699
|
+
data_scope: {
|
|
700
|
+
allowed_systems: [],
|
|
701
|
+
allowed_objects: [],
|
|
702
|
+
denied_objects: [],
|
|
703
|
+
denied_fields: ['*SSN*', '*Bank*', '*IBAN*', '*Password*', '*Secret*'],
|
|
704
|
+
},
|
|
705
|
+
data_handling: {
|
|
706
|
+
default_aggregation: true,
|
|
707
|
+
allow_row_level_output: false,
|
|
708
|
+
max_rows_in_output: 0,
|
|
709
|
+
redact_fields: [],
|
|
710
|
+
hash_fields: [],
|
|
711
|
+
pii_detection: true,
|
|
712
|
+
pii_action: 'redact',
|
|
713
|
+
},
|
|
714
|
+
approval_policy: {
|
|
715
|
+
require_manual_approval_for: ['Any operation beyond read'],
|
|
716
|
+
auto_approved: ['Aggregated read-only queries'],
|
|
717
|
+
},
|
|
718
|
+
tool_limits: {
|
|
719
|
+
max_tool_calls: 10,
|
|
720
|
+
max_query_rows: 10000,
|
|
721
|
+
max_query_runtime: '15s',
|
|
722
|
+
max_time_window_days: 30,
|
|
723
|
+
},
|
|
724
|
+
audit: {
|
|
725
|
+
log_tool_calls: true,
|
|
726
|
+
log_query_metadata_only: true,
|
|
727
|
+
retain_days: 90,
|
|
728
|
+
require_lineage_in_report: false,
|
|
729
|
+
},
|
|
730
|
+
content_safety: {
|
|
731
|
+
treat_crm_text_fields_as_untrusted: true,
|
|
732
|
+
do_not_follow_instructions_from_data: true,
|
|
733
|
+
},
|
|
734
|
+
id: 'sensitive-data-guard',
|
|
735
|
+
version: '0.0.1',
|
|
736
|
+
name: 'Sensitive Data Guard',
|
|
737
|
+
description: "Detects personal data, credentials and the guardrail's denied fields in what a Cog is about to send out, and in the final output.",
|
|
738
|
+
category: 'policy-safety',
|
|
739
|
+
stages: ['in_flight', 'post_run'],
|
|
740
|
+
method: 'algorithmic',
|
|
741
|
+
check: "No output, tool argument or outbound message contains a credential, a field matching the guardrail's denied fields, or personal data the guardrail's handling rules require to be redacted.",
|
|
742
|
+
signals: [
|
|
743
|
+
{
|
|
744
|
+
name: 'sensitive_data_detected',
|
|
745
|
+
type: 'boolean',
|
|
746
|
+
description: 'Sensitive data was found where it must not be.',
|
|
747
|
+
},
|
|
748
|
+
],
|
|
749
|
+
required: true,
|
|
750
|
+
enabled: true,
|
|
751
|
+
tags: ['privacy', 'pii', 'secrets'],
|
|
752
|
+
guardrail: 'restricted-viewer',
|
|
753
|
+
icon: 'shield-check',
|
|
754
|
+
emoji: '🛡️',
|
|
755
|
+
};
|
|
756
|
+
export const SOURCE_GROUNDING_GUARD_0_0_1 = {
|
|
757
|
+
identity_provider: 'datalayer',
|
|
758
|
+
identity_name: 'alice@acme.com',
|
|
759
|
+
permissions: {
|
|
760
|
+
'read:data': true,
|
|
761
|
+
'write:data': false,
|
|
762
|
+
'execute:code': true,
|
|
763
|
+
'access:internet': true,
|
|
764
|
+
'send:email': false,
|
|
765
|
+
'deploy:production': false,
|
|
766
|
+
},
|
|
767
|
+
token_limits: {
|
|
768
|
+
per_run: '50K',
|
|
769
|
+
per_day: '500K',
|
|
770
|
+
per_month: '5M',
|
|
771
|
+
},
|
|
772
|
+
data_scope: {
|
|
773
|
+
allowed_systems: [],
|
|
774
|
+
allowed_objects: [],
|
|
775
|
+
denied_objects: [],
|
|
776
|
+
denied_fields: [],
|
|
777
|
+
},
|
|
778
|
+
data_handling: {
|
|
779
|
+
default_aggregation: false,
|
|
780
|
+
allow_row_level_output: true,
|
|
781
|
+
max_rows_in_output: 1000,
|
|
782
|
+
redact_fields: [],
|
|
783
|
+
hash_fields: [],
|
|
784
|
+
pii_detection: false,
|
|
785
|
+
pii_action: 'warn',
|
|
786
|
+
},
|
|
787
|
+
approval_policy: {
|
|
788
|
+
require_manual_approval_for: [],
|
|
789
|
+
auto_approved: ['All read-only queries'],
|
|
790
|
+
},
|
|
791
|
+
tool_limits: {
|
|
792
|
+
max_tool_calls: 50,
|
|
793
|
+
max_query_rows: 100000,
|
|
794
|
+
max_query_runtime: '60s',
|
|
795
|
+
max_time_window_days: 90,
|
|
796
|
+
},
|
|
797
|
+
audit: {
|
|
798
|
+
log_tool_calls: true,
|
|
799
|
+
log_query_metadata_only: false,
|
|
800
|
+
retain_days: 30,
|
|
801
|
+
require_lineage_in_report: false,
|
|
802
|
+
},
|
|
803
|
+
content_safety: {
|
|
804
|
+
treat_crm_text_fields_as_untrusted: false,
|
|
805
|
+
do_not_follow_instructions_from_data: true,
|
|
806
|
+
},
|
|
807
|
+
id: 'source-grounding-guard',
|
|
808
|
+
version: '0.0.1',
|
|
809
|
+
name: 'Source Grounding Guard',
|
|
810
|
+
description: 'Checks each claim and each figure of the output against the sources and the computations the run used: a figure traces to the code that produced it.',
|
|
811
|
+
category: 'source-grounding',
|
|
812
|
+
stages: ['post_run'],
|
|
813
|
+
method: 'cog',
|
|
814
|
+
check: 'Every factual claim cites a source that supports it, and every figure equals the value computed in the sandbox from the authorized data.',
|
|
815
|
+
signals: [
|
|
816
|
+
{
|
|
817
|
+
name: 'unsupported_claims',
|
|
818
|
+
type: 'number',
|
|
819
|
+
description: 'How many claims or figures have no supporting source or computation.',
|
|
820
|
+
},
|
|
821
|
+
],
|
|
822
|
+
required: true,
|
|
823
|
+
enabled: true,
|
|
824
|
+
tags: ['sources', 'evidence'],
|
|
825
|
+
guardrail: 'default-platform-user',
|
|
826
|
+
icon: 'shield-check',
|
|
827
|
+
emoji: '🛡️',
|
|
828
|
+
};
|
|
829
|
+
export const TOOL_USE_POLICY_GUARD_0_0_1 = {
|
|
830
|
+
identity_provider: 'datalayer',
|
|
831
|
+
identity_name: 'alice@acme.com',
|
|
832
|
+
permissions: {
|
|
833
|
+
'read:data': true,
|
|
834
|
+
'write:data': false,
|
|
835
|
+
'execute:code': true,
|
|
836
|
+
'access:internet': true,
|
|
837
|
+
'send:email': false,
|
|
838
|
+
'deploy:production': false,
|
|
839
|
+
},
|
|
840
|
+
token_limits: {
|
|
841
|
+
per_run: '50K',
|
|
842
|
+
per_day: '500K',
|
|
843
|
+
per_month: '5M',
|
|
844
|
+
},
|
|
845
|
+
data_scope: {
|
|
846
|
+
allowed_systems: [],
|
|
847
|
+
allowed_objects: [],
|
|
848
|
+
denied_objects: [],
|
|
849
|
+
denied_fields: [],
|
|
850
|
+
},
|
|
851
|
+
data_handling: {
|
|
852
|
+
default_aggregation: false,
|
|
853
|
+
allow_row_level_output: true,
|
|
854
|
+
max_rows_in_output: 1000,
|
|
855
|
+
redact_fields: [],
|
|
856
|
+
hash_fields: [],
|
|
857
|
+
pii_detection: false,
|
|
858
|
+
pii_action: 'warn',
|
|
859
|
+
},
|
|
860
|
+
approval_policy: {
|
|
861
|
+
require_manual_approval_for: [],
|
|
862
|
+
auto_approved: ['All read-only queries'],
|
|
863
|
+
},
|
|
864
|
+
tool_limits: {
|
|
865
|
+
max_tool_calls: 50,
|
|
866
|
+
max_query_rows: 100000,
|
|
867
|
+
max_query_runtime: '60s',
|
|
868
|
+
max_time_window_days: 90,
|
|
869
|
+
},
|
|
870
|
+
audit: {
|
|
871
|
+
log_tool_calls: true,
|
|
872
|
+
log_query_metadata_only: false,
|
|
873
|
+
retain_days: 30,
|
|
874
|
+
require_lineage_in_report: false,
|
|
875
|
+
},
|
|
876
|
+
content_safety: {
|
|
877
|
+
treat_crm_text_fields_as_untrusted: false,
|
|
878
|
+
do_not_follow_instructions_from_data: true,
|
|
879
|
+
},
|
|
880
|
+
id: 'tool-use-policy-guard',
|
|
881
|
+
version: '0.0.1',
|
|
882
|
+
name: 'Tool Use Policy Guard',
|
|
883
|
+
description: "Watches each tool call a Cog makes: the tool is one the Cog declares, and the calls stay within the guardrail's tool limits.",
|
|
884
|
+
category: 'policy-safety',
|
|
885
|
+
stages: ['in_flight'],
|
|
886
|
+
method: 'algorithmic',
|
|
887
|
+
check: "Every tool called is declared by the calling Cog; the number of calls, the rows queried and the query runtime stay within the guardrail's limits.",
|
|
888
|
+
signals: [
|
|
889
|
+
{
|
|
890
|
+
name: 'tool_violation',
|
|
891
|
+
type: 'boolean',
|
|
892
|
+
description: 'An undeclared tool was called, or a tool limit was exceeded.',
|
|
893
|
+
},
|
|
894
|
+
],
|
|
895
|
+
required: true,
|
|
896
|
+
enabled: true,
|
|
897
|
+
tags: ['tools', 'limits'],
|
|
898
|
+
guardrail: 'default-platform-user',
|
|
899
|
+
icon: 'shield-check',
|
|
900
|
+
emoji: '🛡️',
|
|
901
|
+
};
|
|
902
|
+
export const GUARD_CATALOGUE = {
|
|
903
|
+
'confidence-guard': CONFIDENCE_GUARD_0_0_1,
|
|
904
|
+
'consensus-guard': CONSENSUS_GUARD_0_0_1,
|
|
905
|
+
'data-source-authorization-guard': DATA_SOURCE_AUTHORIZATION_GUARD_0_0_1,
|
|
906
|
+
'expert-sampling-guard': EXPERT_SAMPLING_GUARD_0_0_1,
|
|
907
|
+
'outcome-guard': OUTCOME_GUARD_0_0_1,
|
|
908
|
+
'permission-guard': PERMISSION_GUARD_0_0_1,
|
|
909
|
+
'regression-guard': REGRESSION_GUARD_0_0_1,
|
|
910
|
+
'required-frame-guard': REQUIRED_FRAME_GUARD_0_0_1,
|
|
911
|
+
'schema-guard': SCHEMA_GUARD_0_0_1,
|
|
912
|
+
'sensitive-data-guard': SENSITIVE_DATA_GUARD_0_0_1,
|
|
913
|
+
'source-grounding-guard': SOURCE_GROUNDING_GUARD_0_0_1,
|
|
914
|
+
'tool-use-policy-guard': TOOL_USE_POLICY_GUARD_0_0_1,
|
|
915
|
+
};
|
|
916
|
+
/** A Guard, by `id` or `id:version`, or undefined. */
|
|
917
|
+
export function getGuard(ref) {
|
|
918
|
+
// Own entries only: `constructor` and `toString` are not Guards.
|
|
919
|
+
const own = (id) => Object.prototype.hasOwnProperty.call(GUARD_CATALOGUE, id)
|
|
920
|
+
? GUARD_CATALOGUE[id]
|
|
921
|
+
: undefined;
|
|
922
|
+
const at = ref.lastIndexOf(':');
|
|
923
|
+
return (own(ref) ??
|
|
924
|
+
(at > 0 && ref.slice(at + 1).includes('.')
|
|
925
|
+
? own(ref.slice(0, at))
|
|
926
|
+
: undefined));
|
|
927
|
+
}
|
|
928
|
+
export function listGuards() {
|
|
929
|
+
return Object.values(GUARD_CATALOGUE);
|
|
930
|
+
}
|