Skip to main content

Pull the plug on bad AI. Fast prompt injection detection and redaction for LLM apps, agents, and RAG pipelines.

Project description

Unplug SDK

Runtime enforcement layer for AI agents — provenance-aware scanning and tool-call gates.

PyPI release follows a satisfactory unplug-tiny model run. Until then, install from source:

git clone https://github.com/UnplugAI/Unplug.git && cd Unplug/sdk
uv sync && uv pip install -e .
pip install unplug-ai   # coming to PyPI after model validation
from unplug import Guard
from unplug.api.enums import Source

guard = Guard()  # local mode, offline, regex scanners by default

result = guard.scan("Ignore all previous instructions", source="user")
if not result.safe:
    print(result.redacted_text)
    print(result.findings)

Agent host checklist

Use this flow when wiring Unplug into an agent that fetches external content or calls tools:

  1. Scan user inputguard.scan(text, source="user") (captures user_intent for later gates).
  2. Wrap untrusted content before inserting into LLM context — guard.wrap_for_context(rag_chunk, source="retrieved"). Auto-wrap also runs on scan(..., source="retrieved") when [boundaries] auto_wrap_untrusted = true.
  3. After fetch/read toolsguard.notify_taint_source("web_fetch") so side-effect tools require review.
  4. Before every tool callguard.check_tool_call(name, args, taint_sources=[...]). Destructive calls block; tainted session + side-effect → REVIEW.
  5. Scan agent outputguard.scan_output(text). Set strip_on_output = true to remove boundary markers from redacted output.
  6. New trusted turnguard.reset_session_taint() when the user starts a fresh instruction with no untrusted context.

Copy unplug.example.toml to unplug.toml to customize scanners, tool profiles, and boundaries.

Optional ML (0.2.0)

pip install "unplug-ai[ml]"

Set active_model = "small" in config and point UNPLUG_MODEL_PATH at a DeBERTa-v3-xsmall dual-head checkpoint (HuggingFace download in 0.2.0). The model has two heads on one backbone: a document classifier (injection detection recall) and a token/BIOES span head (localization and redaction). Until then, regex + tool enforcement is the supported default.

All published model metrics are produced by the frozen golden eval harness (unplug_exp/scripts/golden_eval.py) on held-out data and recorded in BENCHMARKS.md — no hand-typed numbers, measured not target.

Run wiring checks anytime:

unplug-audit
unplug-audit --probes          # FP + encoding + boundary batteries
unplug-audit --require-ml      # after ML checkpoint is configured

Examples

Docs: github.com/UnplugAI/Unplug

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

unplug_ai-0.1.0.tar.gz (261.6 kB view details)

Uploaded Source

Built Distribution

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

unplug_ai-0.1.0-py3-none-any.whl (96.5 kB view details)

Uploaded Python 3

File details

Details for the file unplug_ai-0.1.0.tar.gz.

File metadata

  • Download URL: unplug_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 261.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for unplug_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 95079d89a388a82af5f5e920421bd9c33bbf5f86c2637fb8f87fc02752ce3adf
MD5 fbc409e872909caae0c64623009803f1
BLAKE2b-256 b7e58dbaf0b6d1d7e78146a7dcf85c0583d17a7d9ef2e9ec68d88f75666f3cba

See more details on using hashes here.

File details

Details for the file unplug_ai-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: unplug_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 96.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for unplug_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0a8e156ad67be3948365a8e555af87b5c1a96e6f21b224c3480966c107a9b08
MD5 21313828415c8b92cf3fa96dd94f2f38
BLAKE2b-256 b545f4bcb8b3dc313921e40e76bcb7ea0b422c4336a606ca798ebd1c59090bda

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