Skip to content

Configuration

AIGuard reads its configuration from aiguard.yaml in the current working directory. All fields have safe defaults; the file is created for you by aiguard project init.

Example aiguard.yaml

aiguard.yamlyaml
# Project identity
project: my-project

# Target model
model:
  provider: openai
  endpoint: https://api.openai.com/v1
  model_name: gpt-4o
  api_key_env: OPENAI_API_KEY
  system_prompt_path: prompt_template.py
  tools_path: tools.py

# Evaluation modules
evaluation:
  enabled_modules:
    - adversarial
    - hallucination

  adversarial:
    threshold: 0.15          # fail if avg_risk > threshold
    mode: quick              # quick | thorough
    runs_per_test: 3
    quick_limit: 20
    use_live_model: true

  hallucination:
    threshold: 0.20
    mode: auto               # auto | ground_truth | context | consistency
    dataset: tests/halluc.jsonl

# Storage backend
storage:
  backend: sqlite            # sqlite | postgres
  path: .aiguard/aiguard.db

# Pipeline (background evaluation)
pipeline:
  batch_interval_hours: 1
  batch_size: 100

Model

The model block defines the LLM under evaluation. AIGuard uses LiteLLM under the hood, so any provider that LiteLLM supports can be configured here. Theapi_key_env field names the environment variable that holds the key — never put secrets directly in the file.

Evaluation

Enable one or more modules. Each module supports a threshold that determines when the CLI exits with a non-zero code, which is what gates CI/CD pipelines — see CI/CD Integration.

Storage

SQLite is the default and requires no configuration. Setbackend: postgres and the AIGUARD_PG_DSN environment variable to switch to Postgres for shared deployments.