agent-wallet (Python)
Universal multi-chain signing SDK for AI agents — Python implementation.
Install
pip install bankofai-agent-wallet
Includes CLI (agent-wallet), EVM and TRON support — no extras needed.
Quick Start
from agent_wallet import resolve_wallet
wallet = await resolve_wallet(network="tron:nile")
signature = await wallet.sign_message(b"hello")
resolve_wallet automatically finds your wallet config in ~/.agent-wallet (or AGENT_WALLET_DIR).
Public API
from agent_wallet import (
resolve_wallet, # → Wallet (one-shot)
resolve_wallet_provider, # → ConfigWalletProvider | EnvWalletProvider
ConfigWalletProvider, # file-backed provider (local_secure / raw_secret)
EnvWalletProvider, # env-var-backed provider (AGENT_WALLET_PRIVATE_KEY)
)
resolve_wallet
Returns a ready-to-sign Wallet for the given network:
wallet = await resolve_wallet(network="eip155:1")
sig = await wallet.sign_transaction({"to": "0x...", "value": 0})
resolve_wallet_provider
Returns either ConfigWalletProvider or EnvWalletProvider based on what's available:
provider = resolve_wallet_provider(network="eip155:1")
# Get the active wallet
wallet = await provider.get_active_wallet()
# Or a specific wallet
wallet = await provider.get_wallet("my_wallet", network="tron:nile")
Provider resolution order
- Password available (from
runtime_secrets.jsonorAGENT_WALLET_PASSWORD) →ConfigWalletProvider wallets_config.jsonexists with wallets →ConfigWalletProvider- Otherwise →
EnvWalletProvider(readsAGENT_WALLET_PRIVATE_KEY/AGENT_WALLET_MNEMONIC)
Wallet Interface
class Wallet(ABC):
async def get_address() -> str
async def sign_raw(raw_tx: bytes) -> str
async def sign_transaction(payload: dict) -> str
async def sign_message(msg: bytes) -> str
class Eip712Capable(ABC):
async def sign_typed_data(data: dict) -> str
Both EVM and TRON network-specific signers implement Wallet + Eip712Capable.
Network Routing
| Network string | Adapter | Mnemonic derivation |
|---|---|---|
eip155 or eip155:<chainId> |
EVM | m/44'/60'/0'/0/{index} |
tron or tron:<chain> |
TRON | m/44'/195'/0'/0/{index} |
Environment Variables
| Variable | Description |
|---|---|
AGENT_WALLET_DIR |
Wallet directory (default ~/.agent-wallet) |
AGENT_WALLET_PASSWORD |
Password for local_secure wallets |
AGENT_WALLET_PRIVATE_KEY |
Env fallback private key (hex) |
AGENT_WALLET_MNEMONIC |
Env fallback mnemonic phrase |
AGENT_WALLET_MNEMONIC_ACCOUNT_INDEX |
Mnemonic account index (default 0) |
Examples
- tron_sign_and_broadcast.py
- bsc_sign_and_broadcast.py
- tron_x402_sign_typed_data.py
- bsc_x402_sign_typed_data.py
- dual_sign_typed_data_from_private_key.py
- switch_active_wallet.py
Development
pip install -e ".[dev]"
pytest
License
MIT — BankOfAI
Metadata
Release files for bankofai-agent-wallet 2.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bankofai_agent_wallet-2.4.0.tar.gz | 29.5 kB | Without provenance | Details for bankofai_agent_wallet-2.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bankofai_agent_wallet-2.4.0-py3-none-any.whl | Python 3 | none | any | Details for bankofai_agent_wallet-2.4.0-py3-none-any.whl |
Total release size: 71.1 kB
Release files / bankofai_agent_wallet-2.4.0.tar.gz
| Download URL | bankofai_agent_wallet-2.4.0.tar.gz |
|---|---|
| Size | 29.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2889b5204f1575c53ba3ccaa98eb7d495655170cc95e9f05b07d4ddf6f91edab
|
|
BLAKE2b-256 checksum How to use checksums |
0ffc01a105846bd82fa6d6839c207d5fca6de0d32584e461a7e7a83f3bf2ffcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / bankofai_agent_wallet-2.4.0-py3-none-any.whl
| Download URL | bankofai_agent_wallet-2.4.0-py3-none-any.whl |
|---|---|
| Size | 41.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c9121bc992471887fb58f2c39c1b4e369130305b966d181493f85dc93e105abb
|
|
BLAKE2b-256 checksum How to use checksums |
fd276b2a428148338248d02bc44a953e557c209fa95f219a0ac54f70225ac107
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for bankofai-agent-wallet 2.4.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.