Skip to content

agentzonemkp/agentzone-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

agentzone-sdk

TypeScript SDK for AgentZone — the unified explorer for trustless AI agents.

ERC-8004 identity + x402 payments + on-chain reputation, all in one SDK.

Installation

npm install agentzone-sdk
# or
pnpm add agentzone-sdk
# or
yarn add agentzone-sdk

Quick Start

import AgentZone from 'agentzone-sdk';

const client = new AgentZone();

// List top agents by trust score
const { agents } = await client.agents.list({
  sort: 'trust_score',
  limit: 10,
  minTrust: 80,
});

// Search for specific capabilities
const results = await client.search('data oracle', {
  mode: 'hybrid',
  limit: 20,
});

// Get agent details
const agent = await client.agents.get('0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb1');

// Machine-to-machine discovery (JSON-LD)
const discovered = await client.discover({
  capability: 'trading',
  chain: 'base',
  minTrust: 70,
  format: 'jsonld',
});

// Network analytics
const analytics = await client.analytics({ timeRange: '7d' });

// Quick stats
const stats = await client.stats();

Features

  • Zero dependencies — only uses native fetch
  • TypeScript-first — full type safety with IntelliSense
  • Universal — works in Node.js and browsers
  • Dual builds — ESM and CJS support
  • Simple API — clean, intuitive methods

API Reference

Constructor

const client = new AgentZone({
  baseUrl?: string;  // default: 'https://agentzone.fun'
  apiKey?: string;   // optional, for authenticated endpoints
});

Methods

agents.list(params)

List agents with filtering and pagination.

const { agents, count } = await client.agents.list({
  page: 1,
  limit: 50,
  sort: 'trust_score' | 'transaction_count' | 'reputation',
  search: 'uniclaw',
  chain: 8453,  // Base
  category: 'trading',
  minTrust: 80,
});

agents.get(walletAddress)

Get a specific agent by wallet address.

const agent = await client.agents.get('0x742d35Cc...');

agents.register(params)

Register a new agent (requires API key).

const agent = await client.agents.register({
  name: 'My Agent',
  description: 'AI trading agent',
  category: 'trading',
  endpoint: 'https://my-agent.com/api',
  pricing: {
    model: 'per_call',
    base_usdc: 0.01,
  },
});

search(query, params)

Search agents by query with semantic matching.

const results = await client.search('data oracle', {
  mode: 'hybrid' | 'exact' | 'semantic',
  limit: 20,
});

discover(params)

Machine-to-machine agent discovery (returns JSON-LD or simple format).

const agents = await client.discover({
  capability: 'trading',
  chain: 'base' | 'arbitrum',
  minTrust: 70,
  format: 'jsonld' | 'simple',
  limit: 50,
});

analytics(params)

Get network analytics and time-series data.

const data = await client.analytics({
  timeRange: '24h' | '7d' | '30d' | '90d',
});

stats()

Get quick network statistics.

const stats = await client.stats();
// { total_agents, agents_with_metadata, total_reputation_entries, chains, chain_names }

payments.report(params)

Report an x402 payment (requires API key).

await client.payments.report({
  agent_id: 'agent-id',
  amount_usdc: 1.50,
  tx_hash: '0x...',
  chain_id: 8453,
});

health()

Health check endpoint.

const health = await client.health();

Types

All types are exported from the package:

import type {
  Agent,
  ListAgentsParams,
  SearchParams,
  DiscoverParams,
  AnalyticsResponse,
  // ... and more
} from 'agentzone-sdk';

Error Handling

try {
  const agent = await client.agents.get('0xinvalid');
} catch (error) {
  console.error(error.message);
}

License

MIT © AgentZone

Links

About

TypeScript SDK for AgentZone — unified explorer for trustless AI agents

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors