Skip to main content

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 .env files 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:

  1. Detect the 402 response
  2. Parse payment requirements from headers
  3. Sign a micropayment (if within max_amount_usd)
  4. 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


Download files

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

Source Distribution

autogen_ext_agentwallet-1.0.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

autogen_ext_agentwallet-1.0.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

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

Hashes for autogen_ext_agentwallet-1.0.0.tar.gz
Algorithm Hash digest
SHA256 42856adc95fd08ce1bd69f5c159c6f5b102fbf040becf1e93122bd6e2746ad42
MD5 d1ea8e767e0e01c4267b068885d52b54
BLAKE2b-256 5c6d7b348b749091e7bd2763c9914f9dc523ea6ac4640af7d532a8412bccf1c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for autogen_ext_agentwallet-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a556744300eb93f477e49f9a679eb4201fffedb5822df65d5abb7edd4dbf97a8
MD5 6e10a9dbed179898bf75fd0ea424c400
BLAKE2b-256 a0aa2a3f549b3ca94456d214ae9785dc928cc1bdc482e7acb8acde44edf156f6

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