Skip to main content

AI Security Regression Testing Platform

Project description

๐Ÿ›ก๏ธ Krucible

The Configuration-Driven AI Security Regression Testing Platform

CI Version Python 3.10+ License: MIT

๐Ÿ“– Overview

Krucible is a production-grade regression testing platform designed explicitly for Large Language Models and AI applications. As AI models update dynamically, their safety guardrails frequently drift. What was secure yesterday might leak PII today.

Krucible automates AI Security Regression Testing. It executes adversarial payloads (Prompt Injections, Jailbreaks) against your AI models, evaluates the outputs against strict security policies, and calculates semantic drift across CI/CD pipeline runs.

Why Krucible Exists

Traditional testing tools calculate binary JSON or text diffs. AI requires semantic evaluation. Krucible completely separates the execution engine from the security payloads. Developers build the pipelines; Security Researchers write the YAML payloads.

โœจ Features

  • Configuration-Driven: Zero Python modifications required. Define attacks and policies purely in .yml files.
  • Engine Orchestration: Robust Dependency Injection architecture executing complex multi-stage evaluations securely.
  • Regression Detection: Tracks policy flips, semantic similarity drifts, and tool-usage deviations.
  • Three Testing Journeys:
    1. AI Providers: Direct testing of foundation models (OpenAI, Anthropic, Gemini, OpenRouter, Groq, Ollama).
    2. AI Applications: Test your deployed custom APIs. Krucible attempts to auto-detect payload structure (JSON input and output mapping), with manual override available.
    3. Native Python Agents: Hook directly into un-deployed frameworks (LangChain, CrewAI, FastAPI).
  • CI/CD Ready: Generates strictly-typed machine-readable JSON artifacts and beautiful Rich terminal outputs with deterministic exit codes.

๐Ÿš€ Quick Start

Installation

Install Krucible via pip:

pip install krucible

Initialization & Onboarding

Set up a new Krucible project using the interactive wizard:

python -m krucible quickstart

This journey-based wizard will guide you through testing an AI Provider, a custom AI Application, or a Native AI Agent, attempting to auto-detect structures where possible.

Running Tests

Execute your security regression test suite:

krucible test

Output:

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ AI Security Regression Test Results โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Target: Custom custom                                                                              โ”‚
โ”‚ Duration: 1250.00ms                                                                                โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Attacks Executed: 2
Policies Evaluated: 2

      Execution Results       
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ Attack            โ”ƒ Status       โ”ƒ
โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ Prompt Injection  โ”‚ [FAIL]       โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Ignore Guardrails โ”‚ [PASS]       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Summary
Passed: 1
Failed: 1
Regressions: 0

Exit Code: 1

โš™๏ธ Configuration

Your krucible.yml controls the orchestrator targeting.

OpenAI Example

version: v1
target:
  adapter: openai
  model: gpt-4o
regression:
  similarity_threshold: 0.85

Custom REST API Example

version: v1
target:
  adapter: custom
  model: custom
regression:
  similarity_threshold: 0.85

(Requires KRUCIBLE_CUSTOM_URL, KRUCIBLE_CUSTOM_PAYLOAD_KEY, and KRUCIBLE_CUSTOM_OUTPUT_KEY in .env)

๐Ÿ—๏ธ Architecture Overview

Krucible enforces Domain-Driven Design:

  1. Loaders: AttackLoader and PolicyLoader parse local YAML into frozen Pydantic Models.
  2. Adapters: Anti-corruption layers (Strategy Pattern) wrapping external SDKs (OpenAIAdapter, GeminiAdapter).
  3. Orchestrator: Dispatches payloads to the Target and routes responses to the PolicyEngine.
  4. Regression Engine: Compares the current Evaluation set against the local BaselineStore.
  5. Report Engine: Fans out ReportSummary models to standard out (CLI) and disk (JSON).

๐Ÿ—บ๏ธ Roadmap

  • Phase 2: Multi-turn Conversation Attacks, LLM-as-a-Judge Policy Evaluators, Ollama Native Integration.
  • Phase 3: Extensible Plugin ecosystem (krucible install owasp-top-10).
  • Phase 4: Visual HTML Reporting generation.

๐Ÿค Contributing

We welcome community contributions! Please review our Contributing Guide and Code of Conduct.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

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

krucible-0.1.0.tar.gz (42.1 kB view details)

Uploaded Source

Built Distribution

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

krucible-0.1.0-py3-none-any.whl (56.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: krucible-0.1.0.tar.gz
  • Upload date:
  • Size: 42.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for krucible-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fe6afe2f4b3804bbb9189e5623e64a1e298dcffca14e506bbdecb3a4064ba67d
MD5 862b2c87552d7e8b1ec80e5e25aae70a
BLAKE2b-256 3e543b7e55375a2e640de8f2f6afb445806573d8224d846cec1e5bb606846e96

See more details on using hashes here.

File details

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

File metadata

  • Download URL: krucible-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 56.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for krucible-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cc485f0256d3e6fc10ea0479dafaa3f958ff871c0550141ced3c10056e1d1f9b
MD5 b18f6fdf943d4834ee6b59cec56081aa
BLAKE2b-256 b0fbcd9881f6c853f031ea001a539528edb0c1fa9c97a05a56974823037fb2d8

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