agent-execution-guard 0.1.0__tar.gz

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.
@@ -0,0 +1,175 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submitted" means any form of electronic, verbal,
51
+ or written communication sent to the Licensor or its representatives,
52
+ including but not limited to communication on electronic mailing lists,
53
+ source code control systems, and issue tracking systems that are managed
54
+ by, or on behalf of, the Licensor for the purpose of discussing and
55
+ improving the Work, but excluding communication that is conspicuously
56
+ marked or designated in writing by the copyright owner as "Not a
57
+ Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
60
+ whom a Contribution has been received by the Licensor and included
61
+ within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of
64
+ this License, each Contributor hereby grants to You a perpetual,
65
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66
+ copyright license to reproduce, prepare Derivative Works of,
67
+ publicly display, publicly perform, sublicense, and distribute the
68
+ Work and such Derivative Works in Source or Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ (except as stated in this section) patent license to make, have made,
74
+ use, offer to sell, sell, import, and otherwise transfer the Work,
75
+ where such license applies only to those patent claims licensable
76
+ by such Contributor that are necessarily infringed by their
77
+ Contribution(s) alone or by the combination of their Contribution(s)
78
+ with the Work to which such Contribution(s) was submitted. If You
79
+ institute patent litigation against any entity (including a cross-claim
80
+ or counterclaim in a lawsuit) alleging that the Work or any other
81
+ Contribution embodied in the Work constitutes patent or contributory
82
+ patent infringement, then any patent licenses granted to You under
83
+ this License for that Work shall terminate as of the date such
84
+ litigation is filed.
85
+
86
+ 4. Redistribution. You may reproduce and distribute copies of the
87
+ Work or Derivative Works thereof in any medium, with or without
88
+ modifications, and in Source or Object form, provided that You
89
+ meet the following conditions:
90
+
91
+ (a) You must give any other recipients of the Work or Derivative
92
+ Works a copy of this License; and
93
+
94
+ (b) You must cause any modified files to carry prominent notices
95
+ stating that You changed the files; and
96
+
97
+ (c) You must retain, in the Source form of any Derivative Works
98
+ that You distribute, all copyright, patent, trademark, and
99
+ attribution notices from the Source form of the Work,
100
+ excluding those notices that do not pertain to any part of
101
+ the Derivative Works; and
102
+
103
+ (d) If the Work includes a "NOTICE" text file as part of its
104
+ distribution, You must include a readable copy of the
105
+ attribution notices contained within such NOTICE file, in
106
+ at least one of the following places: within a NOTICE text
107
+ file distributed as part of the Derivative Works; within
108
+ the Source form or documentation, if provided along with the
109
+ Derivative Works; or, within a display generated by the
110
+ Derivative Works, if and wherever such third-party notices
111
+ normally appear. The contents of the NOTICE file are for
112
+ informational purposes only and do not modify the License.
113
+ You may add Your own attribution notices within Derivative
114
+ Works that You distribute, alongside or as an addendum to
115
+ the NOTICE text from the Work, provided that such additional
116
+ attribution notices cannot be construed as modifying the License.
117
+
118
+ You may add Your own license statement for Your modifications and
119
+ may provide additional grant of rights to use, copy, modify, merge,
120
+ publish, distribute, sublicense, and/or sell copies of the
121
+ Contribution.
122
+
123
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
124
+ any Contribution intentionally submitted for inclusion in the Work
125
+ by You to the Licensor shall be under the terms and conditions of
126
+ this License, without any additional terms or conditions.
127
+ Notwithstanding the above, nothing herein shall supersede or modify
128
+ the terms of any separate license agreement you may have executed
129
+ with Licensor regarding such Contributions.
130
+
131
+ 6. Trademarks. This License does not grant permission to use the trade
132
+ names, trademarks, service marks, or product names of the Licensor,
133
+ except as required for reasonable and customary use in describing the
134
+ origin of the Work and reproducing the content of the NOTICE file.
135
+
136
+ 7. Disclaimer of Warranty. Unless required by applicable law or
137
+ agreed to in writing, Licensor provides the Work (and each
138
+ Contributor provides its Contributions) on an "AS IS" BASIS,
139
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
140
+ implied, including, without limitation, any warranties or conditions
141
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
142
+ PARTICULAR PURPOSE. You are solely responsible for determining the
143
+ appropriateness of using or reproducing the Work and assume any
144
+ risks associated with Your exercise of permissions under this License.
145
+
146
+ 8. Limitation of Liability. In no event and under no legal theory,
147
+ whether in tort (including negligence), contract, or otherwise,
148
+ unless required by applicable law (such as deliberate and grossly
149
+ negligent acts) or agreed to in writing, shall any Contributor be
150
+ liable to You for damages, including any direct, indirect, special,
151
+ incidental, or exemplary damages of any character arising as a
152
+ result of this License or out of the use or inability to use the
153
+ Work (including but not limited to damages for loss of goodwill,
154
+ work stoppage, computer failure or malfunction, or all other
155
+ commercial damages or losses), even if such Contributor has been
156
+ advised of the possibility of such damages.
157
+
158
+ 9. Accepting Warranty or Additional Liability. While redistributing
159
+ the Work or Derivative Works thereof, You may choose to offer,
160
+ and charge a fee for, acceptance of support, warranty, indemnity,
161
+ or other liability obligations and/or rights consistent with this
162
+ License. However, in accepting such obligations, You may offer such
163
+ obligations only on Your own behalf and on Your sole responsibility,
164
+ not on behalf of any other Contributor, and only if You agree to
165
+ indemnify, defend, and hold each Contributor harmless for any
166
+ liability incurred by, or claims asserted against, such Contributor
167
+ by reason of your accepting any such warranty or additional liability.
168
+
169
+ Copyright 2026 Nick Heo
170
+
171
+ Licensed under the Apache License, Version 2.0 (the "License");
172
+ you may not use this file except in compliance with the License.
173
+ You may obtain a copy of the License at
174
+
175
+ http://www.apache.org/licenses/LICENSE-2.0
@@ -0,0 +1,6 @@
1
+ exclude tests/*
2
+ exclude docs/*
3
+ exclude examples/*
4
+ exclude demo/*
5
+ exclude *.ndjson
6
+ exclude *.json
@@ -0,0 +1,269 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-execution-guard
3
+ Version: 0.1.0
4
+ Summary: A lightweight execution guard for AI agents. Decide ALLOW / HOLD / DENY before your agent performs real actions.
5
+ Author-email: Nick Heo <nick-heo-eg@users.noreply.github.com>
6
+ License: Apache-2.0
7
+ Keywords: ai,agent,guard,execution,governance,llm,safety
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
12
+ Classifier: Topic :: Security
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: cryptography>=42.0.0
21
+ Provides-Extra: dev
22
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
23
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
24
+ Dynamic: license-file
25
+
26
+ # agent-execution-guard
27
+
28
+ **A lightweight execution guard for AI agents.**
29
+
30
+ Decide `ALLOW` / `HOLD` / `DENY` before your agent performs real actions.
31
+
32
+ ```bash
33
+ pip install agent-execution-guard
34
+ ```
35
+
36
+ ---
37
+
38
+ ## The problem
39
+
40
+ Your AI agent will execute anything.
41
+
42
+ ```python
43
+ agent.run("wire_transfer amount=50000 to=external") # proceeds
44
+ agent.run("delete all user records") # also proceeds
45
+ agent.run("send mass email to customer list") # also proceeds
46
+ ```
47
+
48
+ There is no structural layer that stops it.
49
+ Prompts can be bypassed. Guardrails can be talked around.
50
+
51
+ **This is that layer.**
52
+
53
+ ---
54
+
55
+ ## Quickstart
56
+
57
+ ```python
58
+ from datetime import datetime, timezone
59
+ from agent_execution_guard import ExecutionGuard, Intent
60
+
61
+ guard = ExecutionGuard()
62
+
63
+ intent = Intent(
64
+ actor="agent.finance",
65
+ action="wire_transfer",
66
+ payload="wire_transfer amount=50000 to=external",
67
+ timestamp=datetime.now(timezone.utc),
68
+ )
69
+
70
+ result = guard.evaluate(intent)
71
+ print(result.decision) # ALLOW / DENY / HOLD
72
+ print(result.risk_score) # 0–100
73
+ print(result.reason)
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Example 1 — Finance: DENY
79
+
80
+ ```python
81
+ from agent_execution_guard import ExecutionGuard, Intent, GuardDeniedError
82
+ from datetime import datetime, timezone
83
+
84
+ guard = ExecutionGuard()
85
+
86
+ intent = Intent(
87
+ actor="agent.finance",
88
+ action="wire_transfer",
89
+ payload="wire_transfer amount=50000 to=external",
90
+ timestamp=datetime.now(timezone.utc),
91
+ )
92
+
93
+ try:
94
+ result = guard.evaluate(intent)
95
+ print(f"Allowed: {result.boundary_id}")
96
+
97
+ except GuardDeniedError as e:
98
+ print(f"Denied: {e.reason}")
99
+ print(f"Proof: {e.boundary_id}")
100
+ # Signed negative proof issued — execution structurally blocked
101
+ ```
102
+
103
+ **Output:**
104
+ ```
105
+ Denied: risk_score=85 exceeds threshold=80
106
+ Proof: 3f9a1c2d-...
107
+ ```
108
+
109
+ Every denial issues a **signed proof**. The agent cannot retry past it.
110
+
111
+ ---
112
+
113
+ ## Example 2 — Campaign AI: HOLD
114
+
115
+ ```python
116
+ from agent_execution_guard import ExecutionGuard, Intent, SystemSeverity, GuardHeldError
117
+ from datetime import datetime, timezone
118
+
119
+ guard = ExecutionGuard()
120
+
121
+ intent = Intent(
122
+ actor="campaign_ai",
123
+ action="aggressive_targeting",
124
+ payload="launch targeted ad campaign segment=undecided_voters",
125
+ timestamp=datetime.now(timezone.utc),
126
+ )
127
+
128
+ # Elevated system severity (e.g. election period, market stress)
129
+ severity = SystemSeverity(score=0.60, source="geopolitical_risk_model")
130
+
131
+ try:
132
+ result = guard.evaluate(intent, severity=severity)
133
+
134
+ except GuardHeldError as e:
135
+ print(f"Held — requires human approval")
136
+ print(f"Deadline: {e.deadline_ts}")
137
+ print(f"Proof: {e.boundary_id}")
138
+ ```
139
+
140
+ **Output:**
141
+ ```
142
+ Held — requires human approval
143
+ Deadline: 2026-03-01T10:28:00+00:00
144
+ Proof: 7d2f9e1a-...
145
+ ```
146
+
147
+ `HOLD` is not a failure. It is a **decision checkpoint**.
148
+ Execution waits for a human token before proceeding.
149
+
150
+ ---
151
+
152
+ ## How it works
153
+
154
+ ```
155
+ Intent → Risk Score → Severity State → Guard Decision → Signed Proof
156
+ ```
157
+
158
+ | Component | What it does |
159
+ |-----------|-------------|
160
+ | Risk scoring | Rule-based 0–100 score per action |
161
+ | Severity gate | ACTIVE / OBSERVE / COOLDOWN — tightens threshold as risk rises |
162
+ | Policy guard | Unknown agent or action → immediate DENY |
163
+ | Decision trail | Every decision signed (ED25519) + ledgered (SHA-256 chain) |
164
+
165
+ ### Three states
166
+
167
+ | State | Trigger | Threshold |
168
+ |-------|---------|-----------|
169
+ | ACTIVE | severity < 0.20 | risk ≥ 80 → DENY |
170
+ | OBSERVE | severity ≥ 0.20 | risk ≥ 60 → DENY |
171
+ | COOLDOWN | severity ≥ 0.40 | risk ≥ 30 → DENY |
172
+
173
+ Hysteresis prevents oscillation between states.
174
+
175
+ ### Four outcomes
176
+
177
+ | Outcome | Meaning |
178
+ |---------|---------|
179
+ | `ALLOW` | Proceed. Signed proof issued. |
180
+ | `DENY` | Blocked. Signed negative proof issued. Agent cannot retry. |
181
+ | `HOLD` | Awaiting human approval. Deadline enforced. |
182
+ | `EXPIRED` | HOLD deadline passed without approval. Blocked. |
183
+
184
+ ---
185
+
186
+ ## Policy guard
187
+
188
+ Unknown agents and actions are denied by default.
189
+
190
+ ```yaml
191
+ # policy.yaml
192
+ defaults:
193
+ unknown_agent: DENY
194
+ unknown_action: DENY
195
+
196
+ identity:
197
+ agents:
198
+ - agent_id: "agent.finance"
199
+ allowed_actions:
200
+ - action: "wire_transfer"
201
+ - action: "read_ledger"
202
+ ```
203
+
204
+ ```python
205
+ import yaml
206
+ with open("policy.yaml") as f:
207
+ policy = yaml.safe_load(f)
208
+
209
+ result = guard.evaluate(intent, policy=policy)
210
+ # unknown agent → immediate DENY, signed proof, no risk scoring needed
211
+ ```
212
+
213
+ ---
214
+
215
+ ## Cryptographic proof
216
+
217
+ Every decision — `ALLOW` and `DENY` — is signed and ledgered.
218
+
219
+ ```python
220
+ # Verify any past decision
221
+ verification = guard.verify(proof)
222
+ print(verification.valid) # True
223
+ print(verification.message) # "Proof verified at ledger index 7"
224
+ ```
225
+
226
+ - Algorithm: ED25519
227
+ - Ledger: append-only NDJSON with SHA-256 hash chain
228
+ - Verification: offline, no external dependencies
229
+
230
+ ---
231
+
232
+ ## Install
233
+
234
+ ```bash
235
+ pip install agent-execution-guard
236
+ ```
237
+
238
+ Requires Python 3.10+. No external services. Runs offline.
239
+
240
+ Optional:
241
+ ```bash
242
+ pip install pyyaml # for policy.yaml loading
243
+ pip install opentelemetry-api # for OTel span export
244
+ ```
245
+
246
+ ---
247
+
248
+ ## Roadmap
249
+
250
+ - [x] Rule-based risk scoring (ALLOW / DENY)
251
+ - [x] ED25519 cryptographic proof
252
+ - [x] Append-only hash-chain ledger
253
+ - [x] Severity-driven state machine (ACTIVE / OBSERVE / COOLDOWN)
254
+ - [x] Policy guard (unknown agent/action → DENY)
255
+ - [x] HOLD state + human approval checkpoint
256
+ - [ ] `pip install agent-execution-guard` (TestPyPI → PyPI)
257
+ - [ ] OTel-native decision trail export
258
+ - [ ] MCP integration for agent frameworks
259
+ - [ ] Human-in-the-loop authority token protocol
260
+
261
+ ---
262
+
263
+ ## License
264
+
265
+ Apache 2.0
266
+
267
+ ---
268
+
269
+ *Your AI agent will execute anything. This makes it stop.*
@@ -0,0 +1,244 @@
1
+ # agent-execution-guard
2
+
3
+ **A lightweight execution guard for AI agents.**
4
+
5
+ Decide `ALLOW` / `HOLD` / `DENY` before your agent performs real actions.
6
+
7
+ ```bash
8
+ pip install agent-execution-guard
9
+ ```
10
+
11
+ ---
12
+
13
+ ## The problem
14
+
15
+ Your AI agent will execute anything.
16
+
17
+ ```python
18
+ agent.run("wire_transfer amount=50000 to=external") # proceeds
19
+ agent.run("delete all user records") # also proceeds
20
+ agent.run("send mass email to customer list") # also proceeds
21
+ ```
22
+
23
+ There is no structural layer that stops it.
24
+ Prompts can be bypassed. Guardrails can be talked around.
25
+
26
+ **This is that layer.**
27
+
28
+ ---
29
+
30
+ ## Quickstart
31
+
32
+ ```python
33
+ from datetime import datetime, timezone
34
+ from agent_execution_guard import ExecutionGuard, Intent
35
+
36
+ guard = ExecutionGuard()
37
+
38
+ intent = Intent(
39
+ actor="agent.finance",
40
+ action="wire_transfer",
41
+ payload="wire_transfer amount=50000 to=external",
42
+ timestamp=datetime.now(timezone.utc),
43
+ )
44
+
45
+ result = guard.evaluate(intent)
46
+ print(result.decision) # ALLOW / DENY / HOLD
47
+ print(result.risk_score) # 0–100
48
+ print(result.reason)
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Example 1 — Finance: DENY
54
+
55
+ ```python
56
+ from agent_execution_guard import ExecutionGuard, Intent, GuardDeniedError
57
+ from datetime import datetime, timezone
58
+
59
+ guard = ExecutionGuard()
60
+
61
+ intent = Intent(
62
+ actor="agent.finance",
63
+ action="wire_transfer",
64
+ payload="wire_transfer amount=50000 to=external",
65
+ timestamp=datetime.now(timezone.utc),
66
+ )
67
+
68
+ try:
69
+ result = guard.evaluate(intent)
70
+ print(f"Allowed: {result.boundary_id}")
71
+
72
+ except GuardDeniedError as e:
73
+ print(f"Denied: {e.reason}")
74
+ print(f"Proof: {e.boundary_id}")
75
+ # Signed negative proof issued — execution structurally blocked
76
+ ```
77
+
78
+ **Output:**
79
+ ```
80
+ Denied: risk_score=85 exceeds threshold=80
81
+ Proof: 3f9a1c2d-...
82
+ ```
83
+
84
+ Every denial issues a **signed proof**. The agent cannot retry past it.
85
+
86
+ ---
87
+
88
+ ## Example 2 — Campaign AI: HOLD
89
+
90
+ ```python
91
+ from agent_execution_guard import ExecutionGuard, Intent, SystemSeverity, GuardHeldError
92
+ from datetime import datetime, timezone
93
+
94
+ guard = ExecutionGuard()
95
+
96
+ intent = Intent(
97
+ actor="campaign_ai",
98
+ action="aggressive_targeting",
99
+ payload="launch targeted ad campaign segment=undecided_voters",
100
+ timestamp=datetime.now(timezone.utc),
101
+ )
102
+
103
+ # Elevated system severity (e.g. election period, market stress)
104
+ severity = SystemSeverity(score=0.60, source="geopolitical_risk_model")
105
+
106
+ try:
107
+ result = guard.evaluate(intent, severity=severity)
108
+
109
+ except GuardHeldError as e:
110
+ print(f"Held — requires human approval")
111
+ print(f"Deadline: {e.deadline_ts}")
112
+ print(f"Proof: {e.boundary_id}")
113
+ ```
114
+
115
+ **Output:**
116
+ ```
117
+ Held — requires human approval
118
+ Deadline: 2026-03-01T10:28:00+00:00
119
+ Proof: 7d2f9e1a-...
120
+ ```
121
+
122
+ `HOLD` is not a failure. It is a **decision checkpoint**.
123
+ Execution waits for a human token before proceeding.
124
+
125
+ ---
126
+
127
+ ## How it works
128
+
129
+ ```
130
+ Intent → Risk Score → Severity State → Guard Decision → Signed Proof
131
+ ```
132
+
133
+ | Component | What it does |
134
+ |-----------|-------------|
135
+ | Risk scoring | Rule-based 0–100 score per action |
136
+ | Severity gate | ACTIVE / OBSERVE / COOLDOWN — tightens threshold as risk rises |
137
+ | Policy guard | Unknown agent or action → immediate DENY |
138
+ | Decision trail | Every decision signed (ED25519) + ledgered (SHA-256 chain) |
139
+
140
+ ### Three states
141
+
142
+ | State | Trigger | Threshold |
143
+ |-------|---------|-----------|
144
+ | ACTIVE | severity < 0.20 | risk ≥ 80 → DENY |
145
+ | OBSERVE | severity ≥ 0.20 | risk ≥ 60 → DENY |
146
+ | COOLDOWN | severity ≥ 0.40 | risk ≥ 30 → DENY |
147
+
148
+ Hysteresis prevents oscillation between states.
149
+
150
+ ### Four outcomes
151
+
152
+ | Outcome | Meaning |
153
+ |---------|---------|
154
+ | `ALLOW` | Proceed. Signed proof issued. |
155
+ | `DENY` | Blocked. Signed negative proof issued. Agent cannot retry. |
156
+ | `HOLD` | Awaiting human approval. Deadline enforced. |
157
+ | `EXPIRED` | HOLD deadline passed without approval. Blocked. |
158
+
159
+ ---
160
+
161
+ ## Policy guard
162
+
163
+ Unknown agents and actions are denied by default.
164
+
165
+ ```yaml
166
+ # policy.yaml
167
+ defaults:
168
+ unknown_agent: DENY
169
+ unknown_action: DENY
170
+
171
+ identity:
172
+ agents:
173
+ - agent_id: "agent.finance"
174
+ allowed_actions:
175
+ - action: "wire_transfer"
176
+ - action: "read_ledger"
177
+ ```
178
+
179
+ ```python
180
+ import yaml
181
+ with open("policy.yaml") as f:
182
+ policy = yaml.safe_load(f)
183
+
184
+ result = guard.evaluate(intent, policy=policy)
185
+ # unknown agent → immediate DENY, signed proof, no risk scoring needed
186
+ ```
187
+
188
+ ---
189
+
190
+ ## Cryptographic proof
191
+
192
+ Every decision — `ALLOW` and `DENY` — is signed and ledgered.
193
+
194
+ ```python
195
+ # Verify any past decision
196
+ verification = guard.verify(proof)
197
+ print(verification.valid) # True
198
+ print(verification.message) # "Proof verified at ledger index 7"
199
+ ```
200
+
201
+ - Algorithm: ED25519
202
+ - Ledger: append-only NDJSON with SHA-256 hash chain
203
+ - Verification: offline, no external dependencies
204
+
205
+ ---
206
+
207
+ ## Install
208
+
209
+ ```bash
210
+ pip install agent-execution-guard
211
+ ```
212
+
213
+ Requires Python 3.10+. No external services. Runs offline.
214
+
215
+ Optional:
216
+ ```bash
217
+ pip install pyyaml # for policy.yaml loading
218
+ pip install opentelemetry-api # for OTel span export
219
+ ```
220
+
221
+ ---
222
+
223
+ ## Roadmap
224
+
225
+ - [x] Rule-based risk scoring (ALLOW / DENY)
226
+ - [x] ED25519 cryptographic proof
227
+ - [x] Append-only hash-chain ledger
228
+ - [x] Severity-driven state machine (ACTIVE / OBSERVE / COOLDOWN)
229
+ - [x] Policy guard (unknown agent/action → DENY)
230
+ - [x] HOLD state + human approval checkpoint
231
+ - [ ] `pip install agent-execution-guard` (TestPyPI → PyPI)
232
+ - [ ] OTel-native decision trail export
233
+ - [ ] MCP integration for agent frameworks
234
+ - [ ] Human-in-the-loop authority token protocol
235
+
236
+ ---
237
+
238
+ ## License
239
+
240
+ Apache 2.0
241
+
242
+ ---
243
+
244
+ *Your AI agent will execute anything. This makes it stop.*