jep-agent-sdk 1.0.1__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.
- jep_agent_sdk-1.0.1/.github/workflows/ci.yml +42 -0
- jep_agent_sdk-1.0.1/.github/workflows/release.yml +55 -0
- jep_agent_sdk-1.0.1/.gitignore +37 -0
- jep_agent_sdk-1.0.1/CHANGELOG.md +13 -0
- jep_agent_sdk-1.0.1/CONTRIBUTING.md +29 -0
- jep_agent_sdk-1.0.1/HARDENING.md +24 -0
- jep_agent_sdk-1.0.1/LICENSE +29 -0
- jep_agent_sdk-1.0.1/Makefile +34 -0
- jep_agent_sdk-1.0.1/PKG-INFO +226 -0
- jep_agent_sdk-1.0.1/README.md +183 -0
- jep_agent_sdk-1.0.1/RELEASE-NOTES.md +5 -0
- jep_agent_sdk-1.0.1/VERSION +1 -0
- jep_agent_sdk-1.0.1/docker/Dockerfile +16 -0
- jep_agent_sdk-1.0.1/docker-compose.yml +14 -0
- jep_agent_sdk-1.0.1/docs/API.md +47 -0
- jep_agent_sdk-1.0.1/docs/ARCHITECTURE.md +30 -0
- jep_agent_sdk-1.0.1/examples/01_minimal_skill.py +29 -0
- jep_agent_sdk-1.0.1/examples/02_langchain_agent.py +17 -0
- jep_agent_sdk-1.0.1/examples/03_openai_agents.py +9 -0
- jep_agent_sdk-1.0.1/examples/04_mcp_server.py +31 -0
- jep_agent_sdk-1.0.1/examples/05_jac_cross_agent.py +46 -0
- jep_agent_sdk-1.0.1/examples/06_determinability_gate.py +40 -0
- jep_agent_sdk-1.0.1/jep/__init__.py +50 -0
- jep_agent_sdk-1.0.1/jep/adapters/__init__.py +1 -0
- jep_agent_sdk-1.0.1/jep/adapters/langchain.py +149 -0
- jep_agent_sdk-1.0.1/jep/adapters/mcp.py +42 -0
- jep_agent_sdk-1.0.1/jep/adapters/openai_agents.py +93 -0
- jep_agent_sdk-1.0.1/jep/cli/__init__.py +1 -0
- jep_agent_sdk-1.0.1/jep/cli/main.py +272 -0
- jep_agent_sdk-1.0.1/jep/core/__init__.py +1 -0
- jep_agent_sdk-1.0.1/jep/core/chain.py +85 -0
- jep_agent_sdk-1.0.1/jep/core/event.py +171 -0
- jep_agent_sdk-1.0.1/jep/core/verifier.py +86 -0
- jep_agent_sdk-1.0.1/jep/determinability.py +113 -0
- jep_agent_sdk-1.0.1/jep/extensions/__init__.py +1 -0
- jep_agent_sdk-1.0.1/jep/extensions/jac.py +62 -0
- jep_agent_sdk-1.0.1/jep/primitives.py +63 -0
- jep_agent_sdk-1.0.1/jep/recorder.py +118 -0
- jep_agent_sdk-1.0.1/jep/web/__init__.py +1 -0
- jep_agent_sdk-1.0.1/jep/web/server.py +34 -0
- jep_agent_sdk-1.0.1/jep/web/static/index.html +260 -0
- jep_agent_sdk-1.0.1/pyproject.toml +67 -0
- jep_agent_sdk-1.0.1/tests/__init__.py +1 -0
- jep_agent_sdk-1.0.1/tests/test_adapters.py +31 -0
- jep_agent_sdk-1.0.1/tests/test_chain.py +32 -0
- jep_agent_sdk-1.0.1/tests/test_core.py +41 -0
- jep_agent_sdk-1.0.1/tests/test_crypto.py +31 -0
- jep_agent_sdk-1.0.1/tests/test_determinability.py +47 -0
- jep_agent_sdk-1.0.1/tests/test_hardening.py +76 -0
- jep_agent_sdk-1.0.1/tests/test_legacy_auto.py +29 -0
- jep_agent_sdk-1.0.1/tests/test_verifier.py +55 -0
- jep_agent_sdk-1.0.1/validate.py +33 -0
- jep_agent_sdk-1.0.1/validate.sh +84 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install --upgrade pip
|
|
27
|
+
pip install pytest pytest-cov pytest-asyncio ruff black
|
|
28
|
+
pip install -e ".[langchain,openai]"
|
|
29
|
+
|
|
30
|
+
- name: Lint
|
|
31
|
+
run: |
|
|
32
|
+
ruff check jep/ tests/
|
|
33
|
+
black --check jep/ tests/
|
|
34
|
+
|
|
35
|
+
- name: Test
|
|
36
|
+
run: python -m pytest tests/ -v --cov=jep --cov-report=xml
|
|
37
|
+
|
|
38
|
+
- name: Upload coverage
|
|
39
|
+
uses: codecov/codecov-action@v4
|
|
40
|
+
with:
|
|
41
|
+
files: ./coverage.xml
|
|
42
|
+
fail_ci_if_error: false
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
name: Publish versioned release
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [main]
|
|
5
|
+
paths: [VERSION, '.github/workflows/release.yml']
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
concurrency:
|
|
10
|
+
group: release-${{ github.repository }}
|
|
11
|
+
cancel-in-progress: false
|
|
12
|
+
jobs:
|
|
13
|
+
release:
|
|
14
|
+
if: github.ref == 'refs/heads/main'
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
permissions:
|
|
17
|
+
contents: write
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
- uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: '3.12'
|
|
23
|
+
- run: pip install build twine pytest pytest-asyncio httpx -e .
|
|
24
|
+
- run: python -m pytest tests -q
|
|
25
|
+
- run: python -m build && twine check dist/*
|
|
26
|
+
- name: Validate release version
|
|
27
|
+
run: |
|
|
28
|
+
python -c "import pathlib,re; v=pathlib.Path('VERSION').read_text().strip(); assert re.fullmatch(r'[0-9]+\.[0-9]+\.[0-9]+(?:a[0-9]+)?',v)"
|
|
29
|
+
- uses: actions/upload-artifact@v4
|
|
30
|
+
with:
|
|
31
|
+
name: distributions
|
|
32
|
+
path: dist/
|
|
33
|
+
- name: Publish versioned GitHub release
|
|
34
|
+
env:
|
|
35
|
+
GH_TOKEN: ${{ github.token }}
|
|
36
|
+
run: |
|
|
37
|
+
version=$(cat VERSION)
|
|
38
|
+
if gh release view "v$version" >/dev/null 2>&1; then
|
|
39
|
+
echo 'This version already has a release; refusing to overwrite it.'
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
gh release create "v$version" --target "$GITHUB_SHA" --title "v$version" --notes-file RELEASE-NOTES.md dist/*
|
|
43
|
+
pypi:
|
|
44
|
+
needs: release
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
permissions:
|
|
47
|
+
id-token: write
|
|
48
|
+
steps:
|
|
49
|
+
- uses: actions/download-artifact@v4
|
|
50
|
+
with:
|
|
51
|
+
name: distributions
|
|
52
|
+
path: downloaded/
|
|
53
|
+
- run: mkdir dist && cp downloaded/*.whl downloaded/*.tar.gz dist/
|
|
54
|
+
- name: Publish to PyPI using the configured trusted publisher
|
|
55
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*$py.class
|
|
4
|
+
*.so
|
|
5
|
+
.Python
|
|
6
|
+
build/
|
|
7
|
+
develop-eggs/
|
|
8
|
+
dist/
|
|
9
|
+
downloads/
|
|
10
|
+
eggs/
|
|
11
|
+
.eggs/
|
|
12
|
+
lib/
|
|
13
|
+
lib64/
|
|
14
|
+
parts/
|
|
15
|
+
sdist/
|
|
16
|
+
var/
|
|
17
|
+
wheels/
|
|
18
|
+
*.egg-info/
|
|
19
|
+
.installed.cfg
|
|
20
|
+
*.egg
|
|
21
|
+
.env
|
|
22
|
+
.venv
|
|
23
|
+
env/
|
|
24
|
+
venv/
|
|
25
|
+
.idea/
|
|
26
|
+
.vscode/
|
|
27
|
+
*.pem
|
|
28
|
+
*.key
|
|
29
|
+
*.jsonl
|
|
30
|
+
*.db
|
|
31
|
+
jep_chain_local.jsonl
|
|
32
|
+
mcp_jep_chain.jsonl
|
|
33
|
+
.pytest_cache/
|
|
34
|
+
.coverage
|
|
35
|
+
htmlcov/
|
|
36
|
+
poetry.lock
|
|
37
|
+
coverage.xml
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0 (2026-04-26)
|
|
4
|
+
|
|
5
|
+
- Initial release
|
|
6
|
+
- Full JEP-04 compliance (RFC 8785 JCS, JWS EdDSA, anti-replay)
|
|
7
|
+
- JAC-01 extension support (`task_based_on`, fault recording)
|
|
8
|
+
- TRUE zero-code adapters: LangChain (`import .auto`), OpenAI (`import .auto`), MCP
|
|
9
|
+
- DeterminabilityGuard runtime gate for causal sufficiency checks
|
|
10
|
+
- Causal topology web viewer (SVG force-directed graph)
|
|
11
|
+
- Compliance export (`jep export`) with embedded causal graph
|
|
12
|
+
- CLI tools: `jep web`, `jep verify`, `jep export`
|
|
13
|
+
- Docker & docker-compose support
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Contributing to JEP-Agent SDK
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
git clone https://github.com/hjs-spec/jep-agent-sdk.git
|
|
7
|
+
cd jep-agent-sdk
|
|
8
|
+
make install
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Testing
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
make test
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Code Style
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
make format
|
|
21
|
+
make lint
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Pull Request Process
|
|
25
|
+
|
|
26
|
+
1. Ensure tests pass (`make test`)
|
|
27
|
+
2. Update examples if API changes
|
|
28
|
+
3. Update `CHANGELOG.md`
|
|
29
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Implementation hardening — September 2026
|
|
2
|
+
|
|
3
|
+
Do not report unverified or unfinished agent executions as valid.
|
|
4
|
+
|
|
5
|
+
## Changes
|
|
6
|
+
|
|
7
|
+
Signature verification binds the embedded signed payload to the current event. Chains verify every event, including the first, with a trusted public key. Exported events are copied. Missing keys return UNVERIFIED and unsigned chains do not pass integrity verification. Nonces are consumed after signature and policy checks. Async wrappers await completion and record errors/cancellation as termination. LangChain callback IDs no longer refer to a nonexistent field. The UI renders event fields as text. validate.py now exercises the actual signed API.
|
|
8
|
+
|
|
9
|
+
## Validation
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
python -m pytest -q
|
|
13
|
+
python validate.py
|
|
14
|
+
ruff check jep/ tests/
|
|
15
|
+
black --check jep/ tests/
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Compatibility and remaining limits
|
|
19
|
+
|
|
20
|
+
Legacy-04 embedded EdDSA signatures and legacy unsigned-event link hashes remain unchanged. This SDK is not the v0.6 wire SDK. verify_chain(public_key=...) is required for imported signed archives; unsigned traces remain available for recording. The jep import/console namespace still overlaps other packages; install in a separate environment. OpenAI monkey patching remains a legacy Completions integration; use the dedicated middleware for current Agents SDK integration.
|
|
21
|
+
|
|
22
|
+
## Follow-up hardening
|
|
23
|
+
|
|
24
|
+
The legacy synchronous Chat Completions patch is idempotent and retains events in the public trace manager instead of discarding each call chain. Quickstart now uses explicit @record instrumentation and a signing key. Documentation distinguishes this historical adapter from the current Agents SDK middleware and removes unsupported production/standardization claims.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Yuqiang Wang (HJS Foundation Ltd.)
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.PHONY: install test lint format clean build publish web docker compose
|
|
2
|
+
|
|
3
|
+
install:
|
|
4
|
+
pip install -e ".[dev,langchain,openai]"
|
|
5
|
+
|
|
6
|
+
test:
|
|
7
|
+
pytest tests/ -v --tb=short
|
|
8
|
+
|
|
9
|
+
lint:
|
|
10
|
+
ruff check jep/ tests/
|
|
11
|
+
black --check jep/ tests/
|
|
12
|
+
|
|
13
|
+
format:
|
|
14
|
+
black jep/ tests/
|
|
15
|
+
ruff check --fix jep/ tests/
|
|
16
|
+
|
|
17
|
+
clean:
|
|
18
|
+
rm -rf build/ dist/ *.egg-info .pytest_cache htmlcov/
|
|
19
|
+
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
|
|
20
|
+
|
|
21
|
+
build:
|
|
22
|
+
python -m build
|
|
23
|
+
|
|
24
|
+
publish:
|
|
25
|
+
python -m twine upload dist/*
|
|
26
|
+
|
|
27
|
+
web:
|
|
28
|
+
jep web --port 8080 --reload
|
|
29
|
+
|
|
30
|
+
docker:
|
|
31
|
+
docker build -t jep-agent-sdk:latest -f docker/Dockerfile .
|
|
32
|
+
|
|
33
|
+
compose:
|
|
34
|
+
docker-compose up --build
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: jep-agent-sdk
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: JEP-Agent SDK 1.0 — Legacy reference implementation of JEP-04 and JAC-01
|
|
5
|
+
Project-URL: Homepage, https://github.com/hjs-spec/jep-agent-sdk
|
|
6
|
+
Project-URL: Documentation, https://datatracker.ietf.org/doc/draft-wang-jep-judgment-event-protocol-04/
|
|
7
|
+
Project-URL: Repository, https://github.com/hjs-spec/jep-agent-sdk
|
|
8
|
+
Project-URL: Issues, https://github.com/hjs-spec/jep-agent-sdk/issues
|
|
9
|
+
Author-email: Yuqiang Wang <signal@humanjudgment.org>
|
|
10
|
+
License-Expression: BSD-3-Clause
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: accountability,agent,ai-governance,audit,jac,jep,langchain
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Classifier: Topic :: Security :: Cryptography
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: click>=8.0.0
|
|
24
|
+
Requires-Dist: cryptography>=41.0.0
|
|
25
|
+
Requires-Dist: fastapi>=0.100.0
|
|
26
|
+
Requires-Dist: jcs>=0.2.0
|
|
27
|
+
Requires-Dist: python-multipart>=0.0.18
|
|
28
|
+
Requires-Dist: rich>=13.0.0
|
|
29
|
+
Requires-Dist: uvicorn>=0.23.0
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: black>=24.0.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: httpx>=0.24.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: pytest-cov>=6.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: ruff>=0.3.0; extra == 'dev'
|
|
37
|
+
Provides-Extra: langchain
|
|
38
|
+
Requires-Dist: langchain-core>=0.3.0; extra == 'langchain'
|
|
39
|
+
Requires-Dist: langchain>=0.3.0; extra == 'langchain'
|
|
40
|
+
Provides-Extra: openai
|
|
41
|
+
Requires-Dist: openai>=1.0.0; extra == 'openai'
|
|
42
|
+
Description-Content-Type: text/markdown
|
|
43
|
+
|
|
44
|
+
> Historical repository.
|
|
45
|
+
>
|
|
46
|
+
> This repository reflects an earlier design line and is no longer the current implementation track.
|
|
47
|
+
>
|
|
48
|
+
> Current versions:
|
|
49
|
+
>
|
|
50
|
+
> - JEP v0.6: https://github.com/hjs-spec/jep-v06
|
|
51
|
+
> - JEP API v0.6: https://github.com/hjs-spec/jep-api
|
|
52
|
+
> - HJS v0.5: https://github.com/hjs-spec/hjs-05
|
|
53
|
+
> - JAC v0.5: https://github.com/hjs-spec/jac-agent-02
|
|
54
|
+
|
|
55
|
+
# JEP-Agent SDK 1.0
|
|
56
|
+
|
|
57
|
+
[](https://datatracker.ietf.org/doc/draft-wang-jep-judgment-event-protocol-04/)
|
|
58
|
+
[](https://datatracker.ietf.org/doc/draft-wang-jac-01/)
|
|
59
|
+
[](https://pypi.org/project/jep-agent-sdk/)
|
|
60
|
+
[](LICENSE)
|
|
61
|
+
[](https://www.python.org/)
|
|
62
|
+
|
|
63
|
+
**Historical tracing SDK with explicit instrumentation and local verification.**
|
|
64
|
+
|
|
65
|
+
JEP-Agent SDK is an experimental implementation of the [Judgment Event Protocol (JEP-04)](https://datatracker.ietf.org/doc/draft-wang-jep-judgment-event-protocol-04/) and [JAC-01](https://datatracker.ietf.org/doc/draft-wang-jac-01/). It records instrumented calls using the historical event format. A configured signing key and independently trusted verification key are required for signature assurance.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Install
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pip install jep-agent-sdk
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
With framework adapters:
|
|
76
|
+
```bash
|
|
77
|
+
pip install jep-agent-sdk[langchain,openai]
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
> For current MCP and OpenAI Agents integrations, use `jep-mcp-wrapper` and `jep-openai-agents-middleware`. This repository retains legacy adapters.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 30-Second Quickstart
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
from jep import trace
|
|
88
|
+
from jep.recorder import record
|
|
89
|
+
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
|
|
90
|
+
|
|
91
|
+
trace.enable(issuer="did:example:agent-001", private_key=Ed25519PrivateKey.generate())
|
|
92
|
+
|
|
93
|
+
@record(issuer="did:example:agent-001", chain=trace.chain)
|
|
94
|
+
def my_agent(query: str) -> str:
|
|
95
|
+
return f"Result for {query}"
|
|
96
|
+
|
|
97
|
+
my_agent("hello")
|
|
98
|
+
trace.view() # See the J/D/T/V event chain in your terminal
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Legacy framework adapters
|
|
104
|
+
|
|
105
|
+
| Framework | Integration | Your Code Changes |
|
|
106
|
+
|-----------|-------------|-------------------|
|
|
107
|
+
| **LangChain** | `import jep.adapters.langchain.auto` | Experimental patch |
|
|
108
|
+
| **OpenAI Chat Completions (legacy)** | `import jep.adapters.openai_agents.auto` | Experimental patch |
|
|
109
|
+
| **MCP** | `from jep.adapters.mcp import JEPMCPServer` | **One line** |
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Causal Web Viewer
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
jep web --port 8080
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Drag-and-drop your `events.jsonl`. Get an interactive force-directed causal graph. Click any node to inspect the full JEP event. Pan, zoom, export.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Determinability Guard — Stop Agents from Guessing
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
from jep.determinability import DeterminabilityGuard
|
|
127
|
+
|
|
128
|
+
guard = DeterminabilityGuard(
|
|
129
|
+
evidence_fn=lambda ctx: len(ctx.get("tools_used", [])),
|
|
130
|
+
target_fn=lambda ctx: ctx.get("outcome"),
|
|
131
|
+
knowledge_base=[{"tools_used": ["search", "calc"], "outcome": 1},
|
|
132
|
+
{"tools_used": ["search"], "outcome": 0}],
|
|
133
|
+
on_insufficient="raise",
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
@guard.require_determinable
|
|
137
|
+
def my_agent(query: str, tools_used: list) -> str:
|
|
138
|
+
...
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**What it does:** If your agent hasn't gathered enough evidence to make a deterministic decision, the guard blocks execution and tells you exactly what's missing. This is an application-defined gate; it does not guarantee factual accuracy.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## CLI Tools
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# Verify signatures, chains, and anti-replay
|
|
149
|
+
jep verify events.jsonl --public-key key.pem
|
|
150
|
+
|
|
151
|
+
# Export a full compliance report (HTML with embedded causal graph)
|
|
152
|
+
jep export events.jsonl --output report.html
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## What is JEP?
|
|
158
|
+
|
|
159
|
+
JEP (Judgment Event Protocol) is a minimal log format proposed in an individual IETF Internet-Draft for AI agent decisions. It defines four immutable verbs:
|
|
160
|
+
|
|
161
|
+
| Verb | Meaning | RFC 2119 |
|
|
162
|
+
|------|---------|----------|
|
|
163
|
+
| **J** | Judge — Initiate a decision | MUST |
|
|
164
|
+
| **D** | Delegate — Transfer authority | MUST |
|
|
165
|
+
| **T** | Terminate — Close lifecycle | MUST |
|
|
166
|
+
| **V** | Verify — Validate an event | MUST |
|
|
167
|
+
|
|
168
|
+
Signing is optional at recording time. Unsigned events are unverified. This historical format uses its own embedded JWS payload and hash links; use `jep-v06` for the current detached JWS/JCS conformance baseline.
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Project Structure
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
jep/
|
|
176
|
+
├── core/ # JEP-04 protocol engine (event, crypto, verifier, chain)
|
|
177
|
+
├── primitives.py # J/D/T/V convenience wrappers
|
|
178
|
+
├── recorder.py # @record decorator + global trace manager
|
|
179
|
+
├── determinability.py # Causal sufficiency gate (DeterminabilityGuard)
|
|
180
|
+
├── extensions/
|
|
181
|
+
│ └── jac.py # JAC-01 cross-agent accountability
|
|
182
|
+
├── adapters/
|
|
183
|
+
│ ├── langchain.py # TRUE zero-code auto-patch
|
|
184
|
+
│ ├── openai_agents.py # TRUE zero-code auto-patch
|
|
185
|
+
│ └── mcp.py # MCP server wrapper
|
|
186
|
+
├── cli/
|
|
187
|
+
│ └── main.py # jep web | jep verify | jep export
|
|
188
|
+
└── web/
|
|
189
|
+
└── static/
|
|
190
|
+
└── index.html # Drag-and-drop causal topology viewer
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Documentation
|
|
196
|
+
|
|
197
|
+
- [Architecture & Design Principles](docs/ARCHITECTURE.md)
|
|
198
|
+
- [API Reference](docs/API.md)
|
|
199
|
+
- [JEP-04 Internet-Draft](https://datatracker.ietf.org/doc/draft-wang-jep-judgment-event-protocol-04/)
|
|
200
|
+
- [JAC-01 Internet-Draft](https://datatracker.ietf.org/doc/draft-wang-jac-01/)
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Contributing
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
git clone https://github.com/hjs-spec/jep-agent-sdk.git
|
|
208
|
+
cd jep-agent-sdk
|
|
209
|
+
make install
|
|
210
|
+
make test
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Author
|
|
218
|
+
|
|
219
|
+
**Yuqiang Wang**
|
|
220
|
+
HJS Foundation Ltd.
|
|
221
|
+
Email: signal@humanjudgment.org
|
|
222
|
+
GitHub: [@hjs-spec](https://github.com/hjs-spec)
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
*JEP-Agent SDK is released under BSD-3-Clause. The protocol draft is an individual IETF Internet-Draft and does not represent IETF endorsement.*
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
> Historical repository.
|
|
2
|
+
>
|
|
3
|
+
> This repository reflects an earlier design line and is no longer the current implementation track.
|
|
4
|
+
>
|
|
5
|
+
> Current versions:
|
|
6
|
+
>
|
|
7
|
+
> - JEP v0.6: https://github.com/hjs-spec/jep-v06
|
|
8
|
+
> - JEP API v0.6: https://github.com/hjs-spec/jep-api
|
|
9
|
+
> - HJS v0.5: https://github.com/hjs-spec/hjs-05
|
|
10
|
+
> - JAC v0.5: https://github.com/hjs-spec/jac-agent-02
|
|
11
|
+
|
|
12
|
+
# JEP-Agent SDK 1.0
|
|
13
|
+
|
|
14
|
+
[](https://datatracker.ietf.org/doc/draft-wang-jep-judgment-event-protocol-04/)
|
|
15
|
+
[](https://datatracker.ietf.org/doc/draft-wang-jac-01/)
|
|
16
|
+
[](https://pypi.org/project/jep-agent-sdk/)
|
|
17
|
+
[](LICENSE)
|
|
18
|
+
[](https://www.python.org/)
|
|
19
|
+
|
|
20
|
+
**Historical tracing SDK with explicit instrumentation and local verification.**
|
|
21
|
+
|
|
22
|
+
JEP-Agent SDK is an experimental implementation of the [Judgment Event Protocol (JEP-04)](https://datatracker.ietf.org/doc/draft-wang-jep-judgment-event-protocol-04/) and [JAC-01](https://datatracker.ietf.org/doc/draft-wang-jac-01/). It records instrumented calls using the historical event format. A configured signing key and independently trusted verification key are required for signature assurance.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install jep-agent-sdk
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
With framework adapters:
|
|
33
|
+
```bash
|
|
34
|
+
pip install jep-agent-sdk[langchain,openai]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
> For current MCP and OpenAI Agents integrations, use `jep-mcp-wrapper` and `jep-openai-agents-middleware`. This repository retains legacy adapters.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 30-Second Quickstart
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from jep import trace
|
|
45
|
+
from jep.recorder import record
|
|
46
|
+
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
|
|
47
|
+
|
|
48
|
+
trace.enable(issuer="did:example:agent-001", private_key=Ed25519PrivateKey.generate())
|
|
49
|
+
|
|
50
|
+
@record(issuer="did:example:agent-001", chain=trace.chain)
|
|
51
|
+
def my_agent(query: str) -> str:
|
|
52
|
+
return f"Result for {query}"
|
|
53
|
+
|
|
54
|
+
my_agent("hello")
|
|
55
|
+
trace.view() # See the J/D/T/V event chain in your terminal
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Legacy framework adapters
|
|
61
|
+
|
|
62
|
+
| Framework | Integration | Your Code Changes |
|
|
63
|
+
|-----------|-------------|-------------------|
|
|
64
|
+
| **LangChain** | `import jep.adapters.langchain.auto` | Experimental patch |
|
|
65
|
+
| **OpenAI Chat Completions (legacy)** | `import jep.adapters.openai_agents.auto` | Experimental patch |
|
|
66
|
+
| **MCP** | `from jep.adapters.mcp import JEPMCPServer` | **One line** |
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Causal Web Viewer
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
jep web --port 8080
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Drag-and-drop your `events.jsonl`. Get an interactive force-directed causal graph. Click any node to inspect the full JEP event. Pan, zoom, export.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Determinability Guard — Stop Agents from Guessing
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
from jep.determinability import DeterminabilityGuard
|
|
84
|
+
|
|
85
|
+
guard = DeterminabilityGuard(
|
|
86
|
+
evidence_fn=lambda ctx: len(ctx.get("tools_used", [])),
|
|
87
|
+
target_fn=lambda ctx: ctx.get("outcome"),
|
|
88
|
+
knowledge_base=[{"tools_used": ["search", "calc"], "outcome": 1},
|
|
89
|
+
{"tools_used": ["search"], "outcome": 0}],
|
|
90
|
+
on_insufficient="raise",
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
@guard.require_determinable
|
|
94
|
+
def my_agent(query: str, tools_used: list) -> str:
|
|
95
|
+
...
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**What it does:** If your agent hasn't gathered enough evidence to make a deterministic decision, the guard blocks execution and tells you exactly what's missing. This is an application-defined gate; it does not guarantee factual accuracy.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## CLI Tools
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Verify signatures, chains, and anti-replay
|
|
106
|
+
jep verify events.jsonl --public-key key.pem
|
|
107
|
+
|
|
108
|
+
# Export a full compliance report (HTML with embedded causal graph)
|
|
109
|
+
jep export events.jsonl --output report.html
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## What is JEP?
|
|
115
|
+
|
|
116
|
+
JEP (Judgment Event Protocol) is a minimal log format proposed in an individual IETF Internet-Draft for AI agent decisions. It defines four immutable verbs:
|
|
117
|
+
|
|
118
|
+
| Verb | Meaning | RFC 2119 |
|
|
119
|
+
|------|---------|----------|
|
|
120
|
+
| **J** | Judge — Initiate a decision | MUST |
|
|
121
|
+
| **D** | Delegate — Transfer authority | MUST |
|
|
122
|
+
| **T** | Terminate — Close lifecycle | MUST |
|
|
123
|
+
| **V** | Verify — Validate an event | MUST |
|
|
124
|
+
|
|
125
|
+
Signing is optional at recording time. Unsigned events are unverified. This historical format uses its own embedded JWS payload and hash links; use `jep-v06` for the current detached JWS/JCS conformance baseline.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Project Structure
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
jep/
|
|
133
|
+
├── core/ # JEP-04 protocol engine (event, crypto, verifier, chain)
|
|
134
|
+
├── primitives.py # J/D/T/V convenience wrappers
|
|
135
|
+
├── recorder.py # @record decorator + global trace manager
|
|
136
|
+
├── determinability.py # Causal sufficiency gate (DeterminabilityGuard)
|
|
137
|
+
├── extensions/
|
|
138
|
+
│ └── jac.py # JAC-01 cross-agent accountability
|
|
139
|
+
├── adapters/
|
|
140
|
+
│ ├── langchain.py # TRUE zero-code auto-patch
|
|
141
|
+
│ ├── openai_agents.py # TRUE zero-code auto-patch
|
|
142
|
+
│ └── mcp.py # MCP server wrapper
|
|
143
|
+
├── cli/
|
|
144
|
+
│ └── main.py # jep web | jep verify | jep export
|
|
145
|
+
└── web/
|
|
146
|
+
└── static/
|
|
147
|
+
└── index.html # Drag-and-drop causal topology viewer
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Documentation
|
|
153
|
+
|
|
154
|
+
- [Architecture & Design Principles](docs/ARCHITECTURE.md)
|
|
155
|
+
- [API Reference](docs/API.md)
|
|
156
|
+
- [JEP-04 Internet-Draft](https://datatracker.ietf.org/doc/draft-wang-jep-judgment-event-protocol-04/)
|
|
157
|
+
- [JAC-01 Internet-Draft](https://datatracker.ietf.org/doc/draft-wang-jac-01/)
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Contributing
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
git clone https://github.com/hjs-spec/jep-agent-sdk.git
|
|
165
|
+
cd jep-agent-sdk
|
|
166
|
+
make install
|
|
167
|
+
make test
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Author
|
|
175
|
+
|
|
176
|
+
**Yuqiang Wang**
|
|
177
|
+
HJS Foundation Ltd.
|
|
178
|
+
Email: signal@humanjudgment.org
|
|
179
|
+
GitHub: [@hjs-spec](https://github.com/hjs-spec)
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
*JEP-Agent SDK is released under BSD-3-Clause. The protocol draft is an individual IETF Internet-Draft and does not represent IETF endorsement.*
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Release 1.0.1
|
|
2
|
+
|
|
3
|
+
Includes the reviewed September 2026 integrity, replay, persistence, async-lifecycle and compatibility repairs applicable to this repository. Wire/profile versions are unchanged unless explicitly described in the repository hardening notes.
|
|
4
|
+
|
|
5
|
+
See HARDENING.md for supported verification scopes and migration boundaries. Registry publication and service deployment are reported by their workflows; a source merge alone is not a published package.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.0.1
|