Skip to main content

Secure middleware SDK for AI agents.

Project description

AgentShield

AgentShield is a lightweight Python SDK (v0.1.1) that provides a secure middleware layer between AI agents and developer resources such as repositories, file systems, APIs, and tools.

Its purpose is to prevent accidental leakage of sensitive data (API keys, passwords, tokens, etc.) while still allowing agents to perform useful work.

Features

  • SecureFS – safe file reader that scans and redacts secrets.
  • SecretScanner – regex/entropy-based detection engine.
  • Redactor – replaces detected secrets with placeholders.
  • OutputGuard – inspects agent outputs and blocks or redacts leaks.
  • Policy – YAML-driven configuration for allowed/blocked types.

Getting Started

Install via pip (when released) or add the package to your project:

pip install agentshield
from agentshield import SecureFS, OutputGuard

fs = SecureFS()
safe_content = fs.read_file("config.env")

guard = OutputGuard()
clean_output = guard.inspect("some text containing secret=abc123")

Running the test suite

A small pytest-based test suite lives under tests/. After installing requirements (PyYAML, pytest), run:

python -m pytest -q

You should see five tests covering core functionality.

Project Structure

Extending detection

The :class:agentshield.secret_scanner.SecretScanner class ships with a set of common regexes (API keys, tokens, AWS formats, JWTs, etc.). If you need to recognise additional secrets, simply:

from agentshield.secret_scanner import SecretScanner
import re

scanner = SecretScanner()
scanner.register_pattern("MY_SECRET", re.compile(r"mysecret=\S+"))

Patterns are applied in the order they are registered, and you can also provide a custom list during initialization.

Project Structure

agentshield/
  __init__.py
  secure_fs.py
  secret_scanner.py
  redactor.py
  output_guard.py
  policy.py
policies/
  default_policy.yaml
examples/
  example_usage.py
README.md
LICENSE

License

This project is open source under the Apache license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentshield_api-0.1.2.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentshield_api-0.1.2-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file agentshield_api-0.1.2.tar.gz.

File metadata

  • Download URL: agentshield_api-0.1.2.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for agentshield_api-0.1.2.tar.gz
Algorithm Hash digest
SHA256 714202f51d4e0c370e92f59f4fd90ed4c38f73e080462b947c506f4f94d75661
MD5 a23a88b62faa995bd138fa6bb0a72742
BLAKE2b-256 abc1b507c616b98746694d3075aa179166045352dec864a52b61c1e71448b6f1

See more details on using hashes here.

File details

Details for the file agentshield_api-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for agentshield_api-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f7f653498b41d00d8a91dd2fdc639217ab18b677fbb35feec2e812083b4d8ed5
MD5 ed33fb108534a5ed58e12953c494062c
BLAKE2b-256 f8eaee5c84c830cf49d2fc2df852dec3c8f9c92e3807c3082e9ab187a5c40f88

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page