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.
Files changed (78) hide show
  1. action_sentinel/__init__.py +3 -0
  2. action_sentinel/__main__.py +3 -0
  3. action_sentinel/_bundled/config/sentinel-vegaml.yaml +66 -0
  4. action_sentinel/_bundled/config/sentinel.yaml +57 -0
  5. action_sentinel/_bundled/examples/evaluation_datasets/sentinel_synthetic_v1.jsonl +86 -0
  6. action_sentinel/_bundled/examples/rule_packs/agent_tasks.yaml +22 -0
  7. action_sentinel/_bundled/examples/rule_packs/classifier.yaml +32 -0
  8. action_sentinel/_bundled/examples/rule_packs/core.yaml +192 -0
  9. action_sentinel/_bundled/examples/sample_actions/actions.jsonl +6 -0
  10. action_sentinel/_bundled/examples/sample_actions/my_action.json +17 -0
  11. action_sentinel/_bundled/examples/sample_actions/one.json +26 -0
  12. action_sentinel/api/__init__.py +3 -0
  13. action_sentinel/api/app.py +309 -0
  14. action_sentinel/audit.py +72 -0
  15. action_sentinel/cli.py +607 -0
  16. action_sentinel/config.py +117 -0
  17. action_sentinel/contracts/__init__.py +36 -0
  18. action_sentinel/contracts/actions.py +86 -0
  19. action_sentinel/contracts/audit.py +24 -0
  20. action_sentinel/contracts/common.py +84 -0
  21. action_sentinel/contracts/decisions.py +268 -0
  22. action_sentinel/contracts/evaluation.py +80 -0
  23. action_sentinel/contracts/execution.py +51 -0
  24. action_sentinel/contracts/review.py +74 -0
  25. action_sentinel/dashboard/app.py +389 -0
  26. action_sentinel/demo.py +215 -0
  27. action_sentinel/disagreement.py +81 -0
  28. action_sentinel/evaluation/__init__.py +6 -0
  29. action_sentinel/evaluation/datasets.py +44 -0
  30. action_sentinel/evaluation/lab.py +265 -0
  31. action_sentinel/evaluation/metrics.py +122 -0
  32. action_sentinel/evaluation/report.py +106 -0
  33. action_sentinel/execution/__init__.py +5 -0
  34. action_sentinel/execution/authorization.py +76 -0
  35. action_sentinel/execution/executor.py +176 -0
  36. action_sentinel/governance/__init__.py +13 -0
  37. action_sentinel/governance/policy.py +154 -0
  38. action_sentinel/governance/review.py +127 -0
  39. action_sentinel/guard.py +400 -0
  40. action_sentinel/providers/__init__.py +13 -0
  41. action_sentinel/providers/base.py +142 -0
  42. action_sentinel/providers/mock.py +62 -0
  43. action_sentinel/providers/ollama.py +126 -0
  44. action_sentinel/providers/registry.py +144 -0
  45. action_sentinel/providers/rule_based.py +65 -0
  46. action_sentinel/providers/runner.py +71 -0
  47. action_sentinel/providers/vegaml_provider.py +229 -0
  48. action_sentinel/remote.py +120 -0
  49. action_sentinel/resources.py +65 -0
  50. action_sentinel/service.py +396 -0
  51. action_sentinel/storage/__init__.py +4 -0
  52. action_sentinel/storage/base.py +50 -0
  53. action_sentinel/storage/sqlite.py +229 -0
  54. action_sentinel/uncertainty.py +97 -0
  55. action_sentinel/validation/__init__.py +16 -0
  56. action_sentinel/validation/engine.py +206 -0
  57. action_sentinel/validation/grammar.py +210 -0
  58. action_sentinel/validation/packs.py +229 -0
  59. action_sentinel/vegalab/__init__.py +1 -0
  60. action_sentinel/vegalab/analysis.py +190 -0
  61. action_sentinel/vegalab/api.py +60 -0
  62. action_sentinel/vegalab/contracts.py +214 -0
  63. action_sentinel/vegalab/datasets.py +379 -0
  64. action_sentinel/vegalab/experiment.py +82 -0
  65. action_sentinel/vegalab/heads.py +95 -0
  66. action_sentinel/vegalab/report.py +125 -0
  67. action_sentinel/vegalab/runner.py +147 -0
  68. action_sentinel/vegalab/service.py +86 -0
  69. action_sentinel/vegalab/systems.py +270 -0
  70. action_sentinel/vegalab/tasks.py +137 -0
  71. action_sentinel/vegalab/testing.py +100 -0
  72. action_sentinel/vegalab/vega_core.py +362 -0
  73. action_sentinel-0.2.0.dist-info/METADATA +384 -0
  74. action_sentinel-0.2.0.dist-info/RECORD +78 -0
  75. action_sentinel-0.2.0.dist-info/WHEEL +5 -0
  76. action_sentinel-0.2.0.dist-info/entry_points.txt +2 -0
  77. action_sentinel-0.2.0.dist-info/licenses/LICENSE +202 -0
  78. action_sentinel-0.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,3 @@
1
+ """Sentinel: uncertainty-aware decision intelligence and governance for AI agent actions."""
2
+
3
+ __version__ = "0.2.0"
@@ -0,0 +1,3 @@
1
+ from action_sentinel.cli import main
2
+ import sys
3
+ sys.exit(main())
@@ -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}