agent-blackbox-jep 0.2.0a2__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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 jep-protocol
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,11 @@
1
+ # Notice
2
+
3
+ Agent Blackbox is an experimental JEP/HJS/JAC runtime trace recorder.
4
+
5
+ It supports incident review and declared chain reconstruction.
6
+
7
+ It does not determine legal liability, factual truth, regulatory compliance, complete-log availability, model correctness, or moral responsibility.
8
+
9
+ Internet-Draft text and excerpts are governed by the IETF Trust Legal Provisions and BCP 78 / BCP 79.
10
+
11
+ Implementation code, examples, and tests are provided under the repository license unless otherwise stated.
@@ -0,0 +1,264 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-blackbox-jep
3
+ Version: 0.2.0a2
4
+ Summary: Experimental JEP/HJS/JAC runtime blackbox recorder for agent workflow incident review
5
+ Author-email: HJS Spec <signal@humanjudgment.org>
6
+ License: MIT
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Requires-Python: >=3.9
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ License-File: NOTICE.md
19
+ Requires-Dist: PyNaCl<2,>=1.6.2
20
+ Requires-Dist: cryptography>=41.0.0
21
+ Requires-Dist: rfc8785<1,>=0.1.4
22
+ Requires-Dist: pydantic>=2.0.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
25
+ Dynamic: license-file
26
+
27
+ # Agent Blackbox
28
+
29
+ Runtime blackbox recorder for agent workflows using **JEP events**, **HJS evidence references**, and **JAC declared dependency chains**.
30
+
31
+ > Experimental implementation seed.
32
+ >
33
+ > Agent Blackbox supports incident review and chain reconstruction.
34
+ > It does **not** determine legal liability, factual truth, regulatory compliance, or moral responsibility.
35
+
36
+ ---
37
+
38
+ ## What This Is
39
+
40
+ Agent Blackbox records structured execution traces for agent workflows.
41
+
42
+ For each traced operation it can record:
43
+
44
+ - who executed the operation;
45
+ - when it happened;
46
+ - input/output/error digests;
47
+ - a JEP v0.6-style event;
48
+ - a JAC v0.5-style dependency edge;
49
+ - optional HJS-style evidence references;
50
+ - a local JSONL blackbox log;
51
+ - an incident review report.
52
+
53
+ It is designed to help operators answer:
54
+
55
+ ```text
56
+ What happened?
57
+ Which event failed?
58
+ Which prior event was this based on?
59
+ Which declared dependency path led here?
60
+ Which evidence references are available for review?
61
+ ```
62
+
63
+ It is **not** designed to answer:
64
+
65
+ ```text
66
+ Who is legally liable?
67
+ Who is morally at fault?
68
+ Was the system compliant?
69
+ Was the model correct?
70
+ Was the log complete?
71
+ ```
72
+
73
+ ---
74
+
75
+ ## Relationship to JEP / HJS / JAC
76
+
77
+ ```text
78
+ JEP = atomic signed judgment events
79
+ HJS = accountability receipts, archive/privacy/evidence lifecycle
80
+ JAC = declared dependency and accountability chains
81
+ Agent Blackbox = runtime trace recorder and incident review utility
82
+ ```
83
+
84
+ Aligned with:
85
+
86
+ - JEP v0.6: https://github.com/hjs-spec/jep-v06
87
+ - JEP API v0.6: https://github.com/hjs-spec/jep-api
88
+ - HJS v0.5: https://github.com/hjs-spec/hjs-05
89
+ - JAC v0.5: https://github.com/hjs-spec/jac-agent-02
90
+
91
+ Public drafts:
92
+
93
+ - JEP-Core: https://datatracker.ietf.org/doc/draft-wang-jep-judgment-event-protocol/
94
+ - HJS: https://datatracker.ietf.org/doc/draft-wang-hjs-accountability/
95
+ - JAC: https://datatracker.ietf.org/doc/draft-wang-jac/
96
+
97
+ ---
98
+
99
+ ## Core Features
100
+
101
+ | Feature | Description |
102
+ |---|---|
103
+ | Trace decorator | Wrap agent functions and record runtime events |
104
+ | JEP-style event | Emits JEP v0.6-style J/D/T/V event objects |
105
+ | JAC chain extension | Uses `ext["https://jac.org/chain"]` instead of deprecated `task_based_on` |
106
+ | HJS evidence refs | Records input/output/error digests as evidence references |
107
+ | Local blackbox log | Stores JSONL event records for later review |
108
+ | Incident review | Reconstructs declared chain fragments around an incident |
109
+ | Integrity check | Verifies event hashes and Ed25519 signatures generated by this library |
110
+
111
+ ---
112
+
113
+ ## Installation
114
+
115
+ Install the published distribution:
116
+
117
+ ```bash
118
+ pip install agent-blackbox-jep==0.2.0a2
119
+ ```
120
+
121
+ The PyPI distribution is named `agent-blackbox-jep` because `agent-blackbox` is unavailable on PyPI. Python imports remain `agent_blackbox`, and the CLI commands remain `agent-blackbox` and `blame-finder`.
122
+
123
+ For local development:
124
+
125
+ ```bash
126
+ pip install -e .
127
+ ```
128
+
129
+ ---
130
+
131
+ ## Basic Usage
132
+
133
+ ```python
134
+ from agent_blackbox import AgentBlackbox
135
+
136
+ blackbox = AgentBlackbox(storage="./blackbox_logs")
137
+
138
+ @blackbox.trace(agent_name="CoderAgent")
139
+ def write_code(requirement: str) -> str:
140
+ return "print('hello world')"
141
+
142
+ result = write_code("write a hello world")
143
+
144
+ # Review the latest event
145
+ event_hash = list(blackbox.events.keys())[-1]
146
+ report = blackbox.review_incident(event_hash)
147
+
148
+ print(report["candidate_failure_node"])
149
+ print(report["chain"])
150
+ ```
151
+
152
+ ---
153
+
154
+ ## JAC v0.5 Chain Extension
155
+
156
+ Agent Blackbox does not use the deprecated top-level `task_based_on` field.
157
+
158
+ It uses:
159
+
160
+ ```json
161
+ {
162
+ "ext": {
163
+ "https://jac.org/chain": {
164
+ "based_on": "sha256:...",
165
+ "based_on_type": "jep-event",
166
+ "relation": "derived-from",
167
+ "observed_log_assumption": "partial"
168
+ }
169
+ },
170
+ "ext_crit": ["https://jac.org/chain"]
171
+ }
172
+ ```
173
+
174
+ ---
175
+
176
+ ## Incident Review Output
177
+
178
+ Example:
179
+
180
+ ```json
181
+ {
182
+ "incident": "sha256:...",
183
+ "candidate_failure_node": "CoderAgent",
184
+ "diagnostic_summary": "The selected event has status failed. Review declared parents and evidence references.",
185
+ "review_score": 0.72,
186
+ "chain": [
187
+ {
188
+ "event_hash": "sha256:...",
189
+ "agent": "PlannerAgent",
190
+ "status": "success"
191
+ },
192
+ {
193
+ "event_hash": "sha256:...",
194
+ "agent": "CoderAgent",
195
+ "status": "failed"
196
+ }
197
+ ],
198
+ "boundary": {
199
+ "not_legal_liability": true,
200
+ "not_factual_causality_proof": true,
201
+ "not_compliance_determination": true
202
+ }
203
+ }
204
+ ```
205
+
206
+ ---
207
+
208
+ ## CLI
209
+
210
+ Review an incident:
211
+
212
+ ```bash
213
+ agent-blackbox review sha256:...
214
+ ```
215
+
216
+ Show a chain tree:
217
+
218
+ ```bash
219
+ agent-blackbox tree sha256:...
220
+ ```
221
+
222
+ Verify an event:
223
+
224
+ ```bash
225
+ agent-blackbox verify sha256:...
226
+ ```
227
+
228
+ ---
229
+
230
+ ## Boundary Statement
231
+
232
+ A valid Agent Blackbox trace means a local runtime event was recorded and structurally linked.
233
+
234
+ It does not prove:
235
+
236
+ - legal liability;
237
+ - factual causality;
238
+ - regulatory compliance;
239
+ - complete-log availability;
240
+ - model correctness;
241
+ - moral responsibility.
242
+
243
+ A valid signature proves integrity of the event under the local key used by this library.
244
+
245
+ It does not prove the underlying claim is true.
246
+
247
+ ---
248
+
249
+ ## Status
250
+
251
+ ```text
252
+ Version: 0.2.0a2
253
+ Status: experimental implementation seed
254
+ ```
255
+
256
+ ---
257
+
258
+ ## License
259
+
260
+ MIT
261
+
262
+ ## Runtime and verification notes
263
+
264
+ See [HARDENING.md](HARDENING.md) for supported behavior, regression checks, and compatibility boundaries.
@@ -0,0 +1,238 @@
1
+ # Agent Blackbox
2
+
3
+ Runtime blackbox recorder for agent workflows using **JEP events**, **HJS evidence references**, and **JAC declared dependency chains**.
4
+
5
+ > Experimental implementation seed.
6
+ >
7
+ > Agent Blackbox supports incident review and chain reconstruction.
8
+ > It does **not** determine legal liability, factual truth, regulatory compliance, or moral responsibility.
9
+
10
+ ---
11
+
12
+ ## What This Is
13
+
14
+ Agent Blackbox records structured execution traces for agent workflows.
15
+
16
+ For each traced operation it can record:
17
+
18
+ - who executed the operation;
19
+ - when it happened;
20
+ - input/output/error digests;
21
+ - a JEP v0.6-style event;
22
+ - a JAC v0.5-style dependency edge;
23
+ - optional HJS-style evidence references;
24
+ - a local JSONL blackbox log;
25
+ - an incident review report.
26
+
27
+ It is designed to help operators answer:
28
+
29
+ ```text
30
+ What happened?
31
+ Which event failed?
32
+ Which prior event was this based on?
33
+ Which declared dependency path led here?
34
+ Which evidence references are available for review?
35
+ ```
36
+
37
+ It is **not** designed to answer:
38
+
39
+ ```text
40
+ Who is legally liable?
41
+ Who is morally at fault?
42
+ Was the system compliant?
43
+ Was the model correct?
44
+ Was the log complete?
45
+ ```
46
+
47
+ ---
48
+
49
+ ## Relationship to JEP / HJS / JAC
50
+
51
+ ```text
52
+ JEP = atomic signed judgment events
53
+ HJS = accountability receipts, archive/privacy/evidence lifecycle
54
+ JAC = declared dependency and accountability chains
55
+ Agent Blackbox = runtime trace recorder and incident review utility
56
+ ```
57
+
58
+ Aligned with:
59
+
60
+ - JEP v0.6: https://github.com/hjs-spec/jep-v06
61
+ - JEP API v0.6: https://github.com/hjs-spec/jep-api
62
+ - HJS v0.5: https://github.com/hjs-spec/hjs-05
63
+ - JAC v0.5: https://github.com/hjs-spec/jac-agent-02
64
+
65
+ Public drafts:
66
+
67
+ - JEP-Core: https://datatracker.ietf.org/doc/draft-wang-jep-judgment-event-protocol/
68
+ - HJS: https://datatracker.ietf.org/doc/draft-wang-hjs-accountability/
69
+ - JAC: https://datatracker.ietf.org/doc/draft-wang-jac/
70
+
71
+ ---
72
+
73
+ ## Core Features
74
+
75
+ | Feature | Description |
76
+ |---|---|
77
+ | Trace decorator | Wrap agent functions and record runtime events |
78
+ | JEP-style event | Emits JEP v0.6-style J/D/T/V event objects |
79
+ | JAC chain extension | Uses `ext["https://jac.org/chain"]` instead of deprecated `task_based_on` |
80
+ | HJS evidence refs | Records input/output/error digests as evidence references |
81
+ | Local blackbox log | Stores JSONL event records for later review |
82
+ | Incident review | Reconstructs declared chain fragments around an incident |
83
+ | Integrity check | Verifies event hashes and Ed25519 signatures generated by this library |
84
+
85
+ ---
86
+
87
+ ## Installation
88
+
89
+ Install the published distribution:
90
+
91
+ ```bash
92
+ pip install agent-blackbox-jep==0.2.0a2
93
+ ```
94
+
95
+ The PyPI distribution is named `agent-blackbox-jep` because `agent-blackbox` is unavailable on PyPI. Python imports remain `agent_blackbox`, and the CLI commands remain `agent-blackbox` and `blame-finder`.
96
+
97
+ For local development:
98
+
99
+ ```bash
100
+ pip install -e .
101
+ ```
102
+
103
+ ---
104
+
105
+ ## Basic Usage
106
+
107
+ ```python
108
+ from agent_blackbox import AgentBlackbox
109
+
110
+ blackbox = AgentBlackbox(storage="./blackbox_logs")
111
+
112
+ @blackbox.trace(agent_name="CoderAgent")
113
+ def write_code(requirement: str) -> str:
114
+ return "print('hello world')"
115
+
116
+ result = write_code("write a hello world")
117
+
118
+ # Review the latest event
119
+ event_hash = list(blackbox.events.keys())[-1]
120
+ report = blackbox.review_incident(event_hash)
121
+
122
+ print(report["candidate_failure_node"])
123
+ print(report["chain"])
124
+ ```
125
+
126
+ ---
127
+
128
+ ## JAC v0.5 Chain Extension
129
+
130
+ Agent Blackbox does not use the deprecated top-level `task_based_on` field.
131
+
132
+ It uses:
133
+
134
+ ```json
135
+ {
136
+ "ext": {
137
+ "https://jac.org/chain": {
138
+ "based_on": "sha256:...",
139
+ "based_on_type": "jep-event",
140
+ "relation": "derived-from",
141
+ "observed_log_assumption": "partial"
142
+ }
143
+ },
144
+ "ext_crit": ["https://jac.org/chain"]
145
+ }
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Incident Review Output
151
+
152
+ Example:
153
+
154
+ ```json
155
+ {
156
+ "incident": "sha256:...",
157
+ "candidate_failure_node": "CoderAgent",
158
+ "diagnostic_summary": "The selected event has status failed. Review declared parents and evidence references.",
159
+ "review_score": 0.72,
160
+ "chain": [
161
+ {
162
+ "event_hash": "sha256:...",
163
+ "agent": "PlannerAgent",
164
+ "status": "success"
165
+ },
166
+ {
167
+ "event_hash": "sha256:...",
168
+ "agent": "CoderAgent",
169
+ "status": "failed"
170
+ }
171
+ ],
172
+ "boundary": {
173
+ "not_legal_liability": true,
174
+ "not_factual_causality_proof": true,
175
+ "not_compliance_determination": true
176
+ }
177
+ }
178
+ ```
179
+
180
+ ---
181
+
182
+ ## CLI
183
+
184
+ Review an incident:
185
+
186
+ ```bash
187
+ agent-blackbox review sha256:...
188
+ ```
189
+
190
+ Show a chain tree:
191
+
192
+ ```bash
193
+ agent-blackbox tree sha256:...
194
+ ```
195
+
196
+ Verify an event:
197
+
198
+ ```bash
199
+ agent-blackbox verify sha256:...
200
+ ```
201
+
202
+ ---
203
+
204
+ ## Boundary Statement
205
+
206
+ A valid Agent Blackbox trace means a local runtime event was recorded and structurally linked.
207
+
208
+ It does not prove:
209
+
210
+ - legal liability;
211
+ - factual causality;
212
+ - regulatory compliance;
213
+ - complete-log availability;
214
+ - model correctness;
215
+ - moral responsibility.
216
+
217
+ A valid signature proves integrity of the event under the local key used by this library.
218
+
219
+ It does not prove the underlying claim is true.
220
+
221
+ ---
222
+
223
+ ## Status
224
+
225
+ ```text
226
+ Version: 0.2.0a2
227
+ Status: experimental implementation seed
228
+ ```
229
+
230
+ ---
231
+
232
+ ## License
233
+
234
+ MIT
235
+
236
+ ## Runtime and verification notes
237
+
238
+ See [HARDENING.md](HARDENING.md) for supported behavior, regression checks, and compatibility boundaries.
@@ -0,0 +1,48 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "agent-blackbox-jep"
7
+ version = "0.2.0a2"
8
+ description = "Experimental JEP/HJS/JAC runtime blackbox recorder for agent workflow incident review"
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ authors = [
12
+ { name = "HJS Spec", email = "signal@humanjudgment.org" }
13
+ ]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.9",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ ]
24
+ requires-python = ">=3.9"
25
+ dependencies = [
26
+ "PyNaCl>=1.6.2,<2",
27
+ "cryptography>=41.0.0",
28
+ "rfc8785>=0.1.4,<1",
29
+ "pydantic>=2.0.0",
30
+ ]
31
+
32
+ [project.optional-dependencies]
33
+ dev = [
34
+ "pytest>=7.0.0",
35
+ ]
36
+
37
+ [project.scripts]
38
+ agent-blackbox = "agent_blackbox.cli:main"
39
+ blame-finder = "agent_blackbox.cli:main"
40
+
41
+ [tool.setuptools.packages.find]
42
+ where = ["src"]
43
+
44
+ [tool.black]
45
+ line-length = 88
46
+
47
+ [tool.ruff]
48
+ line-length = 88
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,17 @@
1
+ """Agent Blackbox: JEP/HJS/JAC runtime trace recorder."""
2
+
3
+ from .core import AgentBlackbox, TraceRecord, IncidentReview
4
+ from .jep import JEPEvent, Verb, JAC_CHAIN_EXT
5
+
6
+ # Backward-compatible alias for older examples.
7
+ BlameFinder = AgentBlackbox
8
+
9
+ __all__ = [
10
+ "AgentBlackbox",
11
+ "BlameFinder",
12
+ "TraceRecord",
13
+ "IncidentReview",
14
+ "JEPEvent",
15
+ "Verb",
16
+ "JAC_CHAIN_EXT",
17
+ ]
@@ -0,0 +1,51 @@
1
+ """CLI for Agent Blackbox."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import json
7
+ from pathlib import Path
8
+
9
+ from .core import AgentBlackbox
10
+
11
+
12
+ def build_parser() -> argparse.ArgumentParser:
13
+ parser = argparse.ArgumentParser(description="Agent Blackbox incident review utility")
14
+ parser.add_argument("--storage", default="./blackbox_logs", help="Blackbox log directory")
15
+
16
+ sub = parser.add_subparsers(dest="command")
17
+
18
+ review = sub.add_parser("review", help="Review an incident event hash")
19
+ review.add_argument("event_hash")
20
+
21
+ # Backward-compatible alias.
22
+ blame = sub.add_parser("blame", help="Alias for review")
23
+ blame.add_argument("event_hash")
24
+
25
+ tree = sub.add_parser("tree", help="Show declared dependency tree")
26
+ tree.add_argument("event_hash")
27
+
28
+ verify = sub.add_parser("verify", help="Verify a locally recorded event")
29
+ verify.add_argument("event_hash")
30
+
31
+ return parser
32
+
33
+
34
+ def main() -> None:
35
+ args = build_parser().parse_args()
36
+ blackbox = AgentBlackbox(storage=args.storage)
37
+
38
+ # This CLI operates on in-memory events in the current process for the alpha.
39
+ # Future versions will load persisted JSONL logs into the index.
40
+ if args.command in {"review", "blame"}:
41
+ print(json.dumps(blackbox.review_incident(args.event_hash), indent=2))
42
+ elif args.command == "tree":
43
+ print(json.dumps(blackbox.get_causality_tree(args.event_hash), indent=2))
44
+ elif args.command == "verify":
45
+ print(json.dumps({"valid": blackbox.verify_event(args.event_hash)}, indent=2))
46
+ else:
47
+ build_parser().print_help()
48
+
49
+
50
+ if __name__ == "__main__":
51
+ main()