Non-custodial wallet extension for AutoGen agents — EVM + Solana, x402 payments, CCTP bridge, on-chain spend limits
Project description
autogen-ext-agentwallet
Non-custodial wallet extension for AutoGen agents.
Give your AutoGen agents a real wallet: check balances, send tokens, bridge across 17 chains via CCTP, handle HTTP 402 micropayments, and enforce on-chain spend limits — all without ever handing over custody of your keys.
Features
- EVM balance checks — native ETH and any ERC-20 token
- Token transfers — sign and broadcast transactions directly from the agent
- 17-chain CCTP bridge — USDC bridging via Circle's Cross-Chain Transfer Protocol (Ethereum, Base, Arbitrum, Optimism, Polygon, Avalanche, and more)
- x402 payments — automatic handling of HTTP 402 Payment Required flows
- On-chain spend limits — query AgentAccountV2 contract limits before spending
Installation
pip install autogen-ext-agentwallet
Configuration
Set these environment variables (or pass directly to the toolkit):
WALLET_ADDRESS=0xYourAgentWalletAddress
PRIVATE_KEY=0xYourPrivateKey
RPC_URL=https://mainnet.base.org
CHAIN_ID=8453
Security: Never hardcode your private key. Use
.envfiles or a secrets manager.
Quick Start
import asyncio
from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext_agentwallet import AgentWalletToolkit
# Initialize the toolkit
toolkit = AgentWalletToolkit(
wallet_address="0xYourAgentWalletAddress",
private_key="0xYourPrivateKey",
chain_id=8453, # Base mainnet
rpc_url="https://mainnet.base.org",
)
tools = toolkit.get_tools()
# Create an AutoGen agent with wallet capabilities
agent = AssistantAgent(
name="wallet_agent",
model_client=OpenAIChatCompletionClient(model="gpt-4o"),
tools=tools,
system_message=(
"You are an autonomous agent with a non-custodial wallet. "
"You can check balances, send tokens, bridge assets, and pay for services."
),
)
async def main():
result = await agent.run(task="Check my ETH balance on Base")
print(result)
asyncio.run(main())
Available Tools
WalletBalanceTool
Check native or ERC-20 token balance.
from autogen_ext_agentwallet import WalletBalanceTool
tool = WalletBalanceTool(rpc_url="https://mainnet.base.org", wallet_address="0x...")
# Used automatically by the agent, or call directly:
# result = await tool.run(BalanceInput(address="0x...", token="0xUSDC..."))
WalletTransferTool
Sign and send ETH or ERC-20 tokens.
The agent will construct a transaction, sign it locally (non-custodial), and broadcast it.
WalletBridgeTool
Bridge USDC across chains using Circle's CCTP.
Supported chains: Ethereum (1), Base (8453), Arbitrum (42161),
Optimism (10), Polygon (137), Avalanche (43114), and more.
X402PaymentTool
Handle HTTP 402 payment flows automatically. The agent will:
- Detect the 402 response
- Parse payment requirements from headers
- Sign a micropayment (if within
max_amount_usd) - Retry the request with the payment header
GetSpendLimitsTool
Query on-chain spend limits from an AgentAccountV2 contract.
Using Individual Tools
from autogen_ext_agentwallet import WalletBalanceTool, WalletTransferTool, GetSpendLimitsTool
balance_tool = WalletBalanceTool(
rpc_url="https://mainnet.base.org",
wallet_address="0x...",
)
transfer_tool = WalletTransferTool(
rpc_url="https://mainnet.base.org",
wallet_address="0x...",
private_key="0x...",
chain_id=8453,
)
spend_tool = GetSpendLimitsTool(rpc_url="https://mainnet.base.org")
Supported Chains
| Chain | Chain ID | CCTP Domain |
|---|---|---|
| Ethereum | 1 | 0 |
| Avalanche | 43114 | 1 |
| Optimism | 10 | 2 |
| Arbitrum | 42161 | 3 |
| Base | 8453 | 6 |
| Polygon | 137 | 7 |
License
MIT — see LICENSE
Links
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 autogen_ext_agentwallet-1.0.0.tar.gz.
File metadata
- Download URL: autogen_ext_agentwallet-1.0.0.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42856adc95fd08ce1bd69f5c159c6f5b102fbf040becf1e93122bd6e2746ad42
|
|
| MD5 |
d1ea8e767e0e01c4267b068885d52b54
|
|
| BLAKE2b-256 |
5c6d7b348b749091e7bd2763c9914f9dc523ea6ac4640af7d532a8412bccf1c9
|
File details
Details for the file autogen_ext_agentwallet-1.0.0-py3-none-any.whl.
File metadata
- Download URL: autogen_ext_agentwallet-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a556744300eb93f477e49f9a679eb4201fffedb5822df65d5abb7edd4dbf97a8
|
|
| MD5 |
6e10a9dbed179898bf75fd0ea424c400
|
|
| BLAKE2b-256 |
a0aa2a3f549b3ca94456d214ae9785dc928cc1bdc482e7acb8acde44edf156f6
|