agno_pat_... tokens instead of JWTs.
Mint a token with a credential that can create service accounts: a JWT holding service_accounts:write (or the admin scope), or the OS security key:
201 response is the only time you’ll see the plaintext token, so store it somewhere safe. There’s no way to get it back later. agno tokens wraps this API for the terminal.
The machine sends the token as a standard bearer header:
AgentOS(db=...)). Tokens are stored there, next to sessions and memories. Minting always requires a real credential, so anonymous requests on an open instance get a 401.
Token Properties
Scopes
A token minted without scopes gets run and read access:config:read lets the token discover what it can run (GET /config).
Custom scopes are passed as {scope, effect} objects. Token scopes are grants, so only effect: "allow" is accepted:
Privileged Scopes
Some scopes requireallow_privileged_scopes: true at mint time, so a privileged token is always deliberate:
A scoped caller can only grant scopes it already holds. A caller with
service_accounts:write but without knowledge:delete cannot mint a token carrying knowledge:delete, so minting never escalates privileges. Admin callers and the OS security key (an unscoped root) can grant anything.
List and Revoke
limit, page, sort_by, sort_order, include_revoked) and returns metadata plus a display prefix (token_prefix) only. Neither the hash nor the plaintext is ever returned.
Revocation is one-way and idempotent. A revoked name can be reused by minting a new account.
Revocation Timing
Successful verifications are cached in-process, so token auth does not hit the database on every request. Revocation takes effect immediately on the worker that processes theDELETE, and within service_account_cache_ttl_seconds (default 30) on other workers. Token expiry is always honored, even on a cache hit.
For strict instant revocation, disable the cache. Every request then verifies against the database:
Attribution and Data Access
Requests authenticated with a token run as the principalsa:<name>. Sessions, memories, and traces created through a claude-code token show sa:claude-code as the user.
sa: is a reserved namespace. A JWT whose sub claims an sa: identity is rejected with 401, so a human token can never impersonate a machine identity.
Service accounts always self-scope: they read and write only data attributed to their own principal, even when user isolation is off. For a cross-user debugging token, grant the admin scope; agent_os:admin bypasses self-scoping.
Enforcement Surfaces
Tokens pass through the same auth layer as JWTs and cover the full AgentOS surface:
Service account scopes are ACL data stored in your database, so AgentOS enforces them in every authentication mode, including
security_key and none. JWT scopes are enforced only when authorization is enabled.
Failure Modes
On an instance with no auth configured, a token that cannot be verified is ignored and the request proceeds anonymously. A token that verifies always attributes the request, and its scopes always apply.