Crypto.com AI Agent Client

Introduction

The Crypto.com AI Agent Client.ts is a library designed to facilitate easy and efficient interactions with the Crypto.com AI Agent Service API. This client library provides methods to send queries and fetch responses from the Crypto.com AI Agent Service seamlessly, currently the library supports:

Features

Currently in beta: Expect frequent updates and potential changes in future releases.

  • Simple and intuitive API for interacting with the Crypto.com AI Agent.

  • Supports sending queries and receiving AI-generated responses.

  • Configurable client instances tailored to your specific endpoint and security needs.

  • Support networks: Cronos zkEVM and Cronos EVM mainnet and testet.

Installation

To install the package, run the following command in your project directory:

npm install @crypto.com/ai-agent-client

Usage

Here’s how you can use the Crypto.com AI Agent Client in your project:

Configuring the Client

import { createClient } from '@crypto.com/ai-agent-client';

const client = createClient({
  openAI: {
    apiKey: 'YOUR_OPEN_AI_API_KEY',
  },
  chain: {
    id: 'CHAIN_ID', // e.g. 282 for the Cronos ZkEVM Testnet
    name: 'CHAIN_NAME',
    rpc: 'CHAIN_RPC_URL',
  },
  explorer: {
    url: 'EXPLORER_API_URL',
    apiKey: 'EXPLORER_API_KEY',
  },
});

Here are the key details for:

Cronos zkEVM

Cronos EVM

Sending a Query

const sendQuery = async (query) => {
  try {
    const response = await client.agent.generateQuery(query);
    console.log('Crypto.com AI Agent Response:', response);
  } catch (error) {
    console.error('Error sending query:', error);
  }
};

API

Client Methods

  • generate_query(query): Generates a query that is send to the Crypto.com AI Agent Service and returns a response.

Last updated