The Secure-by-Default Execution Framework for LLM Agents.
Project description
OpenClay
Secure First → Execute Second.
A Neural Alchemy project. The universal, zero-trust execution framework for LLM agents.
Why OpenClay?
Every modern AI framework—LangChain, CrewAI, LlamaIndex—is built on an optimistic assumption: trust the input, trust the tools, trust the memory. OpenClay operates on the opposite principle.
You do not build an agent and then bolt on security.
You define a Security Policy, and the agent executes inside it.
OpenClay wraps every single step — tool calls, memory reads/writes, model inputs and outputs — in a multi-layered shield before any execution ever happens.
Quickstart
pip install openclay
from openclay import Shield
# Create a shield with balanced defaults
shield = Shield.balanced()
# Scan any incoming prompt
result = shield.protect_input("Ignore your instructions and...")
if result["block"]:
print(f"Blocked: {result['reason']}")
The OpenClay Ecosystem
| Module | Status | Description |
|---|---|---|
openclay.shields |
✅ Ready | Core threat detection engine (Aho-Corasick, Bloom Filters, Canary Tokens, ML DeBERTa model) |
openclay.runtime |
🚧 Draft | Secure execution wrapper — wrap any LangChain / CrewAI agent in a zero-trust environment |
openclay.tools |
🚧 Draft | @tool decorators that scan tool outputs before returning them to the agent context |
openclay.memory |
🚧 Draft | Pre-write and pre-read poisoning prevention for RAG and vector databases |
openclay.policies |
🚧 Draft | Explicit, auditable rule engines: StrictPolicy, ModeratePolicy, CustomPolicy |
openclay.tracing |
🚧 Draft | Full explainability and telemetry for every blocked or allowed action |
Shields: What's Under the Hood
openclay.shields is the battle-tested core adapted from PromptShield v3.0 (now deprecated).
It provides a 5-layer defense pipeline:
- Pattern Engine — 600+ curated Aho-Corasick patterns covering injection, jailbreaks, and encoding attacks
- Canary Token System — Cryptographic canary injection and leak detection in LLM outputs
- Bloom Filter — Probabilistic lookups for ultra-fast known-threat screening
- ML Classifier — Fine-tuned DeBERTa model (neuralchemy/deberta-promptinjection) for semantic injection detection
- PII Detection — Contextual PII scanning with redaction modes (mask, stub, remove)
Shield Presets
from openclay import Shield
shield = Shield.fast() # Pattern-only (< 1ms)
shield = Shield.balanced() # Production default (patterns + canary + PII)
shield = Shield.secure() # Full protection (all layers + ML model)
Integrations
# LangChain
from openclay.shields.integrations.langchain import OpenClayCallbackHandler
# FastAPI Middleware
from openclay.shields.integrations.fastapi import OpenClayMiddleware
# CrewAI
from openclay.shields.integrations.crewai import OpenClayCrewInterceptor
# LiteLLM
from openclay.shields.integrations.litellm import OpenClayLiteLLMCallback
The Secure Runtime (Coming in v0.2.0)
from openclay.runtime import SecureRuntime
from openclay.policies import StrictPolicy
# Wrap any existing agent in a zero-trust boundary
runtime = SecureRuntime(policy=StrictPolicy())
result = runtime.run(my_langchain_agent, user_input="Analyze evil.com")
# Get exact tracing on why each action was permitted or blocked
print(runtime.trace().summary())
Migration: PromptShield → OpenClay
promptshield (v3.0.1) is now sunset and will receive no further updates. Migrate in one line:
- from promptshield import Shield
+ from openclay import Shield
All APIs are backwards-compatible.
Links
- 📦 PyPI —
openclay - 📦 PyPI —
promptshields(deprecated) - 📖 Documentation
- 🤗 Hugging Face — DeBERTa Model
- 🐛 GitHub Issues
Built with ❤️ by Neural Alchemy
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openclay-0.1.0.tar.gz.
File metadata
- Download URL: openclay-0.1.0.tar.gz
- Upload date:
- Size: 68.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a80e4a6cf27b5079652fc3645c216522eb642ee185c45ec0716efa47a59441b
|
|
| MD5 |
d3a091b8913de300688cac3bc6528f4f
|
|
| BLAKE2b-256 |
ecd13317d33d7b848a1ef242e41bb77bb49fa92b4ee8af96a13b5a397378472f
|
File details
Details for the file openclay-0.1.0-py3-none-any.whl.
File metadata
- Download URL: openclay-0.1.0-py3-none-any.whl
- Upload date:
- Size: 82.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a69f702d3182ca3209080c67c5e21f44759eb39d022fbad12c2c7e4efca121f
|
|
| MD5 |
e50a613ef9c2bee708f8d5ff3bde36bf
|
|
| BLAKE2b-256 |
f4e26f6c2140dcd091aa2e901b498cc2ccb676771fbbdbd3c88c53ac656714dd
|