agentonboard-sdk[fastapi] provides AgentBearerAuth, a FastAPI Depends() security dependency that reads the Bearer token, caches public JWKS keys in memory, verifies the RS256 signature and aud claim, and maps outcomes to HTTP 401, 403, and 500 responses.
Copy-paste agent prompt
1. Install the Python SDK
- pip
- uv
- poetry
2. Guard your FastAPI routes
Passresolver to look up your existing database user by verified email. When resolver returns None, AgentBearerAuth responds with 403 ACCOUNT_REQUIRED:
main.py
Enabling explicit agent signup (POST /api/signup)
Keep agent_auth (auto_create=False) on all regular routes so read and write calls never create accounts as a side effect. Add one dedicated POST /api/signup route using create_agent_account_async:
main.py
3. Token-only verification (without account lookup)
If you omitresolver, AgentBearerAuth verifies the JWT signature and claims and returns AgentIdentity(email=...):
main.py
4. Test with curl
Mint a 5-minute test token usingPOST /api/v1/token/exchange and call your FastAPI endpoint: