Copy-paste agent prompt
Paste the prompt for your stack into Claude Code, Cursor, or Codex to wire AgentOnboard into your repository:Integrate AgentOnboard into this Next.js App Router repository.
1. Inspect the codebase and install `@agentonboard/sdk`.
2. Read these docs before editing:
- https://docs.agentonboard.xyz/nextjs.md
- https://docs.agentonboard.xyz/verify.md
- https://docs.agentonboard.xyz/accounts.md
- https://docs.agentonboard.xyz/auth-md.md
3. Ask me three questions before writing code:
- Which auth provider or users table should `resolveAccount` query?
- Should unknown emails return `403 ACCOUNT_REQUIRED` (reject) or create an account on `POST /api/signup`?
- What is the production Domain hostname (e.g. `notes.com` or `api.notes.com`)?
4. Implement the integration following these invariants:
- Call `requireAgentAccount` from `@agentonboard/sdk/next` inside route handlers (never in middleware).
- Hardcode `audience` to the normalized production Domain.
- Normalize emails with `normalizeEmail(email)` from `@agentonboard/sdk` (never raw `email.toLowerCase()`).
- Publish the discovery file at both `/auth.md` and `/.well-known/auth.md` with matching `## Audience` and `403` instructions.
5. Verify against localhost by minting a test token with `POST https://agentonboard.xyz/api/v1/token/exchange` and testing `403 ACCOUNT_REQUIRED`, `200 OK`, and `401 INVALID_SIGNATURE`.
Integrate AgentOnboard into this Express repository.
1. Inspect the codebase and install `@agentonboard/sdk`.
2. Read these docs before editing:
- https://docs.agentonboard.xyz/express.md
- https://docs.agentonboard.xyz/verify.md
- https://docs.agentonboard.xyz/accounts.md
- https://docs.agentonboard.xyz/auth-md.md
3. Ask me three questions before writing code:
- Which auth provider or users table should `resolveAccount` query?
- Should unknown emails return `403 ACCOUNT_REQUIRED` (reject) or create an account on `POST /api/signup`?
- What is the production Domain hostname (e.g. `notes.com` or `api.notes.com`)?
4. Implement the integration following these invariants:
- Call `requireAgentAccount(req, res, options)` from `@agentonboard/sdk/express`.
- Hardcode `audience` to the normalized production Domain.
- Normalize emails with `normalizeEmail(email)` from `@agentonboard/sdk` (never raw `email.toLowerCase()`).
- Serve the discovery file at both `/auth.md` and `/.well-known/auth.md` with matching `## Audience` and `403` instructions.
5. Verify against localhost by minting a test token with `POST https://agentonboard.xyz/api/v1/token/exchange` and testing `403 ACCOUNT_REQUIRED`, `200 OK`, and `401 INVALID_SIGNATURE`.
Integrate AgentOnboard into this Hono repository.
1. Inspect the codebase and install `@agentonboard/sdk`.
2. Read these docs before editing:
- https://docs.agentonboard.xyz/hono.md
- https://docs.agentonboard.xyz/verify.md
- https://docs.agentonboard.xyz/accounts.md
- https://docs.agentonboard.xyz/auth-md.md
3. Ask me three questions before writing code:
- Which auth provider or users table should `resolveAccount` query?
- Should unknown emails return `403 ACCOUNT_REQUIRED` (reject) or create an account on `POST /api/signup`?
- What is the production Domain hostname (e.g. `notes.com` or `api.notes.com`)?
4. Implement the integration following these invariants:
- Call `requireAgentAccount(c, options)` from `@agentonboard/sdk/hono`.
- Hardcode `audience` to the normalized production Domain.
- Normalize emails with `normalizeEmail(email)` from `@agentonboard/sdk` (never raw `email.toLowerCase()`).
- Serve the discovery file at both `/auth.md` and `/.well-known/auth.md` with matching `## Audience` and `403` instructions.
5. Verify against localhost by minting a test token with `POST https://agentonboard.xyz/api/v1/token/exchange` and testing `403 ACCOUNT_REQUIRED`, `200 OK`, and `401 INVALID_SIGNATURE`.
Integrate AgentOnboard into this FastAPI repository.
1. Inspect the codebase and install `agentonboard-sdk[fastapi]`.
2. Read these docs before editing:
- https://docs.agentonboard.xyz/fastapi.md
- https://docs.agentonboard.xyz/verify.md
- https://docs.agentonboard.xyz/accounts.md
- https://docs.agentonboard.xyz/auth-md.md
3. Ask me three questions before writing code:
- Which database or user model should the `resolver` query?
- Should unknown emails return `403 ACCOUNT_REQUIRED` (reject) or create an account on `POST /api/signup`?
- What is the production Domain hostname (e.g. `notes.com` or `api.notes.com`)?
4. Implement the integration following these invariants:
- Use `AgentBearerAuth` from `agentonboard.frameworks.fastapi`.
- Hardcode `audience` to the normalized production Domain.
- Normalize emails consistently in lowercase before querying your database.
- Serve the discovery file at both `/auth.md` and `/.well-known/auth.md` with matching `## Audience` and `403` instructions.
5. Verify against localhost by minting a test token with `POST https://agentonboard.xyz/api/v1/token/exchange` and testing `403 ACCOUNT_REQUIRED`, `200 OK`, and `401 INVALID_SIGNATURE`.
Integrate AgentOnboard into this Django repository.
1. Inspect the codebase and install `agentonboard-sdk[django]`.
2. Read these docs before editing:
- https://docs.agentonboard.xyz/django.md
- https://docs.agentonboard.xyz/verify.md
- https://docs.agentonboard.xyz/accounts.md
- https://docs.agentonboard.xyz/auth-md.md
3. Ask me three questions before writing code:
- Which user model should the `resolver` query?
- Should unknown emails return `403 ACCOUNT_REQUIRED` (reject) or create an account on `POST /api/signup`?
- What is the production Domain hostname (e.g. `notes.com` or `api.notes.com`)?
4. Implement the integration following these invariants:
- Use `@require_agent_token` from `agentonboard.frameworks.django`.
- Hardcode `audience` to the normalized production Domain.
- Query emails case-insensitively (`email__iexact` or normalized lowercase).
- Serve the discovery file at both `/auth.md` and `/.well-known/auth.md` with matching `## Audience` and `403` instructions.
5. Verify against localhost by minting a test token with `POST https://agentonboard.xyz/api/v1/token/exchange` and testing `403 ACCOUNT_REQUIRED`, `200 OK`, and `401 INVALID_SIGNATURE`.
Integrate AgentOnboard into this Flask repository.
1. Inspect the codebase and install `agentonboard-sdk[flask]`.
2. Read these docs before editing:
- https://docs.agentonboard.xyz/flask.md
- https://docs.agentonboard.xyz/verify.md
- https://docs.agentonboard.xyz/accounts.md
- https://docs.agentonboard.xyz/auth-md.md
3. Ask me three questions before writing code:
- Which database or user model should the `resolver` query?
- Should unknown emails return `403 ACCOUNT_REQUIRED` (reject) or create an account on `POST /api/signup`?
- What is the production Domain hostname (e.g. `notes.com` or `api.notes.com`)?
4. Implement the integration following these invariants:
- Use `@require_agent_token` from `agentonboard.frameworks.flask`.
- Hardcode `audience` to the normalized production Domain.
- Normalize emails consistently in lowercase before querying your database.
- Serve the discovery file at both `/auth.md` and `/.well-known/auth.md` with matching `## Audience` and `403` instructions.
5. Verify against localhost by minting a test token with `POST https://agentonboard.xyz/api/v1/token/exchange` and testing `403 ACCOUNT_REQUIRED`, `200 OK`, and `401 INVALID_SIGNATURE`.
Manual setup
1
Install the SDK
- npm
- pnpm
- yarn
- bun
- Python (pip)
- Python (uv)
npm install @agentonboard/sdk
pnpm add @agentonboard/sdk
yarn add @agentonboard/sdk
bun add @agentonboard/sdk
# Choose your framework extra: fastapi, django, or flask
pip install "agentonboard-sdk[fastapi]"
# Choose your framework extra: fastapi, django, or flask
uv add "agentonboard-sdk[fastapi]"
2
Guard your route handler
Verify the incoming Bearer token against AgentOnboard’s public JWKS and look up the user by normalized email:
- Next.js
- Express
- Hono
- FastAPI
- Django
- Flask
app/api/notes/route.ts
import { normalizeEmail } from "@agentonboard/sdk";
import { requireAgentAccount } from "@agentonboard/sdk/next";
export async function POST(request: Request) {
const session = await requireAgentAccount(request, {
audience: "notes.com",
resolveAccount: async ({ email }) => {
const user = await db.user.findUnique({
where: { email: normalizeEmail(email) },
});
return user?.id ?? null;
},
});
// Returns 401 (invalid/expired token) or 403 (ACCOUNT_REQUIRED)
if (!session.ok) return session.response;
return Response.json({ success: true, created_by: session.user });
}
api/notes.ts
import express from "express";
import { normalizeEmail } from "@agentonboard/sdk";
import { requireAgentAccount } from "@agentonboard/sdk/express";
const app = express();
app.use(express.json());
app.post("/api/notes", async (req, res) => {
const session = await requireAgentAccount(req, res, {
audience: "notes.com",
resolveAccount: async ({ email }) => {
const user = await db.user.findUnique({
where: { email: normalizeEmail(email) },
});
return user?.id ?? null;
},
});
// If verification failed, status and JSON body were already sent on `res`
if (!session.ok) return;
res.json({ success: true, created_by: session.user });
});
src/index.ts
import { Hono } from "hono";
import { normalizeEmail } from "@agentonboard/sdk";
import { requireAgentAccount } from "@agentonboard/sdk/hono";
const app = new Hono();
app.post("/api/notes", async (c) => {
const session = await requireAgentAccount(c, {
audience: "notes.com",
resolveAccount: async ({ email }) => {
const user = await db.user.findUnique({
where: { email: normalizeEmail(email) },
});
return user?.id ?? null;
},
});
if (!session.ok) return session.response;
return c.json({ success: true, created_by: session.user });
});
main.py
from fastapi import Depends, FastAPI
from agentonboard import AgentIdentity
from agentonboard.frameworks.fastapi import AgentBearerAuth
app = FastAPI()
async def get_user_by_email(identity: AgentIdentity):
user = await db.users.find_one({"email": identity.email.strip().lower()})
return str(user["_id"]) if user else None
agent_auth = AgentBearerAuth(
audience="notes.com",
resolver=get_user_by_email,
)
@app.post("/api/notes")
async def create_note(user_id: str = Depends(agent_auth)):
return {"success": True, "created_by": user_id}
views.py
from django.contrib.auth import get_user_model
from django.http import HttpRequest, JsonResponse
from django.views.decorators.csrf import csrf_exempt
from agentonboard import AgentIdentity
from agentonboard.frameworks.django import require_agent_token
User = get_user_model()
def get_user_by_email(identity: AgentIdentity):
user = User.objects.filter(email__iexact=identity.email.strip()).first()
return user.id if user else None
@csrf_exempt
@require_agent_token(audience="notes.com", resolver=get_user_by_email)
def create_note(request: HttpRequest, agent_user: int):
return JsonResponse({"success": True, "created_by": agent_user})
app.py
from flask import Flask, jsonify
from agentonboard import AgentIdentity
from agentonboard.frameworks.flask import require_agent_token
app = Flask(__name__)
def get_user_by_email(identity: AgentIdentity):
user = db.users.find_one({"email": identity.email.strip().lower()})
return str(user["_id"]) if user else None
@app.post("/api/notes")
@require_agent_token(audience="notes.com", resolver=get_user_by_email)
def create_note(agent_user: str):
return jsonify({"success": True, "created_by": agent_user})
3
Publish auth.md
Serve a static
auth.md file at https://<your-domain>/auth.md and https://<your-domain>/.well-known/auth.md (for example public/auth.md and public/.well-known/auth.md) so agents learn your Domain, endpoints, and 401 / 403 handling:public/auth.md
# Notes API
This service accepts AgentOnboard tokens.
## Audience
`notes.com`
get_token(domain: "notes.com")
Send the token on every request as `Authorization: Bearer <token>`.
## Endpoints
### `POST /api/notes`
- Request: `{ "title": string, "body": string }`
- Success: `201` with `{ "id": string, "title": string, "body": string }`
- Required header: `Authorization: Bearer <token>`
## When a request is rejected
| Status | `code` | What to do |
|---|---|---|
| 401 | any | The token was rejected. Call `get_token` for `notes.com` again and retry **once**. |
| 403 | `ACCOUNT_REQUIRED` | The identity is valid but has no Notes account. Ask the human to connect their account at https://notes.com/connect, then retry. |
| 500 | `RESOLVER_ERROR` or `CONFIG_ERROR` | Server error. Retry after a short delay with the same token. |
4
Test with curl
Mint a 5-minute test token using
POST /api/v1/token/exchange, then call your endpoint:# 1. Mint a 5-minute test token for your domain
TOKEN=$(curl -s -X POST https://agentonboard.xyz/api/v1/token/exchange \
-H "Authorization: Bearer aon_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{"audience":"notes.com"}' \
| jq -r '.token')
# 2. Call your protected endpoint
curl -i -X POST https://notes.com/api/notes \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"title": "First note", "body": "Created by an agent"}'