Skip to main content
Agent tokens are the simplest way to authenticate an AI agent. They work exactly like API keys — a long-lived string sent in the Authorization: Bearer header — but scoped to one agent rather than the whole tenant.
For production agents, upgrade to Ed25519 sessions. Agent tokens are great for prototypes and simple deployments; Ed25519 gives you short-lived sessions, replay protection, and per-session revocation.

Token format

Obtain a token

When you create an agent, Sly returns a token as part of the response:
Response includes:
The token is shown once. Store it securely immediately.

Use the token

Exactly like an API key:
The server populates a RequestContext identifying the actor as this agent — so:
  • Transfers default to this agent as the initiator
  • Balances show this agent’s wallet
  • Spending is enforced against this agent’s wallet policy and KYA tier limits

Rotate a token

Response returns a new agent_* token. The old token is invalidated immediately.

Revoke a token

Delete the agent or freeze it:

When agent tokens are enough

  • Prototyping and local dev — fastest path to a working agent
  • Trusted environments — agent runs on your own server, not user machines
  • Low-value scopes — read-only agents, monitoring agents, observability collectors
  • Backwards compatibility — existing agents don’t need to migrate

When to upgrade to Ed25519 sessions

  • Production — real money, real merchant traffic
  • Agent runs on customer hardware — keypair never leaves the machine
  • You need replay protection — sessions bound to nonces
  • You need granular revocation — kill one session without rotating the token
  • You want push eventssess_* tokens unlock the persistent SSE channel
See Ed25519 sessions for the upgrade path. Migration requires zero changes to route code — both methods produce identical RequestContext.

Cross-agent operations require explicit elevation

By default, an agent_* token is single-agent-scoped — the agent can only act on its own resources. Reading sibling agents, mutating their state, or moving funds between them returns 403 SCOPE_REQUIRED with a hint to call request_scope. Tenant owners approve the request via the dashboard or the API. See Scope grants for the full lifecycle, the three tiers (tenant_read, tenant_write, treasury), and the canonical list of currently-gated routes.

Comparison with API keys

Agent tokens and API keys both send a long-lived secret in the header. The differences: