- 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.
Switch Trust CLI on GitHub
Source code, example agents, and issue tracking
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.
Where to get an LLM provider key
Where to get an LLM provider key
- Google Gemini: aistudio.google.com/apikey (free tier available)
- OpenAI: platform.openai.com/api-keys
- Anthropic: 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, go to Settings, then API Keys, and
create a key and give it the Editor role, the least-privilege role that can upload scan
results. A Viewer key can download the scanner but can’t upload results, so the scan fails
with a permission error.
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 The workflow reads two secrets. In your repository, go to Settings, then
Secrets and variables, then Actions, and add:
Whichever provider you name, its key goes in the
.github/workflows/switch-trust-inventory-scan.yml with:SWITCH_TRUST_TOKEN— the Switch Trust API key from the previous step.LLM_API_KEY— your LLM provider API key.
Choose a model
Choose a model
llm_model takes a provider:model value. The provider prefix tells the scanner
which API key it is using:LLM_API_KEY secret.What the scan does
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.Instance URL doesn't need to be secret
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.Now open the Agents page. Your discovered agents appear in the inventory, each with
its highest severity and total issue count.
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 A GitLab component cannot read your CI/CD variables on its own, so pass
switch-trust-codescan-workflow
from the GitLab CI/CD Catalog in the .gitlab-ci.yml for your project:$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 Editor role.- Your LLM provider key — named for the provider (
ANTHROPIC_API_KEY,OPENAI_API_KEY, orGOOGLE_API_KEY) to match yourllm_model.
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.
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, 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.
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, 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.
Next steps
Read your discovery results
Work out what needs attention first, whether a finding is real, and when it’s resolved
Connect more data sources
Manage your GitHub, GitLab, AWS, and GCP connections in one place
Monitor and protect
Install the SDK to monitor sessions and configure runtime protection

