Skip to main content
AgentOS reads the JWT from the Authorization: Bearer <token> header on every request. Tokens can come from the AgentOS control plane or your own backend.

Token Structure

Your JWT tokens should include:
{
  "sub": "user-123",
  "scopes": ["agents:read", "agents:my-agent:run"],
  "exp": 1735689600,
  "iat": 1735603200
}
ClaimRequiredDescription
scopesYesArray of permission scopes
subNoUser ID (extracted as user_id)
session_idNoSession ID for session tracking
audNoAudience (must match AgentOS id when verify_audience=True)
expNoExpiry timestamp. Recommended; expired tokens are rejected.
iatNoIssued-at timestamp.

Example Tokens

Read-only access:
{
  "scopes": ["agents:read", "teams:read", "sessions:read"]
}
Run a specific agent:
{
  "scopes": ["agents:my-agent:run", "agents:my-agent:read", "sessions:write"]
}
Admin access:
{
  "scopes": ["agent_os:admin"]
}
See Scopes for the full list.

Sending Tokens

Send the token in the Authorization header:
curl -H "Authorization: Bearer $TOKEN" http://localhost:7777/agents

Next Steps

TaskGuide
Issue tokens from your own backendSelf-Hosted
See the full scope referenceScopes
Configure JWT middleware directlyJWT Middleware