Basic Usage

Getting Started with Axicov SDK

The Axicov SDK allows you to create, customize, and interact with AI agents programmatically. This guide will help you install the SDK, set up your environment, and create your first agent with custom tools.

Installation

Install the Axicov SDK using npm:

npm install axicov-sdk

Or using yarn:

yarn add axicov-sdk

Prerequisites

The SDK requires:

  • Node.js 16 or higher

  • API keys for one of the supported AI models (Anthropic or Google Gemini)

  • MongoDB (optional, for persistent state)

Environment Setup

Create a .env file in your project root with the following variables:

# Choose one of these API keys
ANTHROPIC_API_KEY=your_anthropic_api_key
GEMINI_API_KEY=your_gemini_api_key

# Optional for MongoDB checkpoint storage
MONGO_URI=your_mongodb_connection_string

Basic Usage

Here's a simple example to create and interact with an agent:

import { Agent } from "axicov-sdk";
import { customToolRegistry } from "./tools/customToolRegistry";

const runAgent = async () => {
  try {
    const agent = new Agent({
      threadId: "hello-123",
      params: {
        name: "Axicov",
      },
    });
    await agent.initialize({
      toolNumbers: [0],
      coreRegistry: [],
      allRegistry: [customToolRegistry],
      checkPointer: "local",
    });
    console.log("hello");
    const res = await agent.messageAgent(
      "Hello, what can you do?"
    );
    console.log(res);
    return res;
  } catch (err) {
    console.log(err);
  }
};

runAgent();

Key Features

Agent Management

The Agent class is the core of the SDK, allowing you to:

  • Create AI agents with customizable parameters

  • Initialize them with specific tools

  • Send and receive messages

  • Maintain conversation state

Tool Registry System

Every agent can be equipped with tools that extend its capabilities:

  • Core tools: Essential functionality for all agents

  • Custom tools: Specialized capabilities for specific use cases

  • Tool selection: Choose which tools to include by index

Parameter Management

The Agent class uses two different parameter objects:

  1. params: For persistent configuration data that should be stored in a database

    • Set during agent creation

    • Includes name, instructions, wallet addresses, etc.

    • Can be accessed and modified by tools when changes need to persist

  2. runtimeParams: For temporary data generated during execution

    • Set during runtime, often by tools

    • Contains session-specific information

    • Used to share data between tool calls within a session

Thread Management

Each conversation with an agent has its own thread context:

  • threadId: Unique identifier for the conversation

  • Thread context utilities: Help manage state within a thread

  • Support for both in-memory and MongoDB-based persistence

Next Steps

Last updated