Agents and trusted workloads
An agent is a workspace member that isn’t a person. It has its own credentials, it appears under its own name in logs and spend, and the workspace policy’s proxy settings apply to it. An agent lives in exactly one workspace.
Managing agents needs the workspace admin role.
Create an agent
Section titled “Create an agent”On the workspace’s Members page, switch the add form to Agent and enter a name. Or:
avant org agents create review-bot --workspace <workspace-id>Then give it a credential: a workspace key, or trust for its workload.
Option 1: a workspace key
Section titled “Option 1: a workspace key”Open the workspace’s Connect page and choose Generate key next to the agent. The key is shown once. Store it in your secret manager and set it on the agent:
ANTHROPIC_BASE_URL=https://proxy.avant.codesANTHROPIC_API_KEY=ws_<workspaceId>_<secret>Anyone with the key can act as the agent until you regenerate it. Regenerating invalidates the old key right away.
Option 2: trust its workload
Section titled “Option 2: trust its workload”If the agent runs somewhere that issues OIDC tokens, Avant can trust that identity directly. The workload trades its own token for an Avant token that lasts an hour, so there’s no long-lived secret to store or leak.
A trusted workload is an issuer, an exact subject, an audience and, optionally, extra claims that must match. Avant reads the issuer’s keys through OIDC discovery.
Supported workloads
Section titled “Supported workloads”| Workload | Issuer | Subject |
|---|---|---|
| GitHub Actions | https://token.actions.githubusercontent.com |
repo:<owner>/<repo>:environment:<name>, …:ref:refs/heads/<branch> or …:ref:refs/tags/<tag> |
| Google Cloud service account | https://accounts.google.com |
The service account’s numeric unique ID, not its email |
| Kubernetes service account | Your cluster’s issuer URL | system:serviceaccount:<namespace>:<name> |
| Any OIDC issuer | Its https:// URL |
The exact sub, plus any claims you list |
The audience defaults to urn:avant:workspace:<workspace-id>. You can change it per workload.
Add it
Section titled “Add it”On the agent’s page, under Authentication, pick the workload, fill in its fields and choose Trust this workload. The page then shows a snippet for that workload type. From the CLI:
avant org agents workloads add review-bot --github acme/api --environment productionavant org agents workloads add review-bot --github acme/api --branch mainavant org agents workloads add review-bot \ --issuer https://gitlab.example.com --subject project_path:acme/api:ref_type:branch:ref:main \ --claim namespace_path=acmeExchange the token
Section titled “Exchange the token”The workload requests an OIDC token from its issuer with the trusted audience, then exchanges it (RFC 8693 token exchange):
curl -sSf https://proxy.avant.codes/token \ -d grant_type=urn:ietf:params:oauth:grant-type:token-exchange \ -d subject_token_type=urn:ietf:params:oauth:token-type:jwt \ --data-urlencode subject_token="$OIDC" \ -d audience=<workspace-id>The response holds access_token, token_type: "Bearer" and expires_in. Use access_token as the API key, the same way as a workspace key. Get a new one before it expires.
The subject token must not live longer than 24 hours. A refused exchange returns an OAuth error (invalid_grant, invalid_request, invalid_target) with an error_description.
GitHub Actions
Section titled “GitHub Actions”permissions: id-token: writesteps: - name: Get an Avant token run: | OIDC=$(curl -sSf -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \ "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=urn%3Aavant%3Aworkspace%3A<workspace-id>" | jq -r .value) AVANT_TOKEN=$(curl -sSf https://proxy.avant.codes/token \ -d grant_type=urn:ietf:params:oauth:grant-type:token-exchange \ -d subject_token_type=urn:ietf:params:oauth:token-type:jwt \ --data-urlencode subject_token="$OIDC" \ -d audience=<workspace-id> | jq -r .access_token) echo "::add-mask::$AVANT_TOKEN" echo "AVANT_TOKEN=$AVANT_TOKEN" >> "$GITHUB_ENV"Restrict the trusted workload to an environment, branch or tag. Trusting a whole repository would let any workflow run in it act as the agent.
Google Cloud
Section titled “Google Cloud”On Cloud Run, GCE or GKE with Workload Identity, ask the metadata server for an ID token:
OIDC=$(curl -sSf -H "Metadata-Flavor: Google" \ "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/identity?audience=urn%3Aavant%3Aworkspace%3A<workspace-id>&format=full")Then exchange it as above.
Kubernetes
Section titled “Kubernetes”Mount a projected service account token with the audience, then exchange the file’s contents:
volumes: - name: avant-token projected: sources: - serviceAccountToken: audience: urn:avant:workspace:<workspace-id> expirationSeconds: 3600 path: tokenThe cluster’s issuer must be reachable over HTTPS with OIDC discovery. Managed clusters (GKE, EKS, AKS) publish one.
Auth mode
Section titled “Auth mode”Each agent has its own auth mode:
| Mode | Accepts |
|---|---|
key |
Only the workspace key |
key_and_token |
Both. Use this while you move over. |
token |
Only exchanged tokens. Deletes the key. |
avant org agents auth-mode review-bot tokenAn exchange for an agent in key mode is refused.
Remove trust or move an agent
Section titled “Remove trust or move an agent”avant org agents workloads list review-botavant org agents workloads remove review-bot <id>avant org agents move review-bot <other-workspace-id>Removing a trusted workload stops its tokens from working on their next request. Moving an agent revokes its key and trusted workloads in the old workspace, so set its authentication up again in the new one.