Guides
Add Payments to Your Google ADK Agent
Integrate Wallgent financial tools into a Google Agent Development Kit agent.
The Wallgent Python SDK ships in Phase 4. This guide shows the planned API so you can plan your integration today. See the REST fallback section below to get started now.
Prerequisites
- A Wallgent account and API key (get one here)
- Python 3.9+
1. Install
pip install wallgent google-adk2. Define Tool Functions
The Google ADK uses plain Python functions as tools. Return strings for the agent to consume:
from wallgent import Wallgent
wg = Wallgent(api_key="wg_test_your_key_here")
def check_balance(wallet_id: str) -> str:
"""Check the available balance of a Wallgent wallet.
Args:
wallet_id: The ID of the wallet to check.
"""
balance = wg.wallets.get_balance(wallet_id)
return f"Available: ${balance.available}, Pending: ${balance.pending}"
def send_payment(from_wallet: str, to_wallet: str, amount: str, description: str) -> str:
"""Send a payment between two Wallgent wallets.
Args:
from_wallet: Source wallet ID.
to_wallet: Destination wallet ID.
amount: Amount in USD (e.g. "25.00").
description: Payment description.
"""
txn = wg.payments.send(
from_wallet=from_wallet,
to_wallet=to_wallet,
amount=amount,
description=description,
)
return f"Payment {txn.id} — status: {txn.state}"3. Create the Agent
from google.adk.agents import Agent
finance_agent = Agent(
name="finance_agent",
model="gemini-2.0-flash",
instruction="You are a financial agent. Use the available tools to manage wallets and send payments.",
tools=[check_balance, send_payment],
)4. Test Locally
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
runner = Runner(
agent=finance_agent,
app_name="wallgent_demo",
session_service=InMemorySessionService(),
)
# Send a message
response = runner.run(
user_id="user_1",
session_id="session_1",
new_message="Check the balance of wal_ops, then send $15 to wal_vendor.",
)
print(response)REST Fallback
You can use Wallgent with Google ADK today by wrapping REST API calls:
import requests
API_KEY = "wg_test_your_key_here"
BASE = "https://api.wallgent.com"
HEADERS = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
}
def check_balance(wallet_id: str) -> str:
"""Check the available balance of a Wallgent wallet."""
resp = requests.get(f"{BASE}/v1/wallets/{wallet_id}/balance", headers=HEADERS)
data = resp.json()
return f"Available: ${data['available']}, Pending: ${data['pending']}"
def send_payment(from_wallet: str, to_wallet: str, amount: str, description: str) -> str:
"""Send a payment between two Wallgent wallets."""
resp = requests.post(
f"{BASE}/v1/payments",
headers=HEADERS,
json={"from": from_wallet, "to": to_wallet, "amount": amount, "description": description},
)
data = resp.json()
return f"Payment {data['id']} — status: {data['state']}"Next Steps
- Explore spending policies to control agent budgets
- Set up webhooks for real-time payment notifications
- See the full REST API Reference for all available endpoints