This repo contains two independent integrations for running Garak LLM red-teaming scans. They share core logic but serve different orchestration surfaces:
-
Llama Stack Provider — An out-of-tree eval provider for the Llama Stack framework. Exposes garak through the Llama Stack
benchmarks.register/eval.run_evalAPI. -
Eval-Hub Adapter — A
FrameworkAdapterfor the eval-hub SDK. Completely independent of Llama Stack. Used by the RHOAI evaluation platform to orchestrate garak scans via K8s jobs.
Llama Stack Eval-Hub
(Llama Stack API) (eval-hub SDK)
┌────────┬────────┐ ┌────────┬────────┐
│ Inline │ Remote │ │ Simple │ KFP │
│ │ KFP │ │ (pod) │ (pod + │
│ │ │ │ │ KFP) │
└────────┴────────┘ └────────┴────────┘
local KFP in-pod K8s job
garak pipelines garak submits to
KFP, polls
| Mode | Code Location | How Garak Runs | Intents Support |
|---|---|---|---|
| Llama Stack Inline | inline/ |
Locally in the Llama Stack server process | No |
| Llama Stack Remote KFP | remote/ |
As KFP pipeline steps on Kubernetes | Yes |
| Eval-Hub Simple | evalhub/ (simple mode) |
Directly in the eval-hub K8s job pod | No |
| Eval-Hub KFP | evalhub/ (KFP mode) |
K8s job submits to KFP, polls status, pulls artifacts via S3 | Yes |
Intents is a key upcoming feature — it uses SDG (synthetic data generation),
TAPIntent probes, and MulticlassJudge detectors to test model behavior against
policy taxonomies. Only the two KFP-based modes support it because it requires
the six-step pipeline (core/pipeline_steps.py) running as KFP components.
src/llama_stack_provider_trustyai_garak/
├── core/ # Shared logic used by ALL modes
│ ├── config_resolution.py # Deep-merge user overrides onto benchmark profiles
│ ├── command_builder.py # Build garak CLI args for OpenAI-compatible endpoints
│ ├── garak_runner.py # Subprocess runner for garak CLI
│ └── pipeline_steps.py # Six-step pipeline (validate→taxonomy→SDG→prompts→scan→parse)
│
├── inline/ # Llama Stack Inline mode
│ ├── garak_eval.py # Async adapter wrapping garak subprocess
│ └── provider.py # Provider spec with pip dependencies
│
├── remote/ # Llama Stack Remote KFP mode
│ ├── garak_remote_eval.py # Async adapter managing KFP job lifecycle
│ └── kfp_utils/ # KFP pipeline DAG and @dsl.component steps
│
├── evalhub/ # Eval-Hub integration (NO Llama Stack dependency)
│ ├── garak_adapter.py # FrameworkAdapter: benchmark resolution, intents overlay, callbacks
│ ├── kfp_adapter.py # KFP-specific adapter (forces KFP execution mode)
│ ├── kfp_pipeline.py # Eval-hub KFP pipeline with S3 artifact flow
│ └── s3_utils.py # S3/Data Connection client
│
├── base_eval.py # Shared Llama Stack eval lifecycle (NOT used by eval-hub)
├── garak_command_config.py # Pydantic models for garak YAML config
├── intents.py # Policy taxonomy dataset loading (SDG/intents flows)
├── sdg.py # Synthetic data generation via sdg-hub
├── result_utils.py # Parse garak outputs, TBSA scoring, HTML reports
└── resources/ # Jinja2 templates and Vega chart specs
- Config merging: User overrides are deep-merged onto benchmark profiles via
deep_merge_dictsincore/config_resolution.py. Only leaf values are replaced. - Intents model overlay: When
intents_modelsis provided, model endpoints are applied usingx.get("key") or defaultpattern — fills empty slots but preserves user-configured values.api_keyis always forced to__FROM_ENV__(K8s Secret injection). - Benchmark profiles: Predefined configs live in
base_eval.py(Llama Stack) andevalhub/garak_adapter.py(eval-hub). Theintentsprofile is the most complex — it includes TAPIntent, MulticlassJudge, and SDG configuration. - Provider specs:
inline/provider.pyandremote/provider.pydefine Llama Stack provider specs.pip_packagesis auto-populated fromget_garak_version().
pip install -e . # Core (Llama Stack remote mode)
pip install -e ".[inline]" # With garak for local scans
pip install -e ".[dev]" # Dev (tests + ruff + pre-commit)make test # All tests (no cluster/GPU/network needed)
make coverage # With coverage report
make lint # ruff checkTests are 100% unit tests. Garak is mocked — it does not need to be installed.
GARAK_SCAN_DIR— controls where scan artifacts landLOG_LEVEL=DEBUG— verbose eval-hub adapter loggingscan.login scan directory — garak subprocess output__FROM_ENV__in configs — placeholder for K8s Secret api_key injection