Skip to content

Agent402 for the GAME Python SDK

Product names on this page are trademarks of their owners. agent402-worker-functions is an independent package published by Cardhavok LLC (doing business as Havok Holdings LLC); it is not affiliated with, sponsored by or endorsed by Virtuals Protocol.

agent402-worker-functions · PyPI · MIT

The Python package: a WorkerConfig whose action space holds game_sdk Functions for the four catalog functions (search, find, call, about) and the flagship tools. Pure-CPU tools are free through the built-in proof-of-work; wallet-only tools settle in USDC through a signing callable you pass in.

Install

pip install "agent402-worker-functions[game]"

Example

import os
from game_sdk.game.agent import Agent
from agent402_worker_functions import agent402_worker_config

worker = agent402_worker_config()
agent = Agent(
    api_key=os.environ["GAME_API_KEY"],
    name="Researcher",
    agent_goal="Answer questions with live web data",
    agent_description="Finds and runs Agent402 tools",
    get_agent_state_fn=lambda result, state: {},
    workers=[worker],
)
agent.compile()
agent.step()

What it exposes

  • agent402_search, agent402_find and agent402_about (free), and agent402_call (pays per tool).
  • One function per flagship tool the server lists, its input fields as arguments.
  • agent402_function_specs() returns every function as a plain dict with no game-sdk dependency.

How payment works

  • Pure-CPU tools settle with proof-of-work: no wallet, no API key.
  • Wallet-only tools need x402_fetch; without it a call to one fails with payment_required before any payment is made, and the free tier keeps working.
  • max_per_call_usd (default 5) and the opt-in daily_limit_usd are checked against the listed price before x402_fetch is used.
# x402_fetch: a callable with the requests-style signature
# (method, url, **kwargs) -> requests.Response that signs the USDC payment
# from a fresh spending key holding a small balance
worker = agent402_worker_config(x402_fetch=my_signed_fetch, max_per_call_usd=0.05, daily_limit_usd=1)

A paid call that ends in any status of 400 or above is not charged over x402: settlement runs after the tool and only on a successful response. Some calls are paid before they run; a failed one can be retried free with the same payment, or is refunded. Background: What x402 is · MPP (Machine Payments Protocol).

Tools to try first

Every tool, price and input schema: our tools.

Links