Part of the AgentSwarms docs.
The account whose email matches ADMIN_EMAIL is the instance's bootstrap
superadmin — sign in with it and open Admin → IAM (/admin/iam) to
manage everything else.
Claim it before the instance is reachable. The bootstrap account is identified by an email address, and an address is a claim rather than a credential. Public signup is on by default, so whoever registers that address first becomes superadmin — and the IAM page then refuses to demote it. The server requires the address to be confirmed, so make sure Supabase is verifying email (Auth → Providers → Email → Confirm email); with confirmations off, every address is marked confirmed at signup and that defence does nothing. See DEPLOYMENT.md → Bootstrap the operator.
It manages:
-
Users — invite by email (Supabase sends the invitation) or create accounts with a temporary password; ban/unban; delete; promote additional superadmins. The bootstrap superadmin can never be demoted, and the last superadmin is protected — including against two demotions arriving at the same moment, which both used to pass a count taken before the delete. The count that decides is taken after it now, and a demotion that turns out to have removed the last superadmin is put back (R246). This matters more here than anywhere else: granting the role is itself superadmin-gated, so a deployment with none has nobody left who can make one.
-
Groups — organize users; model rules and resource shares can target a whole group at once, and so can a customer key.
-
Keys — under Settings, the credential encryption key and its re-encrypt sweep, and Customer keys: every user's stored credentials are under their own key, and a customer key (held by the app, or in the customer's own KMS) wraps the keys of the users and groups assigned to it. A user in groups assigned to two customer keys is refused a save until assigned directly; a change to a group's members, here or over SCIM, moves the users it touches. The documents chat generates and the copies of uploaded datasets are under the same user keys, and Encrypt stored files puts those stored before under them. A key in AWS KMS also has the store encrypt its members' lakehouse files, model artifacts and what their runs stage under it when the lakehouse is on S3, and Re-encrypt lakehouse files puts files written before under the right key. See Customer keys and user keys, Stored files and Lakehouse files.
-
Provisioning — with SCIM 2.0 the identity provider creates users before they sign in, deactivates them when they leave, and keeps groups in step; see Users and groups pushed from the IdP.
-
Model access — allow rules on a user or group define what they may call (patterns:
*,openai/*, or an exact model id; the allowed set is the union of all applicable rules). What no rules means is an instance policy, set under Settings → Default model access:- Allow by default (the default) — a user with no rules is unrestricted.
- Deny by default — a user with no rules can call no models until a rule allow-lists them. Superadmins bypass deny mode, so the people who administer the allow-lists cannot lock themselves out. Flipping the toggle changes nothing for anyone who already has rules.
Enforced server-side on every LLM call — playground, saved agents, swarm nodes, the API, and public embeds, which run their owner's stored model for anonymous visitors and are checked against the owner's effective rules on every request — and reflected in the model pickers.
-
Shares — grant users or groups read-only access to any of fourteen resource types: knowledge base, SQL data table, secret, BI dashboard, semantic model, catalog source, integration, LLM key/credential, database & warehouse connection, app source, AI analyst, lakehouse schema, ML model or ontology; recipients' agents can search/query them but never modify them. (A Sheets workbook is shared from the workbook itself, to view or to edit: see Sheets → Sharing.) A shared connection runs as its OWNER: the owner's credential is decrypted server-side and the grantee's queries run against the owner's warehouse, so a grantee gains the use of a connection without ever receiving its credential — see Data sources. The one use refused is an ETL pipeline, whose code runs with every connection's credential in its environment (R419, VA-2026-10-25-45). A shared secret resolves only toward the hosts its owner lists under Secrets → Allowed hosts, only in a credential field, and never into code the grantee runs (VA-2026-10-25-30); the share dialog warns when a secret allows no host, since sharing it would then give nothing usable. An ontology grant gives its published version: the grantee explores, asks, proposes and requests actions as themselves, and its row filter (
Type.property) and mask (Customer.email) apply in every query — see Enterprise Ontology. Dataset and dashboard grants also take a row filter (only rows whose column matches the listed values) and a column mask (named columns are removed entirely, not blanked). Both are enforced inside the database — a grantee cannot read a shared dataset's raw rows at all; every read goes through a security-definer function that applies the restriction first, so masks hold whether the data is reached through the SQL workbench, an agent tool, or the REST API. A dataset's column list follows the mask too: a grantee cannot read the dataset's own row when a mask applies, since its column list is the owner's, and lists it throughshared_datasets()andshared_dataset_columns(), which leave the masked columns out (R491). So does the grant itself, whose mask is a list of column names: a grantee reads their own grant directly only when it masks nothing. A grant with a mask is read by superadmins (the IAM console) and by the server, which applies it, and the grantee's own session learns frommy_resource_grants()its row filter and whether it masks, never which columns (R492). A semantic model's or an ontology's masked fields are part of the definition its grantee reads, so the app names them there on purpose ("hidden fields: …"); the mask hides their values. A mask matches a column without regard to case or surrounding spaces. When several grants apply to the same person the effect is union of access: row filters combine (any allowing grant admits the row) and column masks intersect (a column is hidden only when every grant hides it), so holding two grants never leaves someone with less access than one alone.One deliberate exception to "grants only add": knowledge-base documents synced from a connected service (Google Drive, Notion, SharePoint, Dropbox) can carry a per-source access scope — Only me, or Match source permissions (sharing mirrored per document from the provider). That scope filters retrieval inside a granted knowledge base and belongs to the source's owner, not to the grant. See Knowledge bases.
Everything above is deny-by-default: every resource table is owner-only under row-level security, grants are strictly additive read-only SELECT policies, and the headless execution paths (swarms, schedulers, embeds) re-derive the same grant set explicitly rather than trusting the caller. The deliberate exceptions are the public demo samples and public metadata (profiles, the AI model catalog).
-
Settings — flip the instance to invite-only: public self-signup (including OAuth) is rejected at the database level, while invited, admin-created, and SSO-provisioned users still get in.
-
SSO — connect enterprise identity providers (Okta, Auth0, Microsoft Entra ID, or any SAML 2.0 IdP) so users sign in with their work account. The tab shows the two values to paste into your IdP's SAML app (ACS URL and Entity ID), takes the IdP's metadata URL/XML plus the email domains it covers, and adds a "Continue with single sign-on" flow to the login page. Optionally require SSO, hiding email/password and social login (
/login?native=1remains as a superadmin escape hatch).SAML SSO must be enabled on your Supabase project first: hosted Supabase → Authentication → Sign In / Up → SSO (SAML 2.0) — a Pro-plan feature; self-hosted GoTrue → set
GOTRUE_SAML_ENABLED=truewith aGOTRUE_SAML_PRIVATE_KEY. The SSO tab detects and explains this if it's not enabled yet.
Every server function and API route first asks whose token it was handed, through
src/utils/callerLookup.server.ts. The answer is one of two kinds:
| What happened | What the caller gets |
|---|---|
The token was refused. It was malformed or wrongly signed, its session is gone, or its user is unknown (a 4xx from the auth server, or AuthInvalidJwtError from reading the JWT) |
401, with the message that route has always given ("Unauthorized", "Not signed in", "Invalid session") |
| The check itself failed. A network error, a 429, a 5xx, or a reply that would not parse | 503, "Could not check who you are just now (…). Nothing was done; try again in a moment." |
Before R297 the second case was reported as the first, so a signed-in person was told they were not.
Agent Chat had the sharper version. A user it could not identify skips the IAM model rules and the
budget cap, so a failed check ran that turn ungoverned on a good token. Now it answers 503 instead.
callerLookupFailure.test.ts holds every auth.getUser and auth.getClaims in src to the helper,
or to a // caller-lookup: comment at the site that says why it need not.
In the browser, the signed-in user is read from the session the browser already holds
(src/lib/sessionUser.ts), not asked of the auth server. The server checks the token on every request
anyway. Before R298, one failed request to the auth server had three effects: the skill editor said "Not
signed in" on Save, "Duplicate to my skills" did nothing, and the SQL engine could read a dataset shared
with you as empty.
Every walkthrough below uses the tabs on Admin → IAM: Users, Groups, Access, Attributes, Budgets, SSO and Settings.
You have a group of external contractors who should build and test agents but never run the frontier models the rest of the company pays for.
- Settings → Default model access → Deny by default. From now on a user with no rules can call no models at all. Nobody who already has rules is affected, and superadmins bypass deny mode, so you cannot lock yourself out.
- Groups → create Contractors and add the accounts.
- Access → add a model rule on the Contractors group. A rule is a
pattern:
*, a provider prefix such asopenai/*, or one exact model id. Grant the single model you are willing to pay for.
The rule is enforced on the server for every call the contractor's work makes — the playground, saved agents, swarm nodes, the API, and a public embed of their agent, which runs its owner's stored model and is re-checked against the owner's rules on every anonymous request. The model pickers only show what the rules allow, so the restriction is visible before it is enforced.
A data engineer owns the production Postgres connection and the whole analytics group needs to query it from agents and the SQL workbench.
- The owner creates the connection once under Integrations → Data sources and tests it.
- On Admin → IAM → Access the owner (or a superadmin) shares the connection with the Analytics group, read-only.
- Each analyst's agents can now query it. The credential never leaves the server: a shared connection runs as its owner — the owner's stored secret is decrypted server-side and the grantee's queries run against the owner's warehouse. Revoking the share stops the access; nothing needs to be rotated, because nothing was handed out.
One sales table, three regions, and each regional lead may see only their
region — and never the margin column.
- Share the dataset with each lead (or with a per-region group) on
Access, adding a row filter on
regionand a column mask that removesmargin. - For a single grant that adapts to whoever is looking, set each viewer's region on the Attributes tab and reference the attribute in the filter: one grant, per-viewer rows.
Both restrictions are enforced inside the database: a grantee cannot read
the raw table at all, every read goes through a security-definer function that
applies the filter and mask first, so the result is the same through the SQL
workbench, an agent tool or the REST API. Nor can a lead read the mask off
their own grant: it names margin, so their grant is served to them without
it. When someone holds two grants, rows
combine (any allowing grant admits the row) and masks intersect (a column is
hidden only when every grant hides it) — a second grant never reduces access.
Security wants every login to go through the corporate identity provider.
- Enable SAML on your Supabase project first (hosted: Authentication →
Sign In / Up → SSO (SAML 2.0); self-hosted GoTrue:
GOTRUE_SAML_ENABLEDand a private key). The SSO tab tells you if this is still missing. - On SSO, copy the ACS URL and Entity ID into the IdP's SAML app, then paste the IdP's metadata URL or XML and list the email domains it covers. The login page gains Continue with single sign-on.
- Once a superadmin has signed in through the IdP successfully, turn on
Require SSO. Email/password and social login disappear from the login
page;
/login?native=1stays as the superadmin escape hatch, so a broken IdP cannot lock the instance.
SSO-provisioned users get in even when the instance is invite-only (Settings), so you can close public signup at the same time.
SSO lets people sign in; it does not create them before they do, deactivate them when they leave, or keep groups in step. SCIM 2.0 provisioning does: the identity provider pushes users and groups to the platform as they change in the directory, and an offboarded person is deactivated here the same minute.
- On SSO → Provisioning (SCIM), mint a provisioning token with a label (one per IdP application). The token is shown once; only its hash is kept. A double Enter in the label field mints one token: the key and the Mint token button share one in-flight guard.
- In the IdP, enable provisioning on the SAML application and give it the
base URL
https://<your host>/api/scim/v2with the token as the bearer token. Okta: Provisioning → Integration → SCIM connector base URL, unique identifieruserName, authentication HTTP Header. Microsoft Entra ID: Provisioning → Admin credentials → Tenant URL + Secret token. Both test the connection immediately. - Assign users and groups to the application. What the IdP does from then on and what happens here:
| The IdP sends | Here |
|---|---|
POST /Users |
An account is created, confirmed, and passes the invite-only gate; first and last name land on the profile |
PATCH /Users/{id} with active: false |
The account is banned (the same ban the IAM page applies) — every session and API key stops working |
PATCH /Users/{id} with active: true |
The ban is lifted |
PUT / PATCH names, userName, externalId |
The profile and the sign-in email follow |
DELETE /Users/{id} |
The account is deleted (Okta never sends this; Entra does for a hard delete) |
POST /Groups, PATCH members |
An IAM group is created or its members changed — grants and model rules on the group apply at once |
GET /Users?filter=userName eq "…" |
The lookup IdPs do before creating, so a user who already exists is matched, not duplicated |
Three rules hold whatever the IdP says. A superadmin cannot be deactivated
or deleted over SCIM — the request is refused with a 403 the IdP shows its
admin, so a misconfigured push or a leaked token cannot take the last way in;
demote the account in IAM first. Every SCIM write is an audit event under
the token's label (scim:<label>), so the trail says the IdP did it, not a
person. And a read that fails is a 503, never an answer: the IdP acts on
"no members", "no such group", "no such user", "not a user" and "invalid
token", so none of them is ever said about a read that did not happen. Okta
and Entra retry a 503. Before R248 a failed member read made a group look
empty, and a push removing someone from it removed no one and returned 200.
The endpoint supports filtering by userName, externalId, emails.value,
displayName and id with eq, PATCH in both the Okta (path-less) and
Entra (path) dialects, and paging with startIndex and count. It declares
bulk, sorting and ETags unsupported in ServiceProviderConfig rather than
half-implementing them. Requests are rate limited across all tokens
(SCIM_RATE_LIMIT_PER_MIN, default 300). Revoke a token on the same tab; the
IdP's next request gets a 401 and the attempt is audited.