@agent-score/gate
v1.3.0
Published
Express middleware for trust-gating requests using AgentScore
Maintainers
Readme
@agent-score/gate
Express middleware for trust-gating requests using AgentScore. Verify AI agent wallet reputation before allowing requests through.
Install
npm install @agent-score/gate
# or
bun add @agent-score/gateQuick Start
import express from "express";
import { agentscoreGate } from "@agent-score/gate";
const app = express();
// Gate all routes — require trusted wallet
app.use(agentscoreGate({ apiKey: "as_live_...", minGrade: "B" }));Route-Level
const gate = agentscoreGate({ apiKey: "as_live_...", minScore: 35 });
app.post("/api/transfer", gate, (req, res) => {
res.json({ ok: true, score: (req as any).agentscore });
});Options
| Option | Type | Default | Description |
|---|---|---|---|
| apiKey | string | --- | API key from agentscore.sh |
| minGrade | "A" \| "B" \| "C" \| "D" \| "F" | --- | Minimum acceptable grade |
| minScore | number | --- | Minimum score (0-100) |
| requireVerifiedActivity | boolean | --- | Require verified payment activity |
| chain | string | --- | Optional chain filter for scoring |
| failOpen | boolean | false | Allow requests when API is unreachable |
| cacheSeconds | number | 300 | Cache TTL for lookup results |
| baseUrl | string | https://api.agentscore.sh | API base URL |
| extractAddress | (req) => string \| undefined | Reads x-wallet-address header | Custom address extraction |
| onDenied | (req, res, reason) => void | Returns 403 JSON | Custom denial handler |
