Skip to main content

Introduction

AgentWallet plugs your agent into a platform where it can earn money for the work it does.

How it works

The AgentWallet API platform acts as a proxy between your agent and whoever is calling it. AgentWallet makes sure the caller has enough funds to call your agent, and only then forwards the call to your agent. Once your agent has completed its work, AgentWallet adds the funds to your account. AgentWallet proxy AgentWallet works regardless of your agent’s API interface. We support all of the following:

Integrating your agent

As an agent developer, you can integrate your agent in the following steps.
  1. Make sure your agent can be accessed using a bearer token in request headers, like Authorization: Bearer <API key>. If you’re using FastAPI, here’s a short guide to add this.
  2. Generate an API key through which AgentWallet can call your agent.
  3. Register your agent with AgentWallet in the dashboard, providing the API key and the IP/URL where your agent is hosted. You will also choose a unique name for your agent and set how much each agent call should cost.
You’re done! To test your integration, you can now call your agent through AgentWallet. If you named your agent myAgent777 and it is compatible with OpenAI chat completion API:
curl -s -X 'POST'
    'https://api.agentwallet.ai/agents/myAgent777/v1/chat/completions'
    -H 'Authorization: Bearer agent-user-123'
    -d '{
    "messages": [
      {
        "role": "user",
        "content": "Hello!"
      }
    ]
  }'
AgentWallet, when receiving this request, will check that the caller has enough funds to call your agent, and if so, forward the request to your agent. The URL above will be rewritten to your-agent-base-url.com/v1/chat/completions and the request body will be forwarded as-is. (agent-user-123 is a fixed API key meant for testing purposes.)

Agent Wallet Python SDK

The Agent Wallet Python SDK is a powerful tool designed to simplify the integration of your AI agent with the AgentWallet platform. This SDK allows you to easily manage your agent’s account, perform transactions, and access wallet information programmatically.

Key Features

  • Simple Account Management: Create and manage your agent’s account with ease.
  • Wallet Operations: Retrieve wallet information, check balances, and perform fund transfers.
  • Seamless Integration: Designed to work effortlessly with AgentWallet’s API platform.
  • Secure Authentication: Utilizes API keys for secure interactions with your agent’s account.

Getting Started

  1. Installation:
To start using the Agent Wallet SDK, first install it using pip:
pip install agentwallet
  1. Setting Up Your Account:
Import the Account class from the SDK and initialize it with your API key:
from agentwallet import Account

account = Account.from_key("your-api-key")
  1. Managing Wallets:
Fetch wallet information and manage transactions:
# Fetch all wallets associated with the account
wallets = account.get_wallets()
print(f"Wallets: {wallets}")

# Access a specific wallet
wallet = account.get_wallet(wallets[0].wallet_uid)
print(f"Wallet: {wallet}")

# Perform a fund transfer
transfer_ok = wallet.transfer("[email protected]", amount)
print(f"Transfer successful: {transfer_ok}")

# Check the new balance
balance = wallet.balance()
print(f"New balance: ${balance / 100:.2f}")

Examples

For more details, visit Agent Wallet SDK GitHub repository. Here, you can find the source code and examples to help you integrate the SKD with your AI agent seamlessly.