Skip to main content
Switch Trust

PyPI version Python Documentation Website

Ship AI agents with confidence

One CLI to analyze agent code and runtime behavior, any framework.

Switch Trust Scan Switch Trust Eval
Command switch-trust scan switch-trust eval
What AI-powered security analysis of your agent's code (whitebox testing) Runtime behavioral evaluation with adversarial prompts (blackbox testing)
Output Security findings mapped to OWASP top 10 with CVSS severity scores Evaluation scores (0-100%) mapped to OWASP top 10

Why Switch Trust?

  • AI-powered analysis — Contextual code understanding, not just pattern matching
  • OWASP ASI mapped — Findings aligned to Top 10 for Agentic Applications
  • 100% free — First results in minutes

Try it now - 5 minute Quickstart

Requirements

  • Python 3.11 or later
  • OpenGrep (required for Switch Trust Scan)
  • A running agent accessible via HTTP (required for Switch Trust Eval)

Supported frameworks: Google ADK, Google GenAI, Anthropic, OpenAI, OpenAI Agents SDK, LangGraph, CrewAI, AutoGen, HuggingFace Transformers, HuggingFace smolagents

Step 1: Install Switch Trust

Using a virtual environment is recommended to avoid dependency conflicts:

python3 -m venv .venv
source .venv/bin/activate

Install Switch Trust CLI:

pip install switch-trust-cli
Optional full extra for toxicity, local & garak evaluations

Some evaluations rely on heavy ML backends that are kept out of the default install: toxicity detection, local evaluation of models retrieved from Huggingface, and garak probes and detectors. Install them with the optional full extra when you need those features:

pip install "switch-trust-cli[full]"

Step 2: Configure your LLM provider

Switch Trust uses AI to analyze agent code and score reliability. Run the interactive setup:

switch-trust init

You'll be prompted to select a provider (Gemini, OpenAI, Anthropic, or LiteLLM), choose a model, and enter your API key.

Where to get API keys

Run into issues? See installation troubleshooting

Step 3: Try the example agents

To demonstrate the CLIs capabilities, we've shipped this tool with two example agents. You can get them here.

Both agents work with both switch-trust scan and switch-trust eval:

Agent Framework Description
weather_agent Google ADK Weather assistant that looks up conditions for cities. Should refuse off-topic requests.
bookstore_agent OpenAI Agents SDK Customer support assistant for an online bookstore. Searches books, checks orders, and processes returns.

The included examples/config.json has both agents configured with builtin evaluations (OWASP LLM01–LLM09, PII, secrets) and custom tests.


switch-trust scan finds security issues in the code without running the agent. We'll scan the bookstore agent to see what issues Switch Trust can find:

switch-trust scan examples/bookstore_agent/
Scan results showing security findings

Example: Scan found 2 security issues - High severity missing authentication and Medium severity unbounded execution loop


switch-trust eval tests runtime behavior, so the agent needs to be running. Start the bookstore agent:

# Start the bookstore agent (serves on http://localhost:8010)
uvx --with openai-agents,fastapi --from uvicorn uvicorn examples.bookstore_agent.agent:app --port 8010 --host 0.0.0.0

In a new terminal, run evaluations:

switch-trust eval run --model model-bookstore-agent --config examples/config.json

Step 4: Test your own agents

See our documentation to configure, scan and evaluate your agents:

Ship with confidence. Validate behavior, catch risks, prove readiness.

Commands

init

Setup wizard that configures Switch Trust for first use. Creates the ~/.switch-trust directory with a .env file (LLM provider, API key, runtime settings) and a config.json skeleton.

Runs automatically on first use in non-CI environments. You can re-run it at any time to reconfigure.

switch-trust init

scan

AI-powered security analysis of agent source code. Finds vulnerabilities, misconfigurations, and OWASP Top 10 violations.

# Scan a directory
switch-trust scan /path/to/agent/code

# Scan a single file
switch-trust scan agent.py

# Specify output file
switch-trust scan /path/to/code --output results.json

Full scan guide

eval

Test agent behavior at runtime. Get a evaluation score proving production-readiness.

# List all available configuration
switch-trust eval evaluations list

# List your agents and models
switch-trust eval models list

# Attach an evalation to your agent
switch-trust eval model-evaluations attach \
  --model my-agent \
  --eval eval-llm01-adversarial

# Run all evaluations for an agent
switch-trust eval run --model my-agent

The switch-trust eval command requires configuration. See Configuration to:

  1. Define your models (agents to test)
  2. View available evaluations
  3. Attach evaluations to models

Full eval guide

Documentation

Complete guides and reference:

Data privacy

Switch Trust runs on your machine, but several features can call external LLM providers. This can be configured via GENERATOR_MODEL (located in ~/.switch-trust/.env, created by switch-trust init). You can set this to a remote managed LLM (i.e. gemini, openai, anthropic) or a locally hosted LLM (i.e. litellm or ollama).

Read more.

Telemetry

Switch Trust CLI collects anonymous usage analytics to help us understand how the tool is used and improve it. Telemetry is opt-in — you are asked for consent during switch-trust init, and no data is sent without your explicit agreement.

What we collect:

Data Example Purpose
Command name scan, eval run Understand which features are used
CLI version 1.1.1 Track adoption of new releases
Execution duration 12.3s Identify performance issues
Error type (on crash) ConnectionError Prioritize bug fixes
CI environment flag true / false Understand CI vs interactive usage
Anonymous client ID a1b2c3d4-... (random UUID) Count unique installations

What we never collect: source code, file paths, prompts, API keys, model outputs, usernames, hostnames, IP addresses, or any personally identifiable information.

Opting out: Set SWITCH_TRUST_TELEMETRY_CONSENT=false in ~/.switch-trust/.env, or select "N" when prompted during switch-trust init. You can change this at any time.

Contributing

See CONTRIBUTING.md for details.

License

Free to use - full license.

Contact

Metadata

Release files for switch-trust-cli 1.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for switch-trust-cli 1.7.0
File Size Uploaded
switch_trust_cli-1.7.0.tar.gz 1.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for switch-trust-cli 1.7.0
File Interpreter ABI Platform
switch_trust_cli-1.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 3.6 MB

Release files / switch_trust_cli-1.7.0.tar.gz

Download URL switch_trust_cli-1.7.0.tar.gz
Size 1.8 MB
Tags Source
SHA-256 checksum
How to use checksums
59b8a21b050168827ae8648c222cf7f432ad60ebb5842c811f46abc904a5b22a
BLAKE2b-256 checksum
How to use checksums
4010347da49a8f1edf4e2ddb2a0d7ac4a20888c7f9435f21ad2dbe58f92b472c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release files / switch_trust_cli-1.7.0-py3-none-any.whl

Download URL switch_trust_cli-1.7.0-py3-none-any.whl
Size 1.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
1203d8e992bf6cd2793a669815311120aa6d8ecde22118c907ffd6e13855ede8
BLAKE2b-256 checksum
How to use checksums
f1daba6a91fd62ec20540641947838c557c564d631334251eb9bc6d8c535e4db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release history Release notifications | RSS feed

1.7.1

2 release files

This release

1.7.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page