action-sentinel 0.2.0__py3-none-any.whl
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.
- action_sentinel/__init__.py +3 -0
- action_sentinel/__main__.py +3 -0
- action_sentinel/_bundled/config/sentinel-vegaml.yaml +66 -0
- action_sentinel/_bundled/config/sentinel.yaml +57 -0
- action_sentinel/_bundled/examples/evaluation_datasets/sentinel_synthetic_v1.jsonl +86 -0
- action_sentinel/_bundled/examples/rule_packs/agent_tasks.yaml +22 -0
- action_sentinel/_bundled/examples/rule_packs/classifier.yaml +32 -0
- action_sentinel/_bundled/examples/rule_packs/core.yaml +192 -0
- action_sentinel/_bundled/examples/sample_actions/actions.jsonl +6 -0
- action_sentinel/_bundled/examples/sample_actions/my_action.json +17 -0
- action_sentinel/_bundled/examples/sample_actions/one.json +26 -0
- action_sentinel/api/__init__.py +3 -0
- action_sentinel/api/app.py +309 -0
- action_sentinel/audit.py +72 -0
- action_sentinel/cli.py +607 -0
- action_sentinel/config.py +117 -0
- action_sentinel/contracts/__init__.py +36 -0
- action_sentinel/contracts/actions.py +86 -0
- action_sentinel/contracts/audit.py +24 -0
- action_sentinel/contracts/common.py +84 -0
- action_sentinel/contracts/decisions.py +268 -0
- action_sentinel/contracts/evaluation.py +80 -0
- action_sentinel/contracts/execution.py +51 -0
- action_sentinel/contracts/review.py +74 -0
- action_sentinel/dashboard/app.py +389 -0
- action_sentinel/demo.py +215 -0
- action_sentinel/disagreement.py +81 -0
- action_sentinel/evaluation/__init__.py +6 -0
- action_sentinel/evaluation/datasets.py +44 -0
- action_sentinel/evaluation/lab.py +265 -0
- action_sentinel/evaluation/metrics.py +122 -0
- action_sentinel/evaluation/report.py +106 -0
- action_sentinel/execution/__init__.py +5 -0
- action_sentinel/execution/authorization.py +76 -0
- action_sentinel/execution/executor.py +176 -0
- action_sentinel/governance/__init__.py +13 -0
- action_sentinel/governance/policy.py +154 -0
- action_sentinel/governance/review.py +127 -0
- action_sentinel/guard.py +400 -0
- action_sentinel/providers/__init__.py +13 -0
- action_sentinel/providers/base.py +142 -0
- action_sentinel/providers/mock.py +62 -0
- action_sentinel/providers/ollama.py +126 -0
- action_sentinel/providers/registry.py +144 -0
- action_sentinel/providers/rule_based.py +65 -0
- action_sentinel/providers/runner.py +71 -0
- action_sentinel/providers/vegaml_provider.py +229 -0
- action_sentinel/remote.py +120 -0
- action_sentinel/resources.py +65 -0
- action_sentinel/service.py +396 -0
- action_sentinel/storage/__init__.py +4 -0
- action_sentinel/storage/base.py +50 -0
- action_sentinel/storage/sqlite.py +229 -0
- action_sentinel/uncertainty.py +97 -0
- action_sentinel/validation/__init__.py +16 -0
- action_sentinel/validation/engine.py +206 -0
- action_sentinel/validation/grammar.py +210 -0
- action_sentinel/validation/packs.py +229 -0
- action_sentinel/vegalab/__init__.py +1 -0
- action_sentinel/vegalab/analysis.py +190 -0
- action_sentinel/vegalab/api.py +60 -0
- action_sentinel/vegalab/contracts.py +214 -0
- action_sentinel/vegalab/datasets.py +379 -0
- action_sentinel/vegalab/experiment.py +82 -0
- action_sentinel/vegalab/heads.py +95 -0
- action_sentinel/vegalab/report.py +125 -0
- action_sentinel/vegalab/runner.py +147 -0
- action_sentinel/vegalab/service.py +86 -0
- action_sentinel/vegalab/systems.py +270 -0
- action_sentinel/vegalab/tasks.py +137 -0
- action_sentinel/vegalab/testing.py +100 -0
- action_sentinel/vegalab/vega_core.py +362 -0
- action_sentinel-0.2.0.dist-info/METADATA +384 -0
- action_sentinel-0.2.0.dist-info/RECORD +78 -0
- action_sentinel-0.2.0.dist-info/WHEEL +5 -0
- action_sentinel-0.2.0.dist-info/entry_points.txt +2 -0
- action_sentinel-0.2.0.dist-info/licenses/LICENSE +202 -0
- action_sentinel-0.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Sentinel with VegaML deciding risk (local development configuration).
|
|
2
|
+
# pip install -e ".[api,vegaml]"
|
|
3
|
+
# action-sentinel --config config/sentinel-vegaml.yaml serve
|
|
4
|
+
# VegaML's few-shot head judges each action; the rules and governance still decide what may run, and a
|
|
5
|
+
# model can only escalate. On startup the model loads and the head is fitted (about 3.5 GB of RAM and a few
|
|
6
|
+
# minutes on CPU for 0.8b). To serve a head fitted on your own labelled actions instead:
|
|
7
|
+
# action-sentinel vega fit --dataset my_actions.jsonl --out heads/my_actions.npz
|
|
8
|
+
# then set vegaml-head's config to {..., ttt_head_path: heads/my_actions.npz} (it replaces ttt_fit_dataset).
|
|
9
|
+
# DEV ONLY: the principals below use publicly documented development keys (see README).
|
|
10
|
+
# Do not deploy this file. Production must supply its own principals and SENTINEL_SIGNING_KEY.
|
|
11
|
+
environment: dev
|
|
12
|
+
db_path: var/sentinel.db
|
|
13
|
+
report_dir: reports
|
|
14
|
+
rule_packs:
|
|
15
|
+
- examples/rule_packs/core.yaml
|
|
16
|
+
|
|
17
|
+
providers:
|
|
18
|
+
- name: rules
|
|
19
|
+
type: rule_based
|
|
20
|
+
config: {classifier_path: examples/rule_packs/classifier.yaml}
|
|
21
|
+
- name: ollama
|
|
22
|
+
type: ollama
|
|
23
|
+
enabled: true # built always; only used when listed in active_providers or requested
|
|
24
|
+
config: {model: "llama3.1:8b", base_url: "http://localhost:11434", timeout_s: 180, max_retries: 1}
|
|
25
|
+
- name: vegaml-off
|
|
26
|
+
type: vegaml
|
|
27
|
+
enabled: true # reports unavailable unless the vegaml package is installed
|
|
28
|
+
config: {checkpoint: "0.8b", device: cpu, adapter_mode: "off"}
|
|
29
|
+
- name: vegaml-auto
|
|
30
|
+
type: vegaml
|
|
31
|
+
enabled: true # shares the loaded model with vegaml-off (one model per checkpoint/device)
|
|
32
|
+
config: {checkpoint: "0.8b", device: cpu, adapter_mode: auto}
|
|
33
|
+
- name: vegaml-head
|
|
34
|
+
type: vegaml
|
|
35
|
+
enabled: true # VegaML few-shot head (Vega.fit) on the compact framing, fitted on the calibration split
|
|
36
|
+
config: {checkpoint: "0.8b", device: cpu, adapter_mode: "off", framing: compact, readout: ttt,
|
|
37
|
+
ttt_fit_dataset: examples/evaluation_datasets/sentinel_synthetic_v1.jsonl, ttt_fit_split: calibration}
|
|
38
|
+
|
|
39
|
+
# Providers consulted for every decision: the deterministic rules and VegaML's head, side by side.
|
|
40
|
+
active_providers: [rules, vegaml-head]
|
|
41
|
+
# Load the model and fit (or load) the head when the API starts, so the first request isn't the slow one.
|
|
42
|
+
warm_up: true
|
|
43
|
+
strategy: parallel
|
|
44
|
+
provider_timeout_s: 200
|
|
45
|
+
|
|
46
|
+
governance:
|
|
47
|
+
version: 1.0.0
|
|
48
|
+
max_auto_approve_risk: low
|
|
49
|
+
thresholds:
|
|
50
|
+
approve_min_confidence: 0.85
|
|
51
|
+
abstain_below: 0.5
|
|
52
|
+
require_measured_calibration: false
|
|
53
|
+
review_ttl_seconds: 86400
|
|
54
|
+
authorization_ttl_seconds: 900
|
|
55
|
+
|
|
56
|
+
reviewers:
|
|
57
|
+
- {reviewer_id: olivia, display_name: Olivia (operator), level: operator}
|
|
58
|
+
- {reviewer_id: sam, display_name: Sam (senior), level: senior}
|
|
59
|
+
- {reviewer_id: ada, display_name: Ada (admin), level: admin}
|
|
60
|
+
|
|
61
|
+
principals:
|
|
62
|
+
- {principal_id: ops-agent, roles: [agent], key_sha256: 768d431c7599a91b58ae5747e08e9aa96dcb4eef45e029c87e3e060e521dcead}
|
|
63
|
+
- {principal_id: olivia, roles: [reviewer, auditor], reviewer_id: olivia, key_sha256: 7eee78659ab50d4dd820f4242709d188809ca0249506edf83d70022973d5e2ca}
|
|
64
|
+
- {principal_id: sam, roles: [reviewer, auditor, evaluator], reviewer_id: sam, key_sha256: 0c58b25b0b46f53cab77084f40823f07e9b523b04e1d79caa8f13d0fcaadb9fe}
|
|
65
|
+
- {principal_id: ada, roles: [admin, reviewer, auditor, evaluator], reviewer_id: ada, key_sha256: df76ff796f70d2c9cb055ea6280553caa27eda26b70e01082c160de75a05a4a9}
|
|
66
|
+
- {principal_id: auditor, roles: [auditor], key_sha256: 46151c35c1c09bca0b049ce55099e4f67fd04efe91716eec70fd1fa8ce898163}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Sentinel local development configuration.
|
|
2
|
+
# DEV ONLY: the principals below use publicly documented development keys (see README).
|
|
3
|
+
# Do not deploy this file. Production must supply its own principals and SENTINEL_SIGNING_KEY.
|
|
4
|
+
environment: dev
|
|
5
|
+
db_path: var/sentinel.db
|
|
6
|
+
report_dir: reports
|
|
7
|
+
rule_packs:
|
|
8
|
+
- examples/rule_packs/core.yaml
|
|
9
|
+
|
|
10
|
+
providers:
|
|
11
|
+
- name: rules
|
|
12
|
+
type: rule_based
|
|
13
|
+
config: {classifier_path: examples/rule_packs/classifier.yaml}
|
|
14
|
+
- name: ollama
|
|
15
|
+
type: ollama
|
|
16
|
+
enabled: true # built always; only used when listed in active_providers or requested
|
|
17
|
+
config: {model: "llama3.1:8b", base_url: "http://localhost:11434", timeout_s: 180, max_retries: 1}
|
|
18
|
+
- name: vegaml-off
|
|
19
|
+
type: vegaml
|
|
20
|
+
enabled: true # reports unavailable unless the vegaml package is installed
|
|
21
|
+
config: {checkpoint: "0.8b", device: cpu, adapter_mode: "off"}
|
|
22
|
+
- name: vegaml-auto
|
|
23
|
+
type: vegaml
|
|
24
|
+
enabled: true # shares the loaded model with vegaml-off (one model per checkpoint/device)
|
|
25
|
+
config: {checkpoint: "0.8b", device: cpu, adapter_mode: auto}
|
|
26
|
+
- name: vegaml-head
|
|
27
|
+
type: vegaml
|
|
28
|
+
enabled: true # VegaML few-shot head (Vega.fit) on the compact framing, fitted on the calibration split
|
|
29
|
+
config: {checkpoint: "0.8b", device: cpu, adapter_mode: "off", framing: compact, readout: ttt,
|
|
30
|
+
ttt_fit_dataset: examples/evaluation_datasets/sentinel_synthetic_v1.jsonl, ttt_fit_split: calibration}
|
|
31
|
+
|
|
32
|
+
# Providers consulted for every decision. Deterministic rules only, so the default works offline.
|
|
33
|
+
active_providers: [rules]
|
|
34
|
+
strategy: parallel
|
|
35
|
+
provider_timeout_s: 200
|
|
36
|
+
|
|
37
|
+
governance:
|
|
38
|
+
version: 1.0.0
|
|
39
|
+
max_auto_approve_risk: low
|
|
40
|
+
thresholds:
|
|
41
|
+
approve_min_confidence: 0.85
|
|
42
|
+
abstain_below: 0.5
|
|
43
|
+
require_measured_calibration: false
|
|
44
|
+
review_ttl_seconds: 86400
|
|
45
|
+
authorization_ttl_seconds: 900
|
|
46
|
+
|
|
47
|
+
reviewers:
|
|
48
|
+
- {reviewer_id: olivia, display_name: Olivia (operator), level: operator}
|
|
49
|
+
- {reviewer_id: sam, display_name: Sam (senior), level: senior}
|
|
50
|
+
- {reviewer_id: ada, display_name: Ada (admin), level: admin}
|
|
51
|
+
|
|
52
|
+
principals:
|
|
53
|
+
- {principal_id: ops-agent, roles: [agent], key_sha256: 768d431c7599a91b58ae5747e08e9aa96dcb4eef45e029c87e3e060e521dcead}
|
|
54
|
+
- {principal_id: olivia, roles: [reviewer, auditor], reviewer_id: olivia, key_sha256: 7eee78659ab50d4dd820f4242709d188809ca0249506edf83d70022973d5e2ca}
|
|
55
|
+
- {principal_id: sam, roles: [reviewer, auditor, evaluator], reviewer_id: sam, key_sha256: 0c58b25b0b46f53cab77084f40823f07e9b523b04e1d79caa8f13d0fcaadb9fe}
|
|
56
|
+
- {principal_id: ada, roles: [admin, reviewer, auditor, evaluator], reviewer_id: ada, key_sha256: df76ff796f70d2c9cb055ea6280553caa27eda26b70e01082c160de75a05a4a9}
|
|
57
|
+
- {principal_id: auditor, roles: [auditor], key_sha256: 46151c35c1c09bca0b049ce55099e4f67fd04efe91716eec70fd1fa8ce898163}
|