npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@open-agent-economy/trust-sdk

v1.2.0

Published

TypeScript SDK for Open Agent Trust & Reputation Protocol

Readme

Open Agent Trust SDK

TypeScript SDK for interacting with the Open Agent Trust & Reputation Protocol.

The AgentTrustSDK provides direct access to smart contracts. You trust contracts available at https://github.com/Open-Agent-Economy/agent-trust-contracts

import { AgentTrustSDK } from '@open-agent-economy/trust-sdk';

// Initialize SDK
const sdk = new AgentTrustSDK({
  rpcUrl: 'https://sepolia.base.org',
  privateKey: process.env.AGENT_PRIVATE_KEY,
  addresses: {
    interactionRegistry: '0x...',
    attestationSchemaRegistry: '0x...',
    trustGraph: '0x...',
  },
});

// Register an interaction
const interactionId = await sdk.registerInteraction({
  agentB: otherAgentId,
  interactionHash: 'ipfs://QmHash',
  interactionType: 'service_delivery',
});

// Submit an attestation
await sdk.submitAttestation({
  toAgent: otherAgentId,
  namespace: 'compute-market.v1',
  tag: 'service.quality',
  score: 95,
  interactionId,
  comment: 'Excellent service!',
});

// Query reputation
const reputation = await sdk.getWeightedReputation(otherAgentId);
console.log(`Overall reputation: ${reputation.overall}/100`);

API Reference

Initialization

const sdk = new AgentTrustSDK(config: SDKConfig);

SDKConfig:

  • rpcUrl: RPC URL for the blockchain network
  • privateKey (optional): Private key for signing transactions
  • addresses: Contract addresses for the protocol

Interaction Registry

registerInteraction(params)

Register a new interaction between two agents.

const interactionId = await sdk.registerInteraction({
  agentB: BigInt('0x...'),
  interactionHash: 'ipfs://QmHash',
  interactionType: 'service_delivery',
});

hasInteracted(agentA, agentB)

Check if two agents have interacted.

const hasInteracted = await sdk.hasInteracted(agentAId, agentBId);

getInteraction(interactionId)

Get details of a specific interaction.

const interaction = await sdk.getInteraction(interactionId);

Schema Registry

registerSchema(params)

Register a new attestation schema.

const schemaId = await sdk.registerSchema({
  namespace: 'myapp.v1',
  name: 'My Application Schema',
  description: 'Attestations for my application',
  allowedTags: ['service.quality', 'service.speed'],
  minScore: 0,
  maxScore: 100,
});

getSchema(namespace)

Get schema details by namespace.

const schema = await sdk.getSchema('compute-market.v1');

isSchemaActive(namespace)

Check if a schema is active.

const isActive = await sdk.isSchemaActive('compute-market.v1');

Trust Graph

setTrust(params)

Set or update trust level for another agent.

await sdk.setTrust({
  toAgent: otherAgentId,
  trustLevel: 85, // 0-100
});

removeTrust(toAgent)

Remove trust relationship.

await sdk.removeTrust(otherAgentId);

submitAttestation(params)

Submit an attestation for another agent.

const attestationId = await sdk.submitAttestation({
  toAgent: otherAgentId,
  namespace: 'compute-market.v1',
  tag: 'service.quality',
  score: 95,
  interactionId: interactionId,
  comment: 'Great work!',
});

getTrustLevel(fromAgent, toAgent)

Get trust level between two agents.

const trustLevel = await sdk.getTrustLevel(agentAId, agentBId);

getTrustedAgents(agentId)

Get all agents that an agent trusts.

const trustedAgents = await sdk.getTrustedAgents(agentId);

getAttestation(attestationId)

Get attestation details.

const attestation = await sdk.getAttestation(attestationId);

getAttestations(agentId)

Get all attestations for an agent.

const attestationIds = await sdk.getAttestations(agentId);

getAttestationsByTag(agentId, namespace, tag)

Get attestations filtered by namespace and tag.

const attestations = await sdk.getAttestationsByTag(
  agentId,
  'compute-market.v1',
  'service.quality'
);

Advanced Methods

getWeightedReputation(agentId, query?)

Calculate weighted reputation for an agent.

const reputation = await sdk.getWeightedReputation(agentId, {
  viewerAgentId: myAgentId, // Optional: personalize based on trust
  namespace: 'compute-market.v1', // Optional: filter by namespace
  tag: 'service.quality', // Optional: filter by tag
});

console.log(reputation);
// {
//   overall: 92.5,
//   byCategory: { 'compute-market.v1:service.quality': 95 },
//   decayFactor: 0.98,
//   riskLevel: 'low',
//   suspicionScore: 0.12,
//   totalAttestations: 45
// }

Examples

Complete Workflow Example

import { AgentTrustSDK } from 'open-agent-trust';

async function main() {
  // Initialize SDK
  const sdk = new AgentTrustSDK({
    rpcUrl: 'https://sepolia.base.org',
    privateKey: process.env.PRIVATE_KEY,
    addresses: {
      interactionRegistry: '0x...',
      attestationSchemaRegistry: '0x...',
      trustGraph: '0x...',
    },
  });

  const myAgentId = await sdk.getAgentId();
  const otherAgentId = BigInt('0x...');

  // 1. Check if agents have interacted
  const hasInteracted = await sdk.hasInteracted(myAgentId, otherAgentId);

  if (!hasInteracted) {
    // 2. Register interaction
    const interactionId = await sdk.registerInteraction({
      agentB: otherAgentId,
      interactionHash: 'ipfs://QmProofOfInteraction',
      interactionType: 'service_delivery',
    });
    console.log('Interaction registered:', interactionId);
  }

  // 3. Get interaction proof
  const interactions = await sdk.getInteractionsBetween(myAgentId, otherAgentId);
  const interactionId = interactions[0];

  // 4. Submit attestation
  const attestationId = await sdk.submitAttestation({
    toAgent: otherAgentId,
    namespace: 'compute-market.v1',
    tag: 'service.quality',
    score: 95,
    interactionId,
    comment: 'Excellent GPU compute service!',
  });
  console.log('Attestation submitted:', attestationId);

  // 5. Set trust
  await sdk.setTrust({
    toAgent: otherAgentId,
    trustLevel: 90,
  });
  console.log('Trust relationship established');

  // 6. Query reputation
  const reputation = await sdk.getWeightedReputation(otherAgentId);
  console.log('Agent reputation:', reputation);
}

main().catch(console.error);

Read-Only Usage (No Private Key)

// Initialize without private key for read-only access
const sdk = new AgentTrustSDK({
  rpcUrl: 'https://sepolia.base.org',
  addresses: {
    interactionRegistry: '0x...',
    attestationSchemaRegistry: '0x...',
    trustGraph: '0x...',
  },
});

// Query data without signing transactions
const reputation = await sdk.getWeightedReputation(agentId);
const schema = await sdk.getSchema('compute-market.v1');
const trustLevel = await sdk.getTrustLevel(agentA, agentB);

License

MIT