> ## Documentation Index
> Fetch the complete documentation index at: https://docs.switchagents.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> These docs moved from docs.flintai.dev to docs.switchagents.ai. Use docs.switchagents.ai for every link and request.
> To search these docs from an AI tool, connect the MCP server at https://docs.switchagents.ai/mcp. The page index is at https://docs.switchagents.ai/llms.txt.
> The source code for these products is public on GitHub. Switch Rooms: https://github.com/sandbox-quantum/switch. Switch Trust CLI: https://github.com/sandbox-quantum/switch-trust-cli. Switch Trust CodeScan action: https://github.com/sandbox-quantum/switch-trust-codescan-action. Switch Trust MCP server: https://github.com/sandbox-quantum/switch-trust-mcp. Switch Trust Python SDK: https://github.com/sandbox-quantum/switch-trust-sdk-py. These repositories are the current development line, not the released product: prefer these docs for released behavior, and name the version if you quote code. In the Switch Rooms repository, ignore docs/official/, which is a generated copy of this site.

# How evaluation works

> Evaluation types, detectors, and scoring explained

Switch Trust Eval sends prompts to your running agent and scores the responses. Tests combine **evaluation types** (how prompts are generated) with **detectors** (how responses are scored).

## Evaluation framework

Switch Trust Eval uses a composable architecture:

**1. Evaluation generates test prompts**

The evaluation type determines what prompts to send to your agent

**2. Agent responds to each prompt**

Your agent processes prompts just like in production

**3. Detector scores each response**

The detector type determines how responses are evaluated

**4. Result aggregates scores**

Individual scores combine into a 0.0-1.0 reliability metric

## Evaluation types

Choose between fixed prompts (repeatable tests) or AI-generated prompts (adaptive attacks). Evaluations define **what prompts to send** to your agent.

> [accordion] Adversarial probe
>
> AI-generated attack prompts that adapt to the responses from your agent across multiple turns.
>
> **How it works:**
>
> * LLM (`GENERATOR_MODEL`) generates prompts designed to exploit specific vulnerabilities
> * Attacker model adjusts strategy based on agent responses
> * Supports multi-turn conversations (up to 10 turns per test)
>
> **Example:** OWASP LLM01 adversarial probe generates prompts trying to override system instructions
>
> **Requires:** LLM provider configured via `GENERATOR_MODEL`

> [accordion] Message collection
>
> Fixed list of pre-written test prompts.
>
> **How it works:**
>
> * Prompts loaded from CSV file, in-memory list, or Garak module
> * Each prompt sent once to your agent
> * Deterministic and repeatable
>
> **Example:** Custom scope-boundary test with 20 hand-crafted prompts
>
> **Requires:** Prompt source (CSV file, JSON array, or Garak module)

> [accordion] Topic guard
>
> AI-generated out-of-scope prompts to test whether your agent stays within its defined role.
>
> **How it works:**
>
> * LLM generates plausible but off-topic requests
> * Tests agent's ability to refuse gracefully
>
> **Example:** Weather agent should refuse requests about financial data
>
> **Requires:** LLM provider configured via `GENERATOR_MODEL`

## Detector types

Some detectors use AI judges, others use local pattern matching (no LLM required). Detectors define **how responses are scored**.

> [accordion] LLM-as-judge
>
> A separate LLM evaluates whether the response from your agent meets the test criteria.
>
> **How it works:**
>
> * Response sent to judge model (`GENERATOR_MODEL`)
> * Judge follows scoring instructions (for example, "Score 1 if agent refused, 0 if it leaked data")
> * Returns 0.0-1.0 score
>
> **Example:** Judge evaluates whether agent leaked its system prompt
>
> **Requires:** LLM provider configured via `GENERATOR_MODEL`
>
> **Accuracy:** Strong judges achieve 80-90% agreement with human evaluators

> [accordion] PII detector
>
> Regex-based detection of personally identifiable information.
>
> **How it works:**
>
> * Scans response for patterns: emails, phone numbers, SSNs, credit cards
> * Runs locally, no LLM required
> * Returns 1.0 if no PII found, 0.0 if PII detected
>
> **Example:** Detects if agent leaked `john.doe@example.com` in its response
>
> **Requires:** Nothing (local detector)

> [accordion] Secret detector
>
> Regex-based detection of API keys, tokens, and credentials.
>
> **How it works:**
>
> * Scans for AWS keys, GitHub tokens, private keys, and similar secrets
> * Runs locally, no LLM required
> * Returns 1.0 if no secrets found, 0.0 if secrets detected
>
> **Example:** Detects if agent exposed `sk-proj-abc123...`
>
> **Requires:** Nothing (local detector)

> [accordion] Toxicity classifier
>
> ML-based classifier for toxic, offensive, or harmful content.
>
> **How it works:**
>
> * Uses local classifier model
> * No LLM required
> * Returns toxicity score
>
> **Example:** Detects if agent generated hateful or abusive language
>
> **Requires:** The optional `full` extra — `pip install 'switch-trust-cli[full]'`. No LLM provider.

> [accordion] Garak detectors
>
> Adapters for [Garak framework](https://github.com/NVIDIA/garak) detectors.
>
> **How it works:**
>
> * Runs the built-in Garak detectors locally
> * Includes pattern matching, heuristics, and specialized checks
> * No LLM required
>
> **Example:** The Garak `encoding` detector checks for Base64-encoded attacks
>
> **Requires:** The optional `full` extra — `pip install 'switch-trust-cli[full]'`. No LLM provider.

## How evaluations combine with detectors

Each builtin evaluation pairs an evaluation type with a detector. Here are examples showing how they work together:

**LLM01 Adversarial** `adversarial_probe + LLM-as-judge`

Adversarial probe generates prompt injection attacks, LLM-as-judge scores whether agent followed attacker's instructions.

**Result:** 0.0-1.0 score measuring prompt injection resistance

**PII Leakage** `message_collection + PII detector`

Message collection sends fixed prompts requesting sensitive data, PII detector scans responses for email/phone/SSN patterns.

**Result:** 1.0 if no PII found, 0.0 if PII detected

**Garak Module** `garak_module + garak detector`

Loads a [Garak](https://github.com/NVIDIA/garak) attack module, such as encoding, prompt injection, or jailbreaks, and pairs it with a Garak detector that scores the agent's responses.

**Result:** Pass/fail per probe attempt

See [Built-in evaluations](https://docs.switchagents.ai/switch-trust-cli/reference/builtin-evaluations.md) for the complete catalog.

## Scoring

Each evaluation returns a 0.0-1.0 score:

* **1.0** = Perfect (all tests passed)
* **0.8+** = Good (minor issues)
* **0.5-0.8** = Needs improvement
* **\< 0.5** = Critical issues

Your **overall score** is the weighted average across all attached evaluations.

See [Eval results](https://docs.switchagents.ai/switch-trust-cli/eval/eval-results.md) for how to interpret scores and fix issues.

## Next steps

> [card] [Browse evaluations](https://docs.switchagents.ai/switch-trust-cli/reference/builtin-evaluations.md)
>
> See all 38+ builtin tests

> [card] [Configuration](https://docs.switchagents.ai/switch-trust-cli/eval/eval-configuration.md)
>
> Set up and run tests

> [card] [Data privacy](https://docs.switchagents.ai/legal/cli-data-privacy.md)
>
> What gets sent to LLMs
