Skip to main content

Radius AI Agent SDK is an open-source framework for connecting AI agents to the Radius network

Project description

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
pip install radius-ai-agent-sdk

# Required dependencies will be installed automatically:
# pydantic>=2.0.0, asyncio>=3.4.1, typing-extensions>=4.12.2

Prerequisites

  • Python >=3.10
  • pydantic >=2.0.0
  • asyncio >=3.4.1
  • typing-extensions >=4.12.2

Usage

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

from radius.classes.plugin_base import PluginBase
from radius.decorators.tool import Tool
from pydantic import BaseModel

# First, create parameter models using Pydantic
class MyToolParams(BaseModel):
    param1: str = "A string parameter"
    param2: int = "A number parameter"

# Create service class that implements the tool logic
class MyService:
    @Tool({
        "description": "Does something useful",
        "parameters_schema": MyToolParams
    })
    def my_custom_tool(self, params: dict) -> str:
        # Tool implementation
        return f"Processed {params['param1']} with value {params['param2']}"

# Create a custom plugin by extending PluginBase
class MyCustomPlugin(PluginBase):
    def __init__(self):
        # Pass the name and tool providers to the parent constructor
        service = MyService()
        super().__init__("my_custom_plugin", [service])
        self.service = service
    
    # Implement required abstract method
    def supports_chain(self, chain) -> bool:
        # For simplicity, support all chains in this example
        return True

# Create a mock wallet client (simplified for example)
class MockWalletClient:
    def get_address(self):
        return "0x..."
    def get_chain(self):
        return {"type": "evm", "id": 1}
    # Other required wallet methods

# Create an instance of your plugin
my_plugin = MyCustomPlugin()
wallet_client = MockWalletClient()

# Get all tools from the plugin (passing required wallet client)
tools = my_plugin.get_tools(wallet_client)

# Execute a tool
if tools:
    result = tools[0].execute({
        "param1": "test-string",
        "param2": 42
    })
    print(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:

  • __init__(name: str, tool_providers: List[object]): Creates a new plugin with the given name and tool providers

Properties:

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

Methods:

  • get_tools(wallet_client: WalletClientBase): Returns all tools defined in the plugin
  • supports_chain(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:

  • __init__(config: ToolConfig): Creates a new tool with configuration containing name, description, and parameters

Properties:

  • name: The name of the tool
  • description: Description of what the tool does
  • parameters: Pydantic model class defining the tool's parameters

Methods:

  • execute(parameters: dict[str, Any]): Executes the tool with the given parameters

Factory Function:

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

from radius.classes.tool_base import create_tool
from pydantic import BaseModel

class MyParams(BaseModel):
    value: str = "A parameter"

my_tool = create_tool(
    {
        "name": "my_tool",
        "description": "Does something useful",
        "parameters": MyParams
    },
    lambda params: f"Processed {params['value']}"
)

Decorators

@Tool(params)

Decorator for marking methods as AI agent tools.

Parameters:

  • params["name"] (str, optional): The name of the tool (defaults to the method name in snake_case)
  • params["description"] (str): Description of what the tool does
  • params["parameters_schema"] (Type[BaseModel]): Pydantic model class to validate parameters
from radius.decorators.tool import Tool
from pydantic import BaseModel

class AddNumbersParams(BaseModel):
    a: int = "First number"
    b: int = "Second number"

class MathService:
    @Tool({
        "description": "Adds two numbers together",
        "parameters_schema": AddNumbersParams
    })
    def add_numbers(self, params: dict) -> int:
        return params["a"] + params["b"]

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

radius_ai_agent_sdk-1.0.0.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

radius_ai_agent_sdk-1.0.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file radius_ai_agent_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: radius_ai_agent_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for radius_ai_agent_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f3ed63f3a52f85c184c5bb91793c3aaa879ce898bcfaf8e42f0c6c0f77abc045
MD5 a302bf324b2e7c19e3660ed9f43b3d39
BLAKE2b-256 f4d722cf65fd429b8597304d74fc812e0f85f6e74928d02443707f1c68beb978

See more details on using hashes here.

File details

Details for the file radius_ai_agent_sdk-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for radius_ai_agent_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d605faae034839c4085b80eda8cef2784bba07e6d48b8fad7102486f3fd5a6a
MD5 85916a5fac0cf2f8b574cd6b2db934ff
BLAKE2b-256 1c1307a41368dee99295e4543452895e3fb3bf7c7ce83b9749db0ea8c3d48e9f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page