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

@radiustechsystems/ai-agent-core

v1.0.4

Published

Core abstractions and base classes for the Radius AI Agent Toolkit

Readme

Radius AI Agent Toolkit - Core

Core abstractions and base classes for the Radius AI Agent Toolkit. This package provides the foundation for building AI agent tools and plugins for interacting with the Radius platform.

This package is part of the Radius AI Agent Toolkit, which provides tools for integrating AI agents with the Radius platform.

Installation

# Install this specific package
npm install @radiustechsystems/ai-agent-core

# Peer dependencies
npm install zod reflect-metadata

Prerequisites

  • Node.js >=20.12.2 <23
  • TypeScript configuration with:
    • experimentalDecorators: true
    • emitDecoratorMetadata: true

Example tsconfig.json:

{
  "compilerOptions": {
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    // ... other options
  }
}

Usage

The core package provides base classes and decorators for building AI agent tools and plugins:

import { PluginBase, Tool, createToolParameters } from "@radiustechsystems/ai-agent-core";
import { z } from "zod";

// First, create parameter types using createToolParameters
const MyToolParams = createToolParameters(
  z.object({
    param1: z.string().describe("A string parameter"),
    param2: z.number().describe("A number parameter")
  })
);

// Create service class that implements the tool logic
class MyService {
  @Tool({
    description: "Does something useful"
  })
  async myCustomTool(params: MyToolParams): Promise<string> {
    // Tool implementation
    return `Processed ${params.param1} with value ${params.param2}`;
  }
}

// Create a custom plugin by extending PluginBase
class MyCustomPlugin extends PluginBase {
  private service: MyService;
  
  constructor() {
    // Pass the name and tool providers to the parent constructor
    const service = new MyService();
    super("my_custom_plugin", [service]);
    this.service = service;
  }
  
  // Implement required abstract method
  supportsChain(chain: any): boolean {
    // For simplicity, support all chains in this example
    return true;
  }
}

// Create a mock wallet client (simplified for example)
class MockWalletClient {
  getAddress() { return "0x..."; }
  getChain() { return { type: "evm", id: 1 }; }
  // Other required wallet methods
}

// Create an instance of your plugin
const myPlugin = new MyCustomPlugin();
const walletClient = new MockWalletClient();

// Get all tools from the plugin (passing required wallet client)
const tools = myPlugin.getTools(walletClient);

// Execute a tool
if (tools.length > 0) {
  const result = await tools[0].execute({
    param1: "test-string",
    param2: 42
  });
  console.log(result); // "Processed test-string with value 42"
}

API Reference

Base Classes

PluginBase

Abstract base class for creating Radius AI agent plugins. Plugins provide a way to organize related tools.

Constructor:

  • constructor(name: string, toolProviders: object[]): Creates a new plugin with the given name and tool providers

Properties:

  • name: The name of the plugin
  • toolProviders: Array of objects that provide tools (using the @Tool decorator)

Methods:

  • getTools(walletClient: WalletClientBase): Returns all tools defined in the plugin
  • supportsChain(chain: Chain): Abstract method that must be implemented to check if the plugin supports a chain

ToolBase

Base class for creating standalone AI agent tools. Tools created with this class can be used directly without a plugin.

Constructor:

  • constructor(options: { name: string; description: string; parameters: z.ZodSchema }, executeFunction: (params: any) => Promise<any>): Creates a new tool

Properties:

  • name: The name of the tool
  • description: Description of what the tool does
  • parameters: Zod schema defining the tool's parameters

Methods:

  • execute(params: unknown): Executes the tool with the given parameters

Factory Function:

The createTool function can be used to create a new ToolBase instance:

import { createTool } from "@radiustechsystems/ai-agent-core";
import { z } from "zod";

const myTool = createTool(
  {
    name: "my_tool",
    description: "Does something useful",
    parameters: z.object({
      value: z.string().describe("A parameter")
    })
  },
  async (params) => {
    // Tool implementation
    return `Processed ${params.value}`;
  }
);

Decorators

@Tool(params)

Decorator for marking methods as AI agent tools.

Parameters:

  • params.name (string, optional): The name of the tool (defaults to the method name in snake_case)
  • params.description (string): Description of what the tool does

Utility Functions

createToolParameters(schema)

Creates a class with a static schema property that can be used as a parameter type for tools.

Parameters:

  • schema (z.ZodSchema): Zod schema defining the tool's parameters

Returns:

  • A class that can be used as a parameter type for tools

Example:

import { createToolParameters } from "@radiustechsystems/ai-agent-core";
import { z } from "zod";

// Create parameter type
const MyParams = createToolParameters(
  z.object({
    name: z.string().describe("The name parameter"),
    value: z.number().describe("The value parameter")
  })
);

// Use in a tool method
@Tool({
  description: "Example tool"
})
async myTool(params: MyParams): Promise<string> {
  // Params are fully typed
  return `Name: ${params.name}, Value: ${params.value}`;
}

Integration Examples

For complete examples integrating this package with AI frameworks, see:

Related Packages

Resources

Contributing

Please see the Contributing Guide for detailed information about contributing to this toolkit.

License

This project is licensed under the MIT License.