Skip to main content

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 before 1.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 json only — no eval, no pickle, no dynamic imports, and no hooks that construct arbitrary Python objects.
  • Input is bounded. Trace.load refuses files over 8 MiB by default (max_bytes is 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

License

Apache-2.0. Copyright 2026 Christopher Eckman.

Metadata

Release files for openagentfence 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openagentfence 0.0.1
File Size Uploaded Provenance
openagentfence-0.0.1.tar.gz 18.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for openagentfence 0.0.1
File Interpreter ABI Platform
openagentfence-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 32.7 kB

Release files / openagentfence-0.0.1.tar.gz

Download URL openagentfence-0.0.1.tar.gz
Size 18.3 kB
Tags Source
SHA-256 checksum
How to use checksums
14f13848026bd6928c676a1dcd24274752f8aafa01d81a419a46c5ed0e12ef5b
BLAKE2b-256 checksum
How to use checksums
45c46d251fdddc347a68ed200c4641040556efa0bddd71617d670b9ac87d464b
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 Aug 15, 2026.

Transparency log

Release files / openagentfence-0.0.1-py3-none-any.whl

Download URL openagentfence-0.0.1-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7cdd6cfaf18cb0cb6dd29a22d76d623b5886167e4d22131e3b7a18262286f2b7
BLAKE2b-256 checksum
How to use checksums
12fadb28daef5144b350472e335eb21c95b2bde339fd041ab3c8aae68ff20cb3
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 Aug 15, 2026.

Transparency log

Security for openagentfence 0.0.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.

Select from 2 files

Attestation for openagentfence-0.0.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 Aug 15, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page