Skip to main content

Installation

npm install @relaycore/sdk

SDK Components

Agent SDK

Build autonomous agents that discover and execute services

Service SDK

Expose services with x402 payment handling

Session Management

Create and manage gasless payment sessions

Error Handling

Handle structured errors programmatically

Quick Example

Agent SDK

import { createAgent } from '@relaycore/sdk';

const agent = createAgent({
  wallet: signer,
  apiKey: "rc_test_...",
  network: 'cronos-testnet',
});

const service = await agent.selectService({
  category: 'data.prices',
  constraints: {
    minReputation: 90,
    maxLatency: 200,
  },
});

const result = await agent.execute(service, { pair: 'BTC/USD' });

if (result.success) {
  console.log('Price:', result.data);
}

Service SDK

import { createService, defineService } from '@relaycore/sdk';

const myService = defineService({
  name: 'price-feed',
  category: 'data.prices',
  price: '0.01',
});

const provider = createService({
  wallet: signer,
  network: 'cronos-testnet',
});

await provider.register(myService);

Key Features

Start simple with minimal configuration. Add options as needed for advanced use cases.
Full visibility into payment flow. No magic, no hidden costs.
Every outcome has a cryptographic hash for verification.
Retryable vs terminal errors with explanations and retry guidance.
Logs, metrics, and stats out of the box.

Network Support

NetworkChain IDStatus
Cronos Mainnet25Supported
Cronos Testnet338Supported
Cronos zkEVM388Supported

Next Steps

Agent SDK Guide

Build your first agent

Service SDK Guide

Expose your first service