AutoGen plugin for Axon — treasury and payment infrastructure for autonomous AI agents
Project description
autogen-axon
AutoGen plugin for Axon — treasury and payment infrastructure for autonomous AI agents.
Gives AutoGen agents the ability to send payments, swap tokens, execute DeFi protocols, and check vault balances through Axon's non-custodial vault system. Bots never hold funds or pay gas.
Prerequisites
Before using this plugin, you need an Axon vault:
- Go to app.axonfi.xyz and connect your wallet
- Deploy a vault - this is your non-custodial treasury. Only you (the owner) can withdraw.
- Register a bot key - generate a new key pair in the dashboard or bring your own. This is the key your AutoGen agent will sign with. Set a
maxPerTxAmountto cap what the bot can spend per transaction. - Fund the vault - deposit USDC (or any ERC-20) into your vault address.
- Copy your credentials:
vault_address- your deployed vault addressbot_private_key- the bot's private key (the one registered in step 3)chain_id-Chain.Base(8453),Chain.Arbitrum(42161), orChain.BaseSepolia(84532) for testing —from axonfi import Chain
Your bot signs payment intents. It never holds funds, never pays gas, and can only spend within the limits you set. If the bot key is compromised, the attacker is capped by maxPerTxAmount and can only send to whitelisted destinations.
Installation
pip install autogen-axon
Quick Start
import asyncio
from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_axon import get_axon_tools
from axonfi import Chain
# Initialize Axon tools
tools = get_axon_tools(
relayer_url="https://relay.axonfi.xyz",
bot_private_key="0xYOUR_BOT_PRIVATE_KEY",
vault_address="0xYOUR_VAULT_ADDRESS",
chain_id=Chain.Base,
)
# Create an AutoGen agent with Axon tools
agent = AssistantAgent(
name="treasury_agent",
model_client=OpenAIChatCompletionClient(model="gpt-4o"),
tools=tools,
system_message=(
"You are a treasury management agent. You can send payments, "
"swap tokens, and check vault balances using Axon."
),
)
async def main():
response = await agent.run(task="Check my vault balance and total value")
print(response.messages[-1].content)
asyncio.run(main())
Available Tools
| Tool | Description | Parameters |
|---|---|---|
pay |
Send a USDC payment from the vault | to (address), amount ("5.00"), memo (optional) |
swap |
Swap tokens within the vault | from_token ("USDC"), to_token ("WETH"), amount ("100.00") |
execute_protocol |
Execute a DeFi protocol call | target (address), calldata (hex) |
get_balance |
Check vault token balance | token ("USDC", default) |
get_vault_value |
Total vault USD value | (none) |
All amounts are human-readable (e.g. "5.00" for 5 USDC, not "5000000").
How It Works
get_axon_tools()creates a sharedAxonClientSyncand returns a list ofFunctionToolinstances- Pass the tools list to any AutoGen
AssistantAgent - When the agent calls a tool, the SDK signs an EIP-712 intent and submits it to the Axon relayer
- The relayer validates policies, runs AI verification if needed, and executes on-chain
- The tool returns a human-readable result (TX hash, pending review ID, or rejection reason)
Payment Flow
Payments go through Axon's full pipeline:
- Fast path: approved instantly, TX hash returned
- AI review: flagged by spending limits or anomaly detection (~30s)
- Human review: owner notified, must approve/reject manually
from axonfi import Chain
tools = get_axon_tools(
relayer_url="https://relay.axonfi.xyz",
bot_private_key="0x...",
vault_address="0x...",
chain_id=Chain.Base,
)
# The agent decides when and how to use each tool
agent = AssistantAgent(
name="defi_agent",
model_client=OpenAIChatCompletionClient(model="gpt-4o"),
tools=tools,
system_message="You manage a DeFi treasury. Pay invoices, rebalance tokens, and monitor balances.",
)
Supported Chains
| Chain | Chain ID |
|---|---|
| Base | 8453 |
| Arbitrum One | 42161 |
| Base Sepolia (testnet) | 84532 |
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_axon-0.1.1.tar.gz.
File metadata
- Download URL: autogen_axon-0.1.1.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
503415ac16ad592f075cc2118284172e6babd632ff2418f44220fd971567143b
|
|
| MD5 |
f20b0535a476d221395ce8014681fbb2
|
|
| BLAKE2b-256 |
9effdfeda7d5f1ed7d3e46a77f9d4e25b785eb3dd48a0aba873417700ba786c1
|
File details
Details for the file autogen_axon-0.1.1-py3-none-any.whl.
File metadata
- Download URL: autogen_axon-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f6d8cee1227fedf5f91b4a71a365fe68fa28666b685e0c81c61631bfc3023d4
|
|
| MD5 |
549b70ac47a7372be08c212085c7402c
|
|
| BLAKE2b-256 |
a386ea6da2e5dcbda9ccae713134620f93716f3c6c3f3ea8c1fd3f0e11f153b3
|