← Blog

Who may start what: SSO, roles, groups, and why agents should act as a person

Identity for agent platforms: keep sign-in in your identity provider, map groups to roles on the resources agents touch, and make every agent action trace back to a person instead of a shared service account.

Most teams add coding agents the same way they once added CI: someone creates a token, pastes it into a config file, and the agent uses it for everything. It works on day one. A few months later nobody can say who that token belongs to, what it is allowed to do, or what happens to it when the person who created it leaves.

Agents make this worse than CI did, because an agent decides what to do next. A CI job runs the steps in a file you reviewed. An agent runs whatever it concludes it should run. So the question “who may start what” deserves an answer before the number of agents grows, not after.

This post covers the pieces: where sign-in should live, how roles and groups should map onto the things agents create, why an agent should act as a specific person, and where machine credentials still make sense.

Authentication and authorization are different questions

Two questions, often blurred:

  • Authentication: who is this? A person signing in, an agent acting for someone, a CI job.
  • Authorization: what may they do here? Start a sandbox, read another person’s run, change the network policy.

Single sign-on answers the first one. It does not answer the second. A platform where everyone who can sign in through SSO is an administrator has good authentication and no authorization. Design both.

Keep sign-in in the identity provider

If your company has an identity provider (Microsoft Entra ID, Okta, Google Workspace or similar), the platform that runs your agents should defer to it. The two common protocols:

  • SAML 2.0: the identity provider sends a signed XML assertion to the service. Mature and supported nearly everywhere, verbose to debug.
  • OpenID Connect: an identity layer on top of OAuth 2.0, with a signed JSON Web Token as the ID token. Simpler to work with, and the natural fit for command line tools and agents that sign in through a browser.

Either is fine. What matters is the consequence: multi-factor rules, device checks, session length and, most of all, offboarding are enforced in one place. When someone leaves and is disabled in the directory, they cannot sign in to start new work.

Sign-in alone does not remove an account that already exists in the service, though. That is what directory provisioning is for. SCIM (RFC 7643 and RFC 7644) lets the identity provider create, update and deactivate users and groups in the service as the directory changes. Without it, a departed person’s account may sit in the service until someone remembers to remove it.

Roles belong on resources, not only on the organization

A single organization-wide role (“admin” or “member”) is too coarse once several teams run agents. Useful questions are scoped to a thing:

  • May this person see the output of that sandbox?
  • May they stop someone else’s run?
  • May they start sandboxes from this template, or in this project?

A pattern that holds up well has a small number of roles applied per resource, plus a default owner:

Role Typical rights on a resource
Viewer See it and its output
User Use it (run commands, start from a template)
Editor Change it
Manager Change it and decide who else has access

Two rules make this practical:

  1. Whoever starts something owns it. The person (or the person behind the agent) who starts a sandbox should be its manager by default. That gives every resource an accountable owner from the first second.
  2. Access requests are approved by someone else. If people can ask for access to a project or a sandbox, the approver should never be the requester. Self-approval turns a control into a formality.

Map groups, not people

Assigning roles to individual users does not survive a reorganization. Assign them to groups that come from the directory: payments-eng gets Editor on the payments project, security gets Viewer on everything. When someone moves team, the directory changes their groups, and their access in the platform follows.

Check three things when you set this up:

  • What happens on first sign-in. Just-in-time creation of accounts on first SSO login is convenient. Decide what role a brand new account gets. The safe answer is the least privileged one, or none until a group mapping applies.
  • Who can change mappings. A person who can edit the group-to-role mapping can grant themselves anything. Treat that permission as an administrator permission and log every change.
  • What a removed group does. When a group is removed from someone in the directory, their roles from that group should go with it, not linger.

Why an agent should act as a person

This is the part specific to agents. There are two ways to give an agent access:

  • A shared service account. One identity for “the agent”, used by everyone who runs it.
  • Delegated access. The agent signs in as, or on behalf of, the person running it, and gets that person’s rights and no more.

The shared account fails in three predictable ways:

  • Privilege drift. The service account needs the union of everything anyone ever asked the agent to do. It ends up more powerful than any single person using it.
  • Lost accountability. The audit log says “agent-bot started 400 sandboxes”. It does not say who asked for any of them.
  • Offboarding gaps. Disabling a person in the directory does nothing to the shared account they used every day.

Delegation fixes all three. The agent can do only what the person can do. The log names the person. Disabling the person stops the agent they were driving. If an agent needs more access for a task, a person with that access has to be involved, which is usually what you want anyway.

Pair delegation with human approvals for the actions that matter, and you get a clear chain: the agent proposed it, this person was running the agent, that person approved it.

Where machine credentials still belong

Not every caller is a person at a keyboard. A nightly CI job, a webhook handler or a scheduled cleanup has no one behind it. For those, use API keys that are:

  • Scoped to the permissions the job needs, nothing broader.
  • Short-lived, with an expiry and a rotation plan.
  • Owned by a named person or team, so the key has someone to ask about it.

The rule of thumb: an agent working with a person uses that person’s identity; an automated job with no person behind it uses a scoped key. Our post on scoping API keys for agents and CI covers the second case in detail.

A useful side effect: some reads only make sense for a person. “Show me what I did” has no answer for an API key, because a key has no account of its own. A platform that distinguishes the two can refuse those calls for keys instead of guessing.

A short checklist

  • Sign-in goes through your identity provider over SAML or OIDC, with multi-factor enforced there.
  • Directory provisioning (SCIM) or a regular review removes accounts that should no longer exist.
  • Roles are granted per resource, to groups, from a small fixed set.
  • The starter of a sandbox owns it by default.
  • Access requests cannot be approved by the requester.
  • New accounts from just-in-time provisioning start with the least access.
  • Changes to roles and group mappings are written to the audit log.
  • Agents act as the person running them; scoped keys are only for jobs with no person behind them.

How this works on Sandscale

On Sandscale, Team turns an account into an organization with members, roles and groups, and single sign-on over SAML or OpenID Connect with Microsoft Entra ID, Okta, Google Workspace or any standard identity provider (teams and SSO). Enterprise adds SCIM user provisioning, verified domains and custom roles. Passkeys and multi-factor sign-in are on every plan.

Roles are Viewer, User, Editor and Manager on each sandbox, template and project. Whoever starts a sandbox is its Manager, and a request for access is approved by someone other than the requester (roles). Agents such as Claude Code sign in through the same SSO, as the person running them, and act with that person’s own access, never more (SSO and SCIM). The full set of endpoints, including SSO group mappings, is in the API reference.

Run your agents in a box of their own

Each sandbox is a Firecracker microVM. Free includes 100 awake vCPU-hours a month.

Start free

Keep reading