Skip to main content

agent-redact (Python)

Python bindings for agent-redact. This is a thin, dependency-free wrapper around the Node.js CLI, so Python agents get exactly the same detection engine as the npm package.

pip install agent-redact

Node.js 22.18+ is still required. This package contains only the Python wrapper; the detection engine is the Node.js CLI (see below for how it is found).

Requirements:

  • Python 3.10+
  • Node.js 22.18+
  • the CLI, from one of these (checked in order):
    1. AGENT_REDACT_CLI set to the absolute path of dist/cli/index.js;
    2. a global npm install -g agent-redact;
    3. npm next to node: the matching version is installed once into a private user cache (--ignore-scripts) and reused.

The CLI is always started as node <absolute path>. It is never run through .cmd/.bat shims, through npx, or from a binary found in the current directory, so scanning an untrusted repository cannot hijack it.

from agent_redact import redact, scan, Session

# One-way redaction
result = redact("deploy with AKIA...")       # result.text, result.matches (no secret values)
redact(text, presets=["vn-pii"])             # opt-in presets

# Reversible masking across a whole conversation
with Session() as s:
    safe_prompt = s.redact(user_prompt)      # [AWS_ACCESS_KEY_ID_1] …
    answer = llm(safe_prompt)
    print(s.unmask(answer))                  # placeholders restored locally

# Repository / staged-changes audit
findings = scan(["."])                       # honours .gitignore in git repos
findings = scan(staged=True)                 # what is about to be committed

Session keeps its vault in a private temporary directory, encrypted with a random per-session passphrase that is never written to disk, and deletes it on close() or when the with block ends.

Metadata

Release files for agent-redact 0.3.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 agent-redact 0.3.1
File Size Uploaded Provenance Actions
agent_redact-0.3.1.tar.gz 8.0 kB With provenance Details for agent_redact-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agent-redact 0.3.1
File Interpreter ABI Platform Actions
agent_redact-0.3.1-py3-none-any.whl Python 3 none any Details for agent_redact-0.3.1-py3-none-any.whl

Total release size: 15.5 kB

Release files / agent_redact-0.3.1.tar.gz

Download URL agent_redact-0.3.1.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
daaf3a3a33b00544dbdd203772ca6ce6bc4c1b9d9fb9c8e0729b807f348e55c0
BLAKE2b-256 checksum
How to use checksums
84c2271629a17a3361ff35d87ec143ac72ad0dc2246a138c913e875cb7603b33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 15, 2026.

Transparency log

Release files / agent_redact-0.3.1-py3-none-any.whl

Download URL agent_redact-0.3.1-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bf95003539b944e6e6ec10df2381c5f5f2f84c6f61d89b9fb4a5e54292473a29
BLAKE2b-256 checksum
How to use checksums
e26e20743d0aca5dbbbdfb12216e8a737eab689f6f7df2c35acaa228e16a92a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 15, 2026.

Transparency log

Security for agent-redact 0.3.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for agent_redact-0.3.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 Nov 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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