Skip to main content

Radius AI Agent SDK - Web3 Wallet

The Radius Web3 Wallet package provides a simple, unified interface for interacting with Radius from AI agents using Web3.py. It offers a Python implementation of wallet operations that integrate seamlessly with AI agent frameworks.

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

Installation

pip install radius-ai-agent-sdk-wallet-web3

Prerequisites

  • Python >=3.10
  • Access to a Radius RPC endpoint
  • A funded private key for the Radius network
  • web3 >=6.20.3
  • radius-ai-agent-sdk >=0.1.0
  • radius-ai-agent-sdk-wallet-evm >=0.1.0

Usage

from web3 import Web3
from radius_wallets.web3 import web3
from radius_wallets.evm import send_eth

# Create a Web3 instance
w3 = Web3(Web3.HTTPProvider(RPC_PROVIDER_URL))
w3.eth.default_account = w3.eth.account.from_key(WALLET_PRIVATE_KEY).address
w3.eth.default_local_account = w3.eth.account.from_key(WALLET_PRIVATE_KEY)

# Create a Radius wallet
wallet = web3(w3)

# Get wallet address
address = wallet.get_address()
print(f"Wallet address: {address}")

# Check wallet balance
balance = wallet.balance_of(address)
print(f"Balance: {balance['value']} {balance['symbol']}")

# Create sendETH function
send_eth_tool = send_eth.send_eth()

# Use the send_eth tool
transaction = await send_eth_tool(
    wallet=wallet,
    to="0xRecipientAddress",
    amount="0.01",
    wait_for_receipt=True
)

API Reference

web3(client, options=None)

Creates a new Web3EVMWalletClient instance.

Parameters:

  • client (Web3): Configured Web3.py client instance
  • options (Web3Options, optional): Configuration options

Returns:

  • A Web3EVMWalletClient instance that can be used with AI agent tools

send_eth.send_eth()

Creates a function that enables ETH transfer functionality for AI agents.

Returns:

  • A tool function that can be used to send ETH

Wallet Methods

wallet.get_address()

Returns the wallet's address.

wallet.balance_of(address)

Returns the balance info for the specified address, including value, symbol, and other details.

wallet.send_transaction(transaction)

Sends a transaction to the network.

Parameters:

  • transaction (EVMTransaction): Transaction parameters including to, value, and optional contract interaction details

wallet.read(request)

Reads data from a smart contract without modifying state.

Parameters:

  • request (EVMReadRequest): Request parameters including address, functionName, abi, and optional args

wallet.sign_message(message)

Signs a given message using the wallet's private key.

wallet.sign_typed_data(data)

Signs EIP-712 typed data.

Advanced Usage

Smart Contract Interactions

# Read from a contract
result = wallet.read({
    "address": "0xContractAddress",
    "functionName": "balanceOf",
    "args": ["0xUserAddress"],
    "abi": [...] # Contract ABI
})

# Write to a contract
tx = wallet.send_transaction({
    "to": "0xContractAddress",
    "functionName": "transfer",
    "args": ["0xRecipient", 1000000000000000000],  # 1 ETH in wei
    "abi": [...] # Contract ABI
})

ENS Resolution

# Resolve ENS name to address
address = wallet.resolve_address("vitalik.eth")
print(f"Resolved address: {address}")

Integration Examples

For a complete example integrating this package with AI frameworks, see:

Development Setup

1. Clone the Repository

git clone git@github.com:radiustechsystems/ai-agent-toolkit.git
cd ai-agent-toolkit/python/src/wallets/web3

2. Install Development Dependencies

pip install -e ".[dev]"

3. Run Tests

pytest

Resources

Contributing

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

License

This project is licensed under the MIT License

Metadata

Release files for radius-ai-agent-sdk-wallet-web3 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for radius-ai-agent-sdk-wallet-web3 1.0.0
File Size Uploaded Provenance Actions
radius_ai_agent_sdk_wallet_web3-1.0.0.tar.gz 8.5 kB Without provenance Details for radius_ai_agent_sdk_wallet_web3-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for radius-ai-agent-sdk-wallet-web3 1.0.0
File Interpreter ABI Platform Actions
radius_ai_agent_sdk_wallet_web3-1.0.0-py3-none-any.whl Python 3 none any Details for radius_ai_agent_sdk_wallet_web3-1.0.0-py3-none-any.whl

Total release size: 14.5 kB

Release files / radius_ai_agent_sdk_wallet_web3-1.0.0.tar.gz

Download URL radius_ai_agent_sdk_wallet_web3-1.0.0.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7c46a1e9cfd070bcca3fbd1e730b538c3f7e8ecd4d0ca594ea48506e4af9c442
BLAKE2b-256 checksum
How to use checksums
b05a89bb150ef9207f1958e235b8a37a4c7607f3a06d6efd8bafcb775371efb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.2

Release files / radius_ai_agent_sdk_wallet_web3-1.0.0-py3-none-any.whl

Download URL radius_ai_agent_sdk_wallet_web3-1.0.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
74d27e42ad84191c542ca9334f43c0341fb270d9bda4cdb12c18e0a8df56074c
BLAKE2b-256 checksum
How to use checksums
a466fa1b7b5e0f055e0608a35d046a83d5c993e7280979a7511efd5e8fd60354
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.2

Security for radius-ai-agent-sdk-wallet-web3 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page