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.1.tar.gz (42.6 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.1-py3-none-any.whl (57.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: krucible-0.1.1.tar.gz
  • Upload date:
  • Size: 42.6 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.1.tar.gz
Algorithm Hash digest
SHA256 b1f1a0520629d8838b34bd135eac1bdaf4f2a361575fd6e7d4db498096db705f
MD5 98a7c0c756beefe22e0f557b875f1bef
BLAKE2b-256 dce8d2fa8c58ac74d590bb37fa62afb4dda0f80d3cc13afe57d7b13c19403f95

See more details on using hashes here.

File details

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

File metadata

  • Download URL: krucible-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 57.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 24ec3f6124b553840b4161e75b3030cfad8d44c07ab4f178581ec8a3e53d530e
MD5 984748895f318afe8920f414417a42fc
BLAKE2b-256 723367d6a4804b00edb549121df93782edb4ea9f76605879978947d5d50722de

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