LLMs are powerful β but they can be manipulated, abused, and exploited in ways traditional software cannot. LLM Strata is a Python framework for testing and monitoring LLM-powered applications across their lifecycle. It provides configurable coverage.
- π Before deployment β find vulnerabilities, safety gaps, and adversarial weaknesses
- π§ At runtime β demonstrate input/output scanning and policy controls that applications can integrate in real-time
- π In production β continuously monitor for safety drift and suspicious behaviour
LLM Strata is a collection of independent security and safety test layers. The layers share provider profiles, credential loading, and report conventions, so you can switch the model under test with one setting and run every layer against it.This framework provides configurable coverage across documented LLM security and safety threat categories using 14 modules.
- Assess selected OWASP LLM Top 10 threat categories before release
- Identify jailbreak, prompt-injection, and harmful-output risks before deployment
- Run the configured security pipeline through one orchestrator command:
python run_security.py
- Run structured automated and human red-team exercises with logged, scored results
- Map instrumented tests to documented OWASP LLM Top 10 threat categories
- Replace ad-hoc testing with a repeatable workflow and reviewable evidence
- Evaluate configured RAG safety cases, including context poisoning and grounding risks
- Score selected safety metrics and save structured JSON reports
- Connect supported providers through profiles and module configuration
- Use LLM Guard as a reference for local input/output scanning and control benchmarking
- Send instrumented requests and safety scores to LangFuse
- Review safety trends over time to identify potential drift
| Capability | Purpose | Typical use |
|---|---|---|
| π§ͺ Pre-deployment assessment | Identify prompt injection, jailbreak, leakage, misuse, and safety weaknesses | Pull requests, release candidates, scheduled assessments |
| βοΈ Adversarial attack simulation | Exercise encoded, multilingual, in-context, agentic, backdoor, and RAG attack paths | Security validation and red-team exercises |
| π§ Runtime reference controls | Demonstrate local input/output scanning and policy checks for application integration | Control benchmarking and defense-in-depth validation |
| π‘ Production monitoring | Capture traces and safety scores for instrumented requests | Drift detection and operational review |
| π§Ύ Evidence and reporting | Persist structured JSON results and CI artifacts | Triage, audit evidence, and remediation tracking |
LLM Strata is composed of 14 independent security and safety layers. Each layer has its own runner, configuration, outputs, and direct command, so it can be executed independently or as part of the full pipeline. The layers share provider, profile, and reporting utilities while remaining independently configurable.
The framework combines pre-deployment testing, runtime scanning, agent/RAG security tests, human review, and production monitoring. Coverage is configurable and should be interpreted as evidence from the selected test corpus.
- π§ͺ Pre-deployment: Garak, DeepEval, RAGAS, PyRIT
- π‘ Runtime and monitoring: LLM Guard, LangFuse
- π΅οΈ Human and advanced attacks: Human Red Team, Encoded Attacks, In-Context Attacks, Multilingual Attacks, Backdoor Triggers
- π€ Agent and RAG security: Tool Injection, RAG Security, Agent Security
π Click any module name above to open its dedicated guide and learn more about its purpose, configuration, usage, outputs, and coverage.
The framework is organized into three operational stages:
flowchart LR
change["Code change or release candidate"] --> scan["SCAN<br/>Assessment and vulnerability checks"]
scan --> attack["ATTACK<br/>Adversarial and abuse-case simulation"]
attack --> monitor["MONITOR<br/>Instrumented production telemetry"]
app["LLM application"] --> controls["Runtime reference controls<br/>Input/output policy checks"]
app --> monitor
Each runner is independently configurable. Reports should be interpreted as evidence from the selected test corpus.
- π Python 3.10-3.14 (Python 3.14 is supported; Python 3.10-3.12 remains the most conservative compatibility range)
- π Credentials for the selected model provider, where required
- π‘ LangFuse credentials only when production monitoring is enabled
- π Network access to the target model or a reachable private/local endpoint
Clone the repository:
git clone https://github.com/VenkateshDoijode/LLM-Strata.git
cd LLM-StrataThen run the setup:
python setup.pyThe setup process creates the main virtual environment, installs dependencies, provisions the isolated Garak environment, and creates report directories.
Create a local environment file from the provided template, then keep only the variables required by your selected profile.
Windows PowerShell:
Copy-Item .env.example .envLinux/macOS:
cp .env.example .envConfigure the applicable provider variables in .env or in the operating-system environment:
| Provider/profile | Required variables |
|---|---|
OpenAI (production, cost_optimized, redteam) |
OPENAI_API_KEY |
Azure OpenAI (azure) |
AZURE_OPENAI_API_KEY, AZURE_OPENAI_ENDPOINT |
Gemini (gemini) |
GEMINI_API_KEY |
Hugging Face (huggingface) |
HF_TOKEN |
Anthropic (anthropic) |
ANTHROPIC_API_KEY |
AWS Bedrock (bedrock) |
AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION_NAME |
Ollama (local) |
No cloud key by default; start the Ollama service |
Private compatible endpoint (private_compatible) |
OPENAI_COMPATIBLE_BASE_URL and an optional OPENAI_COMPATIBLE_API_KEY |
β Select any one provider of your choice β you don't need to set up all of them. Configure only the variables required by the provider/profile you plan to use.
For production monitoring, also set LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY. Operating-system variables take precedence over .env values. Never commit .env, API keys, provider endpoints containing credentials, or generated reports. See Providers and Secrets for the full provider matrix and precedence rules.
Set active_profile in profiles.yaml, or override it for one process:
$env:ACTIVE_PROFILE = "private_compatible"
python run_security.py --dry-runAvailable profiles include OpenAI, Azure, Ollama, Gemini, Hugging Face, Anthropic through LiteLLM, AWS Bedrock through LiteLLM, and private OpenAI-compatible endpoints. See profiles.yaml for the current profile definitions.
Start with a non-networked orchestration check:
python run_security.py --dry-runRun the configured pipeline only after reviewing credentials, data handling, and cost:
python run_security.pyRun the focused unit tests:
python -m unittest discover -s agent_security/tests -vThe current provider adapters are:
- βοΈ OpenAI
- π· Azure OpenAI
- π¦ Ollama
- π΅ Google Gemini
- π€ Hugging Face Inference API
- π§© Anthropic through LiteLLM
- π AWS Bedrock through LiteLLM
- π Private and on-premises OpenAI-compatible endpoints
The framework can assess these deployment contexts when the target is reachable through a supported interface:
- βοΈ Cloud LLM
- π’ Private Cloud LLM
- π» Local/On-Prem LLM
- π± Edge LLM
- π Hybrid LLM
- π Air-Gapped LLM
- π¦ Containerized LLM
- π Multi-Cloud LLM
- π§± Embedded/Application LLM
π‘ The framework supports OpenAI-compatible endpoints and selected LiteLLM-backed providers. Additional LiteLLM providers can be integrated through
client_factory.pyandprofiles.yaml. See Providers and Secrets.
The GitLab pipeline is organized into three stages:
| Stage | Purpose | Examples |
|---|---|---|
π scan |
Core security and safety assessment | Vulnerability scanning, safety evaluation, agentic red teaming |
βοΈ attack |
Advanced adversarial simulation | Encoding, multilingual, in-context, tool injection, backdoor, RAG security |
π‘ monitor |
Instrumented monitoring | LangFuse traces and safety scores |
Run the CI-equivalent dry run locally:
python run_security.py --dry-run
python run_security.py --ci --skip-langfuseThe pipeline stores reports under results/ as CI artifacts. Review reports rather than relying only on job status; advisory attack jobs may complete successfully while reporting unsafe behavior.
| Guide | Description |
|---|---|
| ποΈ Architecture | Pipeline phases, trust boundaries, and data flow |
| π― Threat model | Assets, actors, assumptions, and coverage boundaries |
| π Providers and secrets | Profiles, credentials, endpoints, and provider integration |
| π CI/CD operations | Stages, variables, artifacts, and release guidance |
| π§Ύ Results and triage | Outcome interpretation and remediation workflow |
| π Production integration | Runtime enforcement and monitoring integration |
LLM-Strata/
βββ run_security.py # Main pipeline runner
βββ profiles.yaml # Model profile selection
βββ profile_loader.py # Profile loading
βββ env_loader.py # Credential and .env loading
βββ client_factory.py # OpenAI-compatible client creation
βββ ragas_config.yaml # RAGAS configuration
βββ requirements.txt # Python dependencies
βββ setup.py # Package setup
βββ gitlab-ci.yml # GitLab CI pipeline definition
βββ garak/ # Layer 1
βββ deepeval/ # Layer 2
βββ ragas/ # Layer 3
βββ pyrit/ # Layer 4
βββ llm_guard/ # Layer 5
βββ langfuse/ # Layer 6
βββ human_redteam/ # Layer 7
βββ encoded_attacks/ # Layer 8
βββ many_shot/ # Layer 9
βββ multilingual/ # Layer 10
βββ tool_inject/ # Layer 11
βββ backdoor/ # Layer 12
βββ rag_security/ # Layer 13
βββ agent_security/ # Layer 14
βββ Docs/ # Threat model, architecture, CI/CD, triage, integration
βββ results/ # Generated reports
Contributions are welcome! π Fork the repository, make your change, and open a pull request with a short description of what you changed and why.
- π Found a bug or have an idea? Open an issue
- π§ Ready to contribute? Submit a pull request
- β Like the project? Give it a star to help others find it
LLM Strata is open source. See the LICENSE file for the license terms.
Created and maintained by Venkateshwara Doijode.