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 plugintool_providers: Array of objects that provide tools (using the@Tooldecorator)
Methods:
get_tools(wallet_client: WalletClientBase): Returns all tools defined in the pluginsupports_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 tooldescription: Description of what the tool doesparameters: 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 doesparams["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
- radius-ai-agent-sdk-wallet-evm: Wallet functionality for interacting with EVM blockchains
- radius-ai-agent-sdk-adapter-langchain: Adapter for LangChain integration
- radius-ai-agent-sdk-plugin-erc20: Plugin for ERC20 token interactions
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3ed63f3a52f85c184c5bb91793c3aaa879ce898bcfaf8e42f0c6c0f77abc045
|
|
| MD5 |
a302bf324b2e7c19e3660ed9f43b3d39
|
|
| BLAKE2b-256 |
f4d722cf65fd429b8597304d74fc812e0f85f6e74928d02443707f1c68beb978
|
File details
Details for the file radius_ai_agent_sdk-1.0.0-py3-none-any.whl.
File metadata
- Download URL: radius_ai_agent_sdk-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d605faae034839c4085b80eda8cef2784bba07e6d48b8fad7102486f3fd5a6a
|
|
| MD5 |
85916a5fac0cf2f8b574cd6b2db934ff
|
|
| BLAKE2b-256 |
1c1307a41368dee99295e4543452895e3fb3bf7c7ce83b9749db0ea8c3d48e9f
|