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

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.0
File Size Uploaded Provenance Actions
agent_redact-0.3.0.tar.gz 7.4 kB With provenance Details for agent_redact-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 13.9 kB

Release files / agent_redact-0.3.0.tar.gz

Download URL agent_redact-0.3.0.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
71547fbadb9c2d4981c81d72c4919cd691af320c467088bfbd040cc224706b7c
BLAKE2b-256 checksum
How to use checksums
fba9f67f6380c10dc95c51db65425c371f30d070312ebf6e7dbe59170a29e38e
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 8, 2026.

Transparency log

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

Download URL agent_redact-0.3.0-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
afc195d2af221f128189f5fec5a78d9db7e73eaab13cf5d0e1bbf3fd145a204f
BLAKE2b-256 checksum
How to use checksums
192ed7f68e5ec2cf7d566714dd87487ad58c09675614c1f45e6c2cff1532d8f9
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 8, 2026.

Transparency log

Security for agent-redact 0.3.0

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.0.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 8, 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.

Release history Release notifications | RSS feed

This release

0.3.0 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