Skip to main content

CrewAI toolkit for Axon — treasury and payment infrastructure for autonomous AI agents

Project description

crewai-axon

CrewAI toolkit for Axon — treasury and payment infrastructure for autonomous AI agents.

Gives your CrewAI agents the ability to send payments, swap tokens, interact with DeFi protocols, and check vault balances — all through non-custodial Axon vaults with gasless EIP-712 signing.

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 CrewAI 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 crewai-axon

Quick Start

from crewai import Agent, Task, Crew
from crewai_axon import AxonToolkit
from axonfi import Chain

# Initialize the toolkit
toolkit = AxonToolkit(
    vault_address="0x05c6ab8c7b0b1bb42980d9b6a4cb666f0af424c7",
    chain_id=Chain.BaseSepolia,
    bot_private_key="0x...",
)

# Create an agent with Axon tools
agent = Agent(
    role="Treasury Manager",
    goal="Manage vault funds and execute payments",
    backstory="You manage an on-chain treasury vault for an AI agent fleet.",
    tools=toolkit.get_tools(),
)

# Example: check balance and send payment
task = Task(
    description="Check the USDC balance in the vault, then send 5.00 USDC to 0xRecipient...",
    expected_output="Transaction hash of the payment",
    agent=agent,
)

crew = Crew(agents=[agent], tasks=[task])
result = crew.kickoff()

Available Tools

Tool Description
axon_pay Send a payment from the vault (e.g. 5.00 USDC to a recipient)
axon_swap Swap tokens within the vault (e.g. 10.00 USDC to WETH)
axon_execute_protocol Call a DeFi protocol contract through the vault
axon_get_balance Check the vault balance for a specific token
axon_get_vault_value Get total USD value of the vault with per-token breakdown

All amounts are human-readable (e.g. 5.00 for 5 USDC, not 5000000).

Configuration

Raw Private Key

from axonfi import Chain

toolkit = AxonToolkit(
    vault_address="0x...",
    chain_id=Chain.BaseSepolia,
    bot_private_key="0x...",
)

Keystore File

from axonfi import Chain

toolkit = AxonToolkit(
    vault_address="0x...",
    chain_id=Chain.BaseSepolia,
    bot_keystore="bot-keystore.json",
    bot_passphrase="your-passphrase",
)

Custom Relayer URL

from axonfi import Chain

toolkit = AxonToolkit(
    vault_address="0x...",
    chain_id=Chain.BaseSepolia,
    bot_private_key="0x...",
    relayer_url="https://relay.axonfi.xyz",
)

Tool Details

PayTool (axon_pay)

Send a payment from the vault to any recipient address.

Parameters:
  to       — Recipient address (0x...)
  amount   — Human-readable amount (e.g. 5.00 for 5 USDC)
  token    — Token symbol, default "USDC"
  memo     — Optional payment description

SwapTool (axon_swap)

Swap tokens within the vault. Output stays in the vault (rebalancing).

Parameters:
  from_token — Source token symbol (e.g. USDC)
  to_token   — Target token symbol (e.g. WETH)
  amount     — Human-readable amount of source token to swap

ExecuteProtocolTool (axon_execute_protocol)

Call a DeFi protocol contract through the vault (approve/call/revoke pattern).

Parameters:
  target   — Protocol contract address (0x...)
  calldata — ABI-encoded function calldata (0x...)
  token    — Token to approve, default "USDC"
  amount   — Approval amount in human-readable units
  memo     — Optional description

GetBalanceTool (axon_get_balance)

Check how much of a token the vault holds.

Parameters:
  token — Token symbol, default "USDC"

GetVaultValueTool (axon_get_vault_value)

Get the total USD value of the vault with a per-token breakdown. No parameters required.

How It Works

  1. Your CrewAI agent decides to use a tool (e.g. axon_pay)
  2. The tool signs an EIP-712 intent using the bot's private key
  3. The signed intent is submitted to the Axon relayer
  4. The relayer validates policies, runs AI verification if needed, and executes on-chain
  5. The bot never holds funds or pays gas

Supported Chains

Chain Chain ID
Base Sepolia (testnet) 84532
Base 8453
Arbitrum One 42161

License

MIT

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

crewai_axon-0.1.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

crewai_axon-0.1.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file crewai_axon-0.1.1.tar.gz.

File metadata

  • Download URL: crewai_axon-0.1.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.16

File hashes

Hashes for crewai_axon-0.1.1.tar.gz
Algorithm Hash digest
SHA256 26e5aeca8873833151c2d330bdaba5556522a65efb366c2cf5d27bcec5b4c7b9
MD5 b6b7f2a173e9b5c788f5f50abbd685b4
BLAKE2b-256 02e14c98ce0b9dd5aba9065813135dbce6308ea56377e731d73ee6c5fdbaa675

See more details on using hashes here.

File details

Details for the file crewai_axon-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: crewai_axon-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.16

File hashes

Hashes for crewai_axon-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cc2d72179190bbec946308321fa617520398d1ce6fe8d2ec126654aea34ddd32
MD5 de720e31b9fc0e9f48bd901df18fe0d3
BLAKE2b-256 f42a99c65d383359e9964a59b2187b07ea8c09d458df9bcba984b67aca14a5ed

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