Skip to main content

Installation

npm install @agentscore/sdk

Quick start

import { AgentScore } from "@agentscore/sdk";

const client = new AgentScore({ apiKey: process.env.AGENTSCORE_API_KEY });

// Summary lookup (free tier)
const summary = await client.reputation("0xdb5aa553feeb2c3e3d03e8360b36fb0f7e480671");
console.log(summary.score, summary.grade);

// Full lookup with decision (paid tier)
const full = await client.reputation("0xdb5aa553feeb2c3e3d03e8360b36fb0f7e480671", {
  view: "full",
  minGrade: "B",
  minTransactions: 5,
});

if (!full.decision.allow) {
  console.log("Denied:", full.decision.reasons);
}

API reference

Constructor

new AgentScore(options: {
  apiKey: string;
  baseUrl?: string;  // default: "https://api.agentscore.sh"
  timeout?: number;  // default: 10000 (ms)
})

client.reputation(address, options?)

Look up a wallet’s reputation.
const result = await client.reputation(address, {
  view: "summary" | "full",   // default: "summary"
  minGrade: "A" | "B" | "C" | "D" | "F",  // optional, paid
  minTransactions: number,     // optional, paid
});
Returns ReputationSummaryResponse or ReputationFullResponse depending on the view parameter.

client.batch(addresses, options?)

Score multiple wallets in one request. Paid tier only.
const result = await client.batch(
  [
    "0xdb5aa553feeb2c3e3d03e8360b36fb0f7e480671",
    "0x447e981bd3d8267499860ff0f9afbc9f8ffcc514",
  ],
  {
    policy: { minGrade: "B", minTransactions: 5 },
    view: "summary",
  }
);

for (const r of result.results) {
  console.log(r.address, r.decision.allow, r.decision.reasons);
}

client.health()

Check API health.
const health = await client.health();
console.log(health.status); // "healthy"

client.stats()

Get ecosystem statistics.
const stats = await client.stats();
console.log(`${stats.wallets_scored} wallets scored`);

Error handling

The SDK throws typed errors:
import { AgentScoreError } from "@agentscore/sdk";

try {
  const rep = await client.reputation("0xinvalid");
} catch (err) {
  if (err instanceof AgentScoreError) {
    console.log(err.code);    // "invalid_address"
    console.log(err.message); // "The provided wallet address is not a valid EVM address."
    console.log(err.status);  // 400
  }
}

TypeScript types

The SDK exports all response types:
import type {
  ReputationSummaryResponse,
  ReputationFullResponse,
  BatchResponse,
  HealthResponse,
  StatsResponse,
} from "@agentscore/sdk";