> ## 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.

# Eval your agent

> Get proof your agent is ready for production

Test factual accuracy, instruction adherence, prompt injection, jailbreaks, and more. See [Built-in evaluations](https://docs.switchagents.ai/switch-trust-cli/reference/builtin-evaluations.md) for the full list. Tests are framework-agnostic and provide a 0.0-1.0 score proving agent reliability.

> [card] [Switch Trust CLI on GitHub](https://github.com/sandbox-quantum/flintai-cli)
>
> Source code, example agents, and issue tracking

> [!TIP]
>
> Install our MCP server in Claude Code or your AI code assistant, then ask: **"Help me set up Switch Trust Eval"** to get live guidance, troubleshoot issues, and work through these steps together. [Learn how →](https://docs.switchagents.ai/use-these-docs)

## Evaluate your agent at runtime

> [!NOTE]
>
> **Before you start:** Your agent must be running and accessible over HTTP. Evaluation works by sending prompts to a live endpoint and scoring the responses.

**1. Verify switch-trust-cli is installed**

```bash theme={null}
switch-trust --version
```

> [accordion] Need setup?
>
> If not installed, using a virtual environment is recommended to avoid dependency conflicts:
>
> ```bash theme={null}
> python3 -m venv .venv
> source .venv/bin/activate
> ```
>
> Install Switch Trust CLI:
>
> ```bash theme={null}
> pip install switch-trust-cli
> switch-trust init
> ```
>
> [Full installation guide →](https://docs.switchagents.ai/switch-trust-cli.md#try-it-now)

> [!NOTE]
>
> **Bring your own LLM key.** Evaluation uses an LLM as judge, so it needs an API key for your own LLM provider (Gemini, OpenAI, Anthropic, or LiteLLM). This is your provider key for the local CLI, not a Switch Trust API token. `switch-trust init` prompts for it and stores it locally in `~/.switch-trust/.env`.

> [accordion] Where to get an LLM provider key
>
> * **Google Gemini**: [aistudio.google.com/apikey](https://aistudio.google.com/apikey) (free tier available)
> * **OpenAI**: [platform.openai.com/api-keys](https://platform.openai.com/api-keys)
> * **Anthropic**: [console.anthropic.com/settings/keys](https://console.anthropic.com/settings/keys)

**2. Start your agent**

Switch Trust Eval sends prompts to your agent over HTTP, so it must be running and reachable before you evaluate. Start your agent and note the host and port it listens on — you'll add these to your config next.

> [accordion] Try it with a shipped example agent
>
> No agent of your own yet? Clone [switch-trust-cli](https://github.com/sandbox-quantum/switch-trust-cli) and serve the bookstore example (OpenAI Agents SDK) on port 8010 from the repo root:
>
> ```bash theme={null}
> uvx --with openai-agents,fastapi --from uvicorn uvicorn examples.bookstore_agent.agent:app --port 8010 --host 0.0.0.0
> ```
>
> > [!NOTE]
> >
> > This command uses `uvx`, which ships with [uv](https://docs.astral.sh/uv/getting-started/installation/). Install uv first if you don't have it.
>
> The agent keeps running in this terminal and is now reachable at `http://localhost:8010`. In a separate terminal, run the bundled evaluations. The repo ships `examples/config.json` with both example agents pre-configured, so you can skip **Add your agent** and **Attach evaluations** and run directly:
>
> ```bash theme={null}
> switch-trust eval run --model model-bookstore-agent --config examples/config.json
> ```
>
> This config attaches OWASP LLM01–LLM09, PII, and secrets evaluations. The `weather_agent` (Google ADK) example is included too.

**3. Add your agent**

Create or update your agent config file with connection details:

```json theme={null}
{
  "models": [
    {
      "id": "my-agent",
      "type": "adk",
      "name": "My Agent",
      "host": "http://localhost:8000"
    }
  ]
}
```

> [!NOTE]
>
> **Important:** The `host` field must match where your agent is actually running.

> [accordion] How do I edit my config file?
>
> The config file is stored in `~/.switch-trust/config.json` (where `~` means your home directory).
>
> > [!TIP]
> >
> > Folders starting with a dot are hidden from Finder. Use the commands below to create and open the file automatically.
>
> These commands create the `.switch-trust` directory if needed, then open the config file in TextEdit:
>
> ```bash theme={null}
> mkdir -p ~/.switch-trust
> open -e ~/.switch-trust/config.json
> ```
>
> Add the connection details for your agent and save (Cmd+S or File → Save).

> [accordion] What do these config fields mean?
>
> * `id` - Unique ID for this model or agent. You'll use it in commands like `--model my-agent`.
>
> * `type` - Your agent's framework (expand supported types below).
>
> * `name` - The label that will identify this agent in results and logs.
>
> * `host` - Base URL for the target endpoint, if this type connects over HTTP.
>
> > [!NOTE]
> >
> > Start your agent and confirm it answers at the `host` URL before you run an evaluation.

> [accordion] Supported agent types
>
> * **adk** - Google ADK agents
> * **openai\_agent** - OpenAI Agents SDK
> * **langchain** - LangChain agents
> * **crewai** - CrewAI agents
>
> See [Configuration](https://docs.switchagents.ai/switch-trust-cli/eval/eval-configuration.md) for all types and options.

**4. Attach evaluations**

Browse [built-in evaluations](https://docs.switchagents.ai/switch-trust-cli/reference/builtin-evaluations.md) to see available tests, then attach them to your agent:

> [!NOTE]
>
> No evaluations run by default. You must attach at least one evaluation before running `switch-trust eval run`.

```bash theme={null}
switch-trust eval model-evaluations attach \
  --model my-agent \
  --eval eval-llm09-fixed

switch-trust eval model-evaluations attach \
  --model my-agent \
  --eval eval-llm01-fixed
```

> [accordion] How do I attach multiple evaluations at once?
>
> Use `--eval-tag` to batch-attach evaluations by tag:
>
> ```bash theme={null}
> switch-trust eval model-evaluations attach --model my-agent --eval-tag owasp_code=LLM01
> ```
>
> This attaches all evaluations tagged with `owasp_code=LLM01` (prompt injection tests) in a single command. See [built-in evaluations](https://docs.switchagents.ai/switch-trust-cli/reference/builtin-evaluations.md) for all available tests and tags.

**5. Run evaluation**

Execute all attached tests:

```bash theme={null}
switch-trust eval run --model my-agent
```

`switch-trust eval` sends test prompts to your agent, judges the responses using LLM-as-judge, and scores reliability on a 0.0-1.0 scale.

Evaluations can take several minutes depending on the number of tests. Progress updates appear in the CLI, and a summary displays when complete. Results are saved to `eval_<timestamp>.json`, or `eval_<timestamp>.sarif` if you pass `--format sarif`.

> [!TIP]
>
> **Integrate with CI/CD.** Save eval results as build artifacts to prove agent reliability before deployment. [See CI/CD integration guide →](https://docs.switchagents.ai/switch-trust-cli/guides/ci-cd-integration.md)

## Read your score

* **0.8+** - Ready for production
* **0.6-0.8** - Needs improvement
* **\<0.6** - Not ready for production

**Next steps:**

> [card] [Interpret your results](https://docs.switchagents.ai/switch-trust-cli/eval/eval-results.md)
>
> Understand score breakdowns and track improvement over time

> [card] [How evaluation works](https://docs.switchagents.ai/switch-trust-cli/eval/how-evaluation-works.md)
>
> Learn the LLM-as-judge methodology and scoring calculation

> [card] [Scan agent code](https://docs.switchagents.ai/switch-trust-cli/scan/getting-started.md)
>
> Find agent code issues before deployment with Switch Trust Scan
