Integrations
Send your app's routes to the route lock
Map your app's routes and methods at build time with agentproof-live map, for Next.js, Laravel, Rails, Django and OpenAPI, and send them to AgentProof.
The route lock works best when it knows your app's own routes: then nothing your visitors use is refused, and Enforce is offered at once. The live Defense Agent reads them by itself in a Node.js app. For other apps, or to send them from your build, use agentproof-live map, which comes with @isagentproof/live.
Routes the agent reads by itself
When the agent runs in your app's process (node --import @isagentproof/live/register) with an install key, it reads the routes your app registers and sends their paths and methods to AgentProof a few seconds after start, then again whenever they change:
- Express 4 and 5: routes,
app.route(), routers mounted withapp.use('/prefix', router)at any depth, sub-apps andexpress.staticfolders. - Fastify 5: every route, with its plugin prefixes.
- Koa with
@koa/router: every route, with router prefixes. - Next.js, after
next build: pages, route handlers with the methods they export, server actions, dynamic segments and the files inpublic/.
Routes written as regular expressions, and middleware that answers requests itself, are left out. Put those routes on the map with Allow or Open on the Live page.
Map your app at build time
Run it in your app's folder after the build:
npx @isagentproof/live mapIt finds the framework by itself and writes agentproof-routes.json. Choose it with --framework:
| Framework | What it reads |
|---|---|
next | The build in .next/. Run next build first. |
laravel | Laravel's route list, through php and your app's own bootstrap, with each route's where patterns |
rails | Rails' route set, through bin/rails runner, with mounted engines and Rack apps |
django | Your URL patterns, through python3 manage.py shell (set PYTHON to use another Python), with each view's methods |
openapi | openapi.json, openapi.yaml, openapi.yml or swagger.json, or the file you name with --spec |
Other options: --dir <folder> maps an app in another folder, --out <file> writes elsewhere, and --prefix /api sets the path in front of every OpenAPI route (by default, the path of the file's first server).
Django views that are plain functions, without require_http_methods or a class, can answer any method, so the map lists every method for them. The Would deny card shows what your app really answers.
Send the map to AgentProof
Add --upload to send the map with your install key:
AGENTPROOF_LIVE_KEY=apl_... npx @isagentproof/live map --uploadIt goes to the website project the key belongs to. Run it in your deploy pipeline after the build, so the map follows each release.
You can also give the file to the agent itself. With AGENTPROOF_LIVE_ROUTES pointing at it, the agent (in process or as a proxy) sends it to AgentProof when it starts:
AGENTPROOF_LIVE_KEY=apl_... AGENTPROOF_LIVE_ROUTES=/app/agentproof-routes.json npx @isagentproof/live proxy --listen 8080 --to http://127.0.0.1:3000Run the lock without AgentProof
Without an install key, AGENTPROOF_LIVE_ROUTE_LOCK runs the route lock on the routes file alone: monitor or enforce. Every route in the file is open unless the file marks it locked. When the agent has a key, the mode always comes from the Live page.
What the routes file holds
{
"version": 1,
"framework": "laravel",
"php": true,
"entries": [
{ "p": "/posts/:post", "m": ["GET", "HEAD"] },
{ "p": "/files/**", "m": ["GET", "HEAD"] }
]
}Each entry is a path pattern (:name is one path segment, a trailing ** is everything below) and its methods. Only paths and methods are in it, never code. AgentProof takes at most 5,000 routes.
Messages you may see
| Message | What to do |
|---|---|
could not tell the framework: pass --framework next | laravel | rails | django | openapi | Name the framework. |
no .next/routes-manifest.json: run next build first | Build the app, then map it. |
no OpenAPI file: pass --spec <file> | Name the file. |
--upload needs AGENTPROOF_LIVE_KEY | Set the install key. |
AgentProof refused the routes (...) | The message says why. A key whose workspace has no website project gets Add a website project in Setup first. |
Last updated