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

# Discover your agents

> Scan your code repositories and cloud accounts to find every AI agent and the resources behind them

Discovery finds the AI agents you already have — in your code and in your cloud. Connect a data
source and Switch Trust scans it, then builds an inventory of every agent it finds, each with its
highest severity and total issue count, along with the models, tools, and MCP servers behind it.

Switch Trust scans the following kinds of data source:

* **Code repositories** — GitHub and GitLab. Switch Trust scans your source code for agents.
* **Cloud accounts** — AWS and GCP. Switch Trust scans your account for deployed AI resources.

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

> [!NOTE]
>
> **Before you start, you'll need:**
>
> * **For a code repository (GitHub or GitLab):** a repository with Python agent code, a Switch Trust
>   API key, and an API key for an LLM provider — Google Gemini, OpenAI, or Anthropic. The scanner
>   uses it to analyze your code, and Google Gemini has a free tier, so you can scan at no cost.
> * **For a cloud account (AWS or GCP):** write permissions in the account or project, so that the
>   required roles and resources can be created. No LLM key is needed.
>
> **Supported frameworks (code scans):** Google ADK, Google GenAI, Anthropic, OpenAI, OpenAI
> Agents SDK, LangGraph, CrewAI, AutoGen, HuggingFace Transformers, HuggingFace smolagents

> [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)

## Scan a code repository

Switch Trust scans the source code in your repository for AI agents and reports the models, tools, and MCP
servers behind them, along with any issues it finds. The scan runs inside your own CI, so there
is no credential to store in Switch Trust — you authenticate it with your Switch Trust API key.

### GitHub

The GitHub scan runs as a GitHub Action in your workflow.

**1. Get your Switch Trust API key**

In [Switch Trust](https://app.switchagents.ai), go to **Settings**, then **API keys**, and
create a key and give it the **Ingest only** role, the least-privilege role that can upload
scan results. **Editor** or higher also works. A **Viewer** key can download the scanner but can't upload results, so the scan fails
with a permission error.

> [!NOTE]
>
> Copy your key immediately when created — it is shown only once. Keep it somewhere secure and
> never commit it to version control. In the next step you'll add it as an encrypted GitHub
> Actions secret rather than pasting it into the workflow file.

**2. Add the scan workflow to your repository**

Create `.github/workflows/switch-trust-inventory-scan.yml` with:

```yaml theme={null}
name: Flint AI inventory scan
on:
  workflow_dispatch:
  schedule:
    - cron: "0 10 * * 1-5"
jobs:
  inventory-scan:
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v5
      - name: Run Flint AI inventory scan
        uses: sandbox-quantum/switch-trust-codescan-action@v7
        with:
          switch_trust_instance: https://app.switchagents.ai
          switch_trust_token: ${{ secrets.SWITCH_TRUST_TOKEN }}
          llm_model: google:gemini-3.5-flash
          llm_api_key: ${{ secrets.LLM_API_KEY }}
```

The workflow reads two secrets. In your repository, go to **Settings**, then
**Secrets and variables**, then **Actions**, and add:

* `SWITCH_TRUST_TOKEN` — the Switch Trust API key from the previous step.
* `LLM_API_KEY` — your LLM provider API key.

> [accordion] Choose a model
>
> `llm_model` takes a `provider:model` value. The provider prefix tells the scanner
> which API key it is using:
>
> ```
> anthropic:claude-opus-4-8       # Anthropic
> openai:gpt-5.4                   # OpenAI
> google:gemini-3.5-flash          # Google Gemini
> ```
>
> Whichever provider you name, its key goes in the `LLM_API_KEY` secret.

> [accordion] What the scan does
>
> The Action scans your repository for AI agents, finds security issues and
> misconfigurations, and sends results to your workspace. It needs only read access to
> your code and does not modify your repository. The `schedule` in the workflow keeps
> your inventory current as your code changes.

> [accordion] Share the secrets across repositories
>
> Scanning more than one repository? Define `SWITCH_TRUST_TOKEN` and `LLM_API_KEY` at the
> organization level so every repository shares them.

> [accordion] Instance URL doesn't need to be secret
>
> Your instance URL is not sensitive, so `switch_trust_instance` is a plain value, not a
> secret. `https://app.switchagents.ai` is the standard instance; other environments exist
> and use the same input.

**3. Run the scan and see your agents**

The workflow runs on the schedule in the file. To start it manually at any time: open the
**Actions** tab in your repository, select **Flint AI inventory scan**, then
**Run workflow**. The scan step takes a minute or two.

To confirm results landed, go to **Settings**, then **Data sources** in Switch Trust.
Select **GitHub** and expand the **Scans** tab — it lists each connected repository
with the time of its most recent scan. A fresh timestamp means your results arrived.

> [!WARNING]
>
> Check the **Scans** tab, not the **Connected** status. The status indicator does not
> yet reflect a live connection check, so it can read Connected before your first scan
> has run.

Now open the **Agents** page. Your discovered agents appear in the inventory, each with
its highest severity and total issue count.

> [!TIP]
>
> **Multi-repo support:** Connect more repositories to see all your agents in one
> workspace. Each agent traces back to its source repository and file path.

For the full reference, including the Setup tab and Scans tab, see the
[GitHub reference](https://docs.switchagents.ai/switch-trust/admin/data-sources/github.md).

### GitLab

The GitLab scan runs as a CI/CD component in your pipeline. GitLab is a separate data source
from GitHub, so agents found on each are tracked and shown apart.

**1. Add the CI/CD component to your pipeline**

Include [`switch-trust-codescan-workflow`](https://gitlab.com/explore/catalog/sandboxaq/switch-trust-codescan-workflow)
from the GitLab CI/CD Catalog in the `.gitlab-ci.yml` for your project:

```yaml theme={null}
include:
  - component: $CI_SERVER_FQDN/sandboxaq/switch-trust-codescan-workflow/inventory-scan@2.0.1
    inputs:
      switch_trust_instance: https://app.switchagents.ai
      switch_trust_token: $SWITCH_TRUST_TOKEN
      llm_model: anthropic:claude-opus-4-8
      llm_api_key: $ANTHROPIC_API_KEY
```

A GitLab component cannot read your CI/CD variables on its own, so pass `$VARIABLE`
references explicitly.

**2. Add your secrets as masked CI/CD variables**

In your project or group, go to **Settings**, then **CI/CD**, then **Variables**, and add
masked variables:

* `SWITCH_TRUST_TOKEN` — your Switch Trust API key, from **Settings**, then **API keys** in Switch Trust. Give the key the **Ingest only** role.
* Your LLM provider key — named for the provider (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, or
  `GOOGLE_API_KEY`) to match your `llm_model`.

Define them at the group level to share across projects.

**3. Run the pipeline and confirm results**

Run the pipeline. To confirm results landed, go to **Settings**, then **Data sources** in
Switch Trust, select **GitLab**, and expand the **Scans** tab — a fresh timestamp means your
results arrived.

For the full setup, including restricting the scan to your default branch or targeting a specific
runner, see the [GitLab reference](https://docs.switchagents.ai/switch-trust/admin/data-sources/gitlab.md).

## Scan a cloud account

Switch Trust reads your cloud account and discovers the AI resources deployed in it. It connects
read-only through short-lived or assumed credentials, so there are no long-lived keys to store.
Connecting a cloud account requires write permissions in it, so that the required roles and
resources can be created.

### AWS

Switch Trust assumes a read-only IAM role in your account and scans it across active regions,
discovering Amazon Bedrock models and agents, Amazon Lex bots, and Amazon SageMaker models.

**1. Deploy the read-only role**

In [Switch Trust](https://app.switchagents.ai), go to **Settings**, then **Data sources**, select
**AWS**, and open the **Setup** tab. Download the CloudFormation template and deploy it in
your AWS account to create the read-only role `SwitchTrustReadOnlyAccessRole`. IAM roles are
global, so one stack covers every region.

**2. Give Switch Trust the role ARN**

In the AWS **IAM** console, open the `SwitchTrustReadOnlyAccessRole` role and copy its
**Amazon Resource Name (ARN)**. Back on the **Setup** tab, paste it into **IAM role ARN**
and select **Connect**.

**3. Scan the account**

Select **Test connection** to confirm Switch Trust can assume the role, then **Start scan**.
Watch progress on the **Scans** tab.

For the full CloudFormation walkthrough, see the
[AWS reference](https://docs.switchagents.ai/switch-trust/admin/data-sources/aws.md).

### GCP

Switch Trust reads your project through Workload Identity Federation, which issues short-lived
credentials, and scans each Vertex AI location, discovering your Vertex AI models and agents.

**1. Set up Workload Identity Federation**

In [Switch Trust](https://app.switchagents.ai), go to **Settings**, then **Data sources**, select
**GCP**, and open the **Setup** tab. Download the Terraform template and apply it in Google
Cloud Shell to create a Workload Identity pool and provider and a read-only service account.

**2. Enter the Terraform outputs**

Copy the values from the Terraform output into the matching **Setup** fields: **Project ID**
and **Project number**, **Service account email**, and **WIF pool ID** and **WIF provider ID**.

**3. Test and add the project**

Select **Test connection** to confirm the federation works, then **Add project**. Watch
progress on the **Scans** tab.

For the full Terraform walkthrough, see the
[GCP reference](https://docs.switchagents.ai/switch-trust/admin/data-sources/gcp.md).

## Next steps

> [card] [Read your discovery results](https://docs.switchagents.ai/switch-trust/discovery/results.md)
>
> Work out what needs attention first, whether a finding is real, and when it's resolved

> [card] [Connect more data sources](https://docs.switchagents.ai/switch-trust/admin/data-sources.md)
>
> Manage your GitHub, GitLab, AWS, and GCP connections in one place

> [card] [Monitor and protect](https://docs.switchagents.ai/switch-trust/getting-started/runtime.md)
>
> Install the SDK to monitor sessions and configure runtime protection
