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);

// On-the-fly assessment with decision (paid tier)
const assessment = await client.assess("0xdb5aa553feeb2c3e3d03e8360b36fb0f7e480671", {
  policy: { minGrade: "B", minScore: 50 },
});

if (assessment.decision === "deny") {
  console.log("Denied:", assessment.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 cached reputation profile.
const result = await client.reputation(address, {
  chain: "base",  // optional, default "base"
});
Returns ReputationResponse with score, classification, identity, and activity data.

client.assess(address, options?)

On-the-fly trust assessment with policy evaluation. Paid tier only.
const result = await client.assess(address, {
  policy: {
    minGrade: "B",
    minScore: 50,
    requireVerifiedPaymentActivity: false,
  },
  refresh: false,  // optional, force recomputation
});

if (result.decision === "deny") {
  console.log("Denied:", result.decision_reasons);
}
Returns AssessResponse with all reputation fields plus decision and decision_reasons.

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 {
  ReputationResponse,
  AssessResponse,
  AgentsResponse,
  StatsResponse,
} from "@agentscore/sdk";