Skip to main content

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:

  1. Go to app.axonfi.xyz and connect your wallet
  2. Deploy a vault - this is your non-custodial treasury. Only you (the owner) can withdraw.
  3. 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 maxPerTxAmount to cap what the bot can spend per transaction.
  4. Fund the vault - deposit USDC (or any ERC-20) into your vault address.
  5. Copy your credentials:
    • vault_address - your deployed vault address
    • bot_private_key - the bot's private key (the one registered in step 3)
    • chain_id - Chain.Base (8453), Chain.Arbitrum (42161), or Chain.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

  1. get_axon_tools() creates a shared AxonClientSync and returns a list of FunctionTool instances
  2. Pass the tools list to any AutoGen AssistantAgent
  3. When the agent calls a tool, the SDK signs an EIP-712 intent and submits it to the Axon relayer
  4. The relayer validates policies, runs AI verification if needed, and executes on-chain
  5. 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


Download files

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

Source Distribution

autogen_axon-0.1.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

autogen_axon-0.1.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

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

Hashes for autogen_axon-0.1.1.tar.gz
Algorithm Hash digest
SHA256 503415ac16ad592f075cc2118284172e6babd632ff2418f44220fd971567143b
MD5 f20b0535a476d221395ce8014681fbb2
BLAKE2b-256 9effdfeda7d5f1ed7d3e46a77f9d4e25b785eb3dd48a0aba873417700ba786c1

See more details on using hashes here.

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

Hashes for autogen_axon-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4f6d8cee1227fedf5f91b4a71a365fe68fa28666b685e0c81c61631bfc3023d4
MD5 549b70ac47a7372be08c212085c7402c
BLAKE2b-256 a386ea6da2e5dcbda9ccae713134620f93716f3c6c3f3ea8c1fd3f0e11f153b3

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