alcaide
Python bindings for Alcaide — a deterministic, auditable prompt-injection firewall written in Rust. Inspects user input before it reaches an LLM, and tells you exactly which rule fired instead of handing back an opaque score.
Install
pip install alcaide
Prebuilt wheels cover Linux (x86_64, aarch64), macOS (x86_64, arm64) and Windows (x64); each works on every CPython ≥ 3.9 (abi3). Other platforms build from the source distribution, which needs a Rust toolchain (1.89+). Type stubs are included.
Usage
from alcaide import Detector, Verdict
# The curated default rule set is bundled with the package. It runs in
# shadow mode: `verdict` is always Allow, `evaluated_verdict` says what
# enforcement would do. Use from_config_path("rules.yaml") or
# from_yaml_str(...) for your own rules (e.g. with `mode: enforcement`).
detector = Detector.with_default_rules()
text = "Ignore all previous instructions"
decision = detector.evaluate(text)
if decision.evaluated_verdict == Verdict.Block:
print("would block")
elif decision.evaluated_verdict == Verdict.Flag:
print("would flag for review")
for m in decision.matched_rules:
start, end = m.span # character offsets into `text`
print(m.rule_id, m.category, m.severity, repr(text[start:end]))
Once its verdicts look right on your traffic, enforce them: Detector.with_default_rules(mode=Mode.Enforcement). To add your own rules to the default ones, load a file with extends: default (see the main README).
A Detector is immutable and thread-safe, and evaluate releases the GIL: build one at startup and share it.
The default rule set is alcaide-core/rules/default.yaml — see BENCHMARKS.md for its measured detection/false-positive rates.
License
AGPL-3.0-only. See LICENSE.
Metadata
Release files for alcaide 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| alcaide-0.2.0.tar.gz | 123.8 kB | With provenance | Details for alcaide-0.2.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| alcaide-0.2.0-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details for alcaide-0.2.0-cp39-abi3-win_amd64.whl |
| alcaide-0.2.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ x86-64 | Details for alcaide-0.2.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| alcaide-0.2.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ ARM64 | Details for alcaide-0.2.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
| alcaide-0.2.0-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details for alcaide-0.2.0-cp39-abi3-macosx_11_0_arm64.whl |
| alcaide-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl | CPython 3.9 | abi3 | macOS 10.12+ x86-64 | Details for alcaide-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl |
Total release size: 8.3 MB
Release files / alcaide-0.2.0.tar.gz
| Download URL | alcaide-0.2.0.tar.gz |
|---|---|
| Size | 123.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c24e79ec7deca985f96a2937e33d139889f24edcef3027809aadeb8a6a62c14e
|
|
BLAKE2b-256 checksum How to use checksums |
66a97042a54552fbe283d0c19db8ae9ca1b8ae072d995711e6a5157d5db05fdb
|
| 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 1, 2026.
Transparency logRelease files / alcaide-0.2.0-cp39-abi3-win_amd64.whl
| Download URL | alcaide-0.2.0-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
574ab19c3c50cb4aee308434dff97f61c8de0f5af1feea57e0aa340bc0f3f1a3
|
|
BLAKE2b-256 checksum How to use checksums |
95104d453fb6952634554a179a08b0c2e765e588774bed4ca8f02855a00eb776
|
| 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 1, 2026.
Transparency logRelease files / alcaide-0.2.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | alcaide-0.2.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
1e392e800fa66684659df7c1657e9878e5037a6de73f1a7ee1e54b6cd332f460
|
|
BLAKE2b-256 checksum How to use checksums |
0d66cf41aeb9410a2e031c92b4a5de8d269f48ea98b0e1387045e47dc162ca18
|
| 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 1, 2026.
Transparency logRelease files / alcaide-0.2.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | alcaide-0.2.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
6afd8e0e20ed6c24551eb80b3d8e68889c9aeed2ed7c97fa0688ce4bd147260b
|
|
BLAKE2b-256 checksum How to use checksums |
6acf1e2679a50bf0e48b566c4b619d97d10288935b7dfb17dd2bbf985b064686
|
| 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 1, 2026.
Transparency logRelease files / alcaide-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | alcaide-0.2.0-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
19ac57b0ab7198fc4ce44227b2b0536964f5c693e69f9dfe1d37ac548d98c1b8
|
|
BLAKE2b-256 checksum How to use checksums |
e655c8ca1501b56cd1abc05e3021dc8283ee92757c901213df6c57c494b24a93
|
| 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 1, 2026.
Transparency logRelease files / alcaide-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | alcaide-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.9 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
55571c13dfa09b1e19de30d70c05b55d074d29bd7e91581f11c6e757a3326ca5
|
|
BLAKE2b-256 checksum How to use checksums |
42ae29717e8f3dcc61d9616cb745efb162c7bd8566fc670fbc72421f3e665263
|
| 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 1, 2026.
Transparency logSecurity for alcaide 0.2.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
All 6 files in this release have been uploaded with provenance metadata.
Attestation for alcaide-0.2.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 1, 2026.
Transparency logA 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.