jep-openai-agents-middleware
JEP middleware for the OpenAI Agents SDK: portable and replayable AI judgment verification.
This package adds portable accountability semantics to OpenAI agent execution without forking the OpenAI Agents SDK and without changing SDK core semantics. It observes lifecycle hooks and wraps local tool callables to write deterministic, append-only JEP events.
What is recorded
The middleware automatically generates:
- Judgment events for agent starts, LLM calls, tool starts/ends/errors, approval-required execution, and other local execution decisions.
- Delegation events for handoffs and explicit sub-agent delegation.
- Termination events when an agent produces final output.
Each event can include:
- Agent lineage.
- Tool execution metadata.
- Authority scope.
- Execution replay chain metadata.
- Deterministic payload hashes instead of raw sensitive arguments/results.
Core APIs
JEPMiddleware— high-level facade for archive, hook, agent instrumentation, explicit delegation, and replay verification.AgentExecutionHook— run-wide OpenAI Agents SDK lifecycle hook compatible withRunner.run(..., hooks=...).ToolInvocationWrapper— sync/async callable wrapper for local tool execution events.DelegationTracker— tracks lineage and handoff/sub-agent edges.VerificationRuntime— appends events and verifies deterministic replay hash chains.
Basic usage with OpenAI Agents SDK
from agents import Agent, Runner, handoff
from jep_openai_agents_middleware import JEPMiddleware
middleware = JEPMiddleware("jep-archive.jsonl")
billing_agent = Agent(name="Billing agent")
refund_agent = Agent(name="Refund agent")
triage_agent = Agent(
name="Triage agent",
handoffs=[handoff(billing_agent), handoff(refund_agent)],
)
result = await Runner.run(
triage_agent,
"I was charged twice and need a refund.",
hooks=middleware.hooks(),
)
assert middleware.verify_replay().valid
Wrapping local tools
from jep_openai_agents_middleware import JEPMiddleware
middleware = JEPMiddleware("jep-tools.jsonl")
def lookup_order(order_id: str) -> str:
return "shipped"
lookup_order = middleware.wrap_tool(lookup_order, authority_scope="orders:read")
lookup_order("order_123")
Examples
examples/agent_handoff.py— OpenAI Agents SDK handoff accountability.examples/multi_agent_collaboration.py— explicit multi-agent delegation tracking.examples/approval_required_execution.py— approval-required tool execution recording.
Verification model
Events are stored as JSON Lines. The archive is append-only: new events receive a monotonically increasing sequence number and the previous event hash. Hashes are SHA-256 over canonical JSON, so replay verification can detect tampering, missing events, or reordered events.
Runtime and verification notes
See HARDENING.md for supported behavior, regression checks, and compatibility boundaries.
Metadata
Release files for jep-openai-agents-middleware 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| jep_openai_agents_middleware-0.1.1.tar.gz | 12.3 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jep_openai_agents_middleware-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.1 kB
Release files / jep_openai_agents_middleware-0.1.1.tar.gz
| Download URL | jep_openai_agents_middleware-0.1.1.tar.gz |
|---|---|
| Size | 12.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e1cb9fd9546ad2befa4c41ff5bf3f0a440f2eea31e5d13c923fadb279ba6ed2
|
|
BLAKE2b-256 checksum How to use checksums |
106a0aa23bcb8c3b337ddf07e22179d255d7be44d790e9a15fc85c24d0b32d71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.
Transparency logRelease files / jep_openai_agents_middleware-0.1.1-py3-none-any.whl
| Download URL | jep_openai_agents_middleware-0.1.1-py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e28226bf60c8b1f140da516490ea5e4da34885743aae6f1b6d8acb7dc8e0bf61
|
|
BLAKE2b-256 checksum How to use checksums |
564736ec2fb3ef7fc1026e2a5661b22627de770b698d917947262fa79c4585f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.
Transparency logSecurity for jep-openai-agents-middleware 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for jep_openai_agents_middleware-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.