openagentfence (Python)
Python interoperability utilities for OpenAgentFence.
Early development. OpenAgentFence is pre-release and this package is version
0.0.1. The API is experimental and may change without notice before1.0. Do not treat it as production-ready.
What this package is — and is not
OpenAgentFence is security middleware for AI browser agents. Its primary implementation is TypeScript/Node.js, and that is where the security runtime lives: the scanners, the policy engine, the action guard, secret handling, and the framework adapters.
This Python distribution is not a Python port of that runtime. It does not detect prompt injection, evaluate policy, mediate browser actions, or resolve secrets. It is a small, dependency-free reader for the artifacts the TypeScript runtime produces, so Python tooling — notebooks, CI checks, analysis scripts — can work with them without shelling out to Node.
Version 0.0.1 covers one artifact: the JSON security trace.
Install
pip install openagentfence
Requires Python 3.10 or newer. It has no runtime dependencies.
Load a trace
from openagentfence import Trace
trace = Trace.load("trace.json")
print(trace.session_id) # 'sess-01HZY' or None
print(trace.trace_version) # '0.1.0' or None
print(trace.finding_count) # 3
print(trace.decision_count) # 5
for finding in trace.findings:
print(finding)
The reader is deliberately tolerant. The trace schema is still being settled in the TypeScript core, so this package requires only that the document root is a JSON object and preserves every field it does not recognise:
trace.raw["someFieldAddedNextRelease"] # unknown fields survive intact
findings and decisions come from top-level arrays when present, and are
otherwise derived from event records whose kind names a finding or a decision.
Redaction
Accessors return redacted data by default. Any value stored under an
obviously secret-bearing key — password, secret, token, api_key,
authorization, cookie, private_key, credential, and similar — is
replaced with [redacted], however deeply nested:
trace.findings # redacted
trace.decisions # redacted
trace.redacted() # redacted copy of the whole document
trace.get("headers") # redacted
trace.raw # the unmodified document, when you explicitly need it
trace.raw_findings # unredacted
Matching is conservative and key-based: it prefers to mask a harmless field over leaking a sensitive one.
OpenAgentFence traces should not contain raw secrets in the first place — the
runtime writes opaque handles such as <SECRET:demo_login:ab12cd>. This package
passes handles through untouched and never attempts to resolve one;
resolution is an executor-side concern of the TypeScript runtime.
Command line
python -m openagentfence trace.json
OpenAgentFence trace
Session: sess-01HZY
Findings: 3
Decisions: 5
The CLI prints only this sanitized summary; it never dumps the trace document.
python -m openagentfence --version
python -m openagentfence --max-bytes 1048576 trace.json
Handling untrusted traces
A security trace can describe hostile web content, so it is treated as untrusted input:
- Parsing is
jsononly — noeval, no pickle, no dynamic imports, and no hooks that construct arbitrary Python objects. - Input is bounded.
Trace.loadrefuses files over 8 MiB by default (max_bytesis configurable), and redaction is depth-limited. - Duplicate object keys and non-standard JSON constants (
NaN,Infinity) are rejected rather than silently resolved. - No network access and no URL resolution ever happen while loading a trace.
- Parse errors do not carry the document, and the session identifier is sanitized before display so trace content cannot forge terminal output.
Project
- Repository: https://github.com/chriseckman/openagentfence
- Security policy: https://github.com/chriseckman/openagentfence/security/policy
License
Apache-2.0. Copyright 2026 Christopher Eckman.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openagentfence-0.0.1.tar.gz.
File metadata
- Download URL: openagentfence-0.0.1.tar.gz
- Upload date:
- Size: 18.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14f13848026bd6928c676a1dcd24274752f8aafa01d81a419a46c5ed0e12ef5b
|
|
| MD5 |
e516f6d419d4df3cb656accdff35953a
|
|
| BLAKE2b-256 |
45c46d251fdddc347a68ed200c4641040556efa0bddd71617d670b9ac87d464b
|
Provenance
The following attestation bundles were made for openagentfence-0.0.1.tar.gz:
Publisher:
publish-pypi.yml on chriseckman/openagentfence
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openagentfence-0.0.1.tar.gz -
Subject digest:
14f13848026bd6928c676a1dcd24274752f8aafa01d81a419a46c5ed0e12ef5b - Sigstore transparency entry: 2479558684
- Sigstore integration time:
-
Permalink:
chriseckman/openagentfence@1ade95dba15070a92590f3fdb9fd96cec06092d0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/chriseckman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@1ade95dba15070a92590f3fdb9fd96cec06092d0 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file openagentfence-0.0.1-py3-none-any.whl.
File metadata
- Download URL: openagentfence-0.0.1-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cdd6cfaf18cb0cb6dd29a22d76d623b5886167e4d22131e3b7a18262286f2b7
|
|
| MD5 |
d3dfabb6559b37753cc88c1b573b1eea
|
|
| BLAKE2b-256 |
12fadb28daef5144b350472e335eb21c95b2bde339fd041ab3c8aae68ff20cb3
|
Provenance
The following attestation bundles were made for openagentfence-0.0.1-py3-none-any.whl:
Publisher:
publish-pypi.yml on chriseckman/openagentfence
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openagentfence-0.0.1-py3-none-any.whl -
Subject digest:
7cdd6cfaf18cb0cb6dd29a22d76d623b5886167e4d22131e3b7a18262286f2b7 - Sigstore transparency entry: 2479558732
- Sigstore integration time:
-
Permalink:
chriseckman/openagentfence@1ade95dba15070a92590f3fdb9fd96cec06092d0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/chriseckman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@1ade95dba15070a92590f3fdb9fd96cec06092d0 -
Trigger Event:
workflow_dispatch
-
Statement type: