sess_* token that works everywhere.
Why Ed25519 sessions
| Aspect | Agent token (agent_*) | Ed25519 session (sess_*) |
|---|---|---|
| Secret exposure | Token sent in every header | Private key never leaves the agent |
| If intercepted | Permanent full access until rotation | 1-hour session, revocable |
| Replay protection | None | Nonce-based, single-use challenges |
| Session revocation | Must rotate the whole token | Per-session, instant |
| Self-rotation | Requires an API key holder | Agent signs its own rotation proof |
| Event delivery | Poll for updates | Push via persistent SSE |
Flow
1. Provision a key pair
When you create the agent, setgenerate_keypair: true and Sly will return the private key once:
2. Request a challenge
This endpoint is public — no auth required. The agent calls it when it needs to authenticate.3. Sign the challenge
4. Authenticate
Also public — the signature proves you hold the private key.sess_* token works on every authenticated endpoint — transfers, streams, A2A, x402, AP2, everything.
5. Rotate a key
Agents can self-rotate without needing an API key holder. Sign the messagerotate:<agentId> with the current private key:
- Old key marked
rotated - All active sessions under the old key are revoked
- New Ed25519 key pair generated
- New private key returned (shown once)
6. Revoke a key (kill-switch)
Persistent SSE connection
Once authenticated withsess_*, the agent can open a push channel for real-time events:
task_assigned— new A2A tasktransfer_completed— transfer finalizedapproval_requested— spending requires manager approvalstream_alert— managed stream needs attentionkey_rotated— auth key was rotated, session about to revokeheartbeat— 30-second keepalive
Last-Event-ID for reconnect — missed events are replayed from a 100-event / 5-minute buffer. See persistent SSE for details.
Complete example (Node.js)
Endpoint reference
| Endpoint | Auth required | Purpose |
|---|---|---|
POST /v1/agents/:id/challenge | Public | Request challenge nonce (60s TTL) |
POST /v1/agents/:id/authenticate | Public | Submit signed challenge, get sess_* |
POST /v1/agents/:id/auth-keys | API key | Provision Ed25519 key pair |
POST /v1/agents/:id/auth-keys/rotate | Signed proof | Agent self-rotates |
DELETE /v1/agents/:id/auth-keys | API key | Revoke key + all sessions |
GET /v1/agents/:id/connect | sess_* | Persistent SSE channel |
GET /v1/agents/:id/liveness | API key | Check connection status |
