# Vigil

> Python library and REST API that scans LLM prompts and responses to detect prompt injections, jailbreaks, and other risky inputs.

Vigil is an open-source Python library and REST API for assessing Large Language Model prompts and responses against a set of scanners. It is developed by deadbits (Adam M. Swanda per the license copyright) and ships with detection signatures and datasets for self-hosting. The project is described as alpha and experimental, intended for research purposes.

## What It Is

Vigil is a security scanner for LLM inputs and outputs. Applications submit a prompt, or a prompt plus a response, and each configured scanner contributes to the final detection. It can be imported into a Python application or run as a REST API server.

## How Detection Works

Scanners are modular and extensible. Available modules include vector database text similarity, YARA heuristics, a transformer model classifier, prompt-response similarity, and canary tokens. Sentiment analysis is also listed in the documentation. Custom detections can be written as YARA signatures. The vector database scanner supports local embeddings (sentence-transformers) or OpenAI embeddings, and it can be auto-updated with detected prompts.

## Canary Tokens and API

Canary tokens can be added to a prompt and later checked in the LLM output, supporting prompt leakage and goal hijacking detection workflows. The API provides endpoints to analyze prompts and responses, add and check canaries, add texts to the vector database, and view settings. Scan results are returned as JSON with per-scanner matches and messages.

## Setup Path

Installation involves cloning the repository, installing YARA, creating a virtual environment, installing with pip, and editing conf/server.conf. Datasets are loaded with the loader.py utility, and the embedding model must match the one used for the stored embeddings. A Streamlit web UI playground is available. The README notes Vigil should not be the only defense, and that a Docker container exists but is not currently recommended.

## Features
- Prompt injection and jailbreak detection
- Python library and REST API
- Vector database / text similarity scanner
- YARA heuristic scanner with custom signatures
- Transformer model scanner
- Prompt-response similarity scanner
- Canary tokens for prompt leakage and goal hijacking
- Sentiment analysis
- Local or OpenAI embeddings
- Streamlit web UI playground
- Datasets and signatures for common attacks

## Integrations
OpenAI, YARA, Sentence-Transformers, Streamlit, LiteLLM

## Platforms
API, DEVELOPER_SDK, LINUX, MACOS

## Pricing
Open Source

## Version
v0.10.3-alpha

## Links
- Website: https://vigil.deadbits.ai/
- Documentation: https://vigil.deadbits.ai/
- Repository: https://github.com/deadbits/vigil-llm
- EveryDev.ai: https://www.everydev.ai/tools/vigil-llm
