Loomup Docs
Guide /docs/agent-auth Read Markdown

Loomup agent authentication

Loomup supports the auth.md user-claimed service_auth flow. An agent initiates registration; a signed-in workspace owner approves exact existing projects and permissions before any customer access is available. Names and email hints are not proof of identity. Anonymous access and external identity assertions are not supported.

Discovery

Use https://tryloomup.com/.well-known/oauth-protected-resource and https://tryloomup.com/.well-known/oauth-authorization-server for endpoint metadata. The authorization server and API resource are https://tryloomup.com.

Register

POST /agent/identity with JSON:

json
{"type":"service_auth","login_hint":"owner@example.com","agent_name":"My agent","requested_scopes":["resource:notes:read","schema:plan"],"project_ids":[]}

project_ids may restrict the requested projects; when empty, the owner chooses. The response contains registration_id, registration_type, claim_url, claim_token, claim_token_expires, post_claim_scopes, and claim with verification_uri, six-digit user_code, expires_in: 600, and interval: 5. Display the link and code to the user. The code is entered on Loomup's page, never returned to the agent. Keep claim_token in memory only.

Complete approval

Poll /oauth2/token with form data grant_type=urn:workos:agent-auth:grant-type:claim&claim_token=.... Respect authorization_pending and slow_down. An approved response includes access_token, token_type: Bearer, expires_in, scope, identity_assertion, and assertion_expires. Assertion and claim-token expirations use RFC3339; context expires_at uses Unix seconds. The poll handle expires permanently at its claim deadline. An expired code can be restarted via POST /agent/identity/claim with {"claim_token":"..."} while the 24-hour pending window remains open.

Permissions and API use

Send Authorization: Bearer <access_token> to authorized endpoints. GET /platform/api/agent/context returns a data envelope with the grant, workspace, expiry, and approved projects (id, name, base_url, scopes). Only these project scopes are accepted:

  • resource:<name>:read or resource:<name>:write: all rows in the named Resource.
  • storage:<bucket>:read or storage:<bucket>:write: the named bucket.
  • schema:plan: schema inspection and dry runs.
  • schema:apply: schema planning/application, including security-policy changes.

Schema apply can expose data outside direct resource scopes. It is broad project security authority and must be approved separately. Agents cannot create projects, manage keys/users/billing, call named jobs/operations, use realtime/sync/history, or issue signed storage URLs. Downloads use the authenticated origin.

Renew and disconnect

Access tokens last 15 minutes. POST /oauth2/token with form data grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=... to obtain another token. There is no refresh token. The service assertion expires 30 days after approval; exchanges never extend it. Expiration requires a new registration and approval, not a new customer account.

POST /oauth2/revoke with token and token_type_hint=access_token revokes one token. It does not prevent assertion exchange. POST /platform/api/agent/disconnect with the current Bearer token disconnects the whole grant. Owners can inspect and disconnect agents at /platform/agents. Disconnect blocks subsequent requests and schema execution checkpoints; committed changes and delivered bytes cannot be undone by revocation.

Operator configuration

Agent authentication is disabled by default. Provision dedicated RS256 private and public PEM key files shared by serving slots. Set LOOMUP_AGENT_AUTH_KEYRING_FILE to a JSON file with active_kid and keys entries containing kid, private_key_file (required for the active key), and public_key_file. Keep old public keys available through the expiry of assertions signed with them; rotate by atomically replacing this file and selecting the new active key. Never use tenant signing keys. Once all serving slots/workers support agent tokens, run the local operator command loomup platform agent-auth --enabled true --catalog <catalog> --projects-root <root>. Disable immediately with the same command and --enabled false. Serving startup never changes this shared catalog flag, so stale warm slots cannot re-enable it. Grant and switch checks fail closed and do not depend on process-local positive caches.

The customer quota applies to agent activity. Lifecycle and request records use agent/grant identifiers; credentials, codes, and assertions must not be logged.