Skip to main content
AGNO INTEGRATION

Agno payment integration.

There is no Agno package, and you do not need one. Wrap the real blockchain0x client in a small Toolkit and your agent can move USDC on Base - minimal abstraction, the Agno way.

SHORT ANSWER

There is no Agno-specific package, and you do not need one. Agno turns a method into a tool, so you wrap the real Python client in a small toolkit and add it to your . The agent can send USDC, settle invoices, and read wallets, across every Agno model (OpenAI, Anthropic, DeepSeek, Llama, Mistral). Payments settle on Base.

WHY AGNO

The lightweight Python framework. No abstraction tax.

Agno (formerly Phidata) is the agent framework you reach for when you want minimal ceremony. There is no Graph builder, no Crew, no Workflow - just Agent, Tools, and a run() method. Tools are Python callables. The framework adds enough scaffolding to call LLMs with tool support, manage memory, and produce streaming output, then gets out of your way.

The recipe follows the same philosophy. You write a small Toolkit subclass that registers one method calling the real client - it looks and behaves like every other Agno tool. No special setup beyond instantiation, no graph to wire up, no adapter version to track. The simplicity is the point: if you wanted graphs you would be on LangGraph.

INSTALLATION

Install Agno and the core SDK. Two keys.

There is no blockchain0x Agno package to add. You install Agno (Python 3.10+, the 1.0+ line after the Phidata rename) and the real blockchain0x core SDK, then write the toolkit below. If you are still on phi.* imports, run pip install -U agno first.

INSTALL
pip install agno blockchain0x
ENVIRONMENT VARIABLES
export OPENAI_API_KEY=sk-...
export BLOCKCHAIN0X_API_KEY=sk_test_...   # sk_test_ = Base Sepolia, sk_live_ = Base mainnet

OPENAI_API_KEY (or the equivalent for whichever Agno-supported model you use). BLOCKCHAIN0X_API_KEY is a sk_test_ testnet or sk_live_ mainnet key from your dashboard; the client reads it from the environment. If your agent also receives money, the webhook handler additionally needs BLOCKCHAIN0X_WEBHOOK_SECRET.

THE RECIPE

A Toolkit that pays, handed to an Agent.

Below is the whole integration. WalletTools is a Toolkit subclass that registers send_usdc, which calls the real blockchain0x client. Add it to the Agent and the run() call orchestrates the tool invocation. Agno reads the method signature and docstring to build the schema.

AGENT.PY
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools import Toolkit
from blockchain0x import Client

blockchain0x = Client()  # reads BLOCKCHAIN0X_API_KEY from the environment

# Wrap the real client in an Agno Toolkit. No dedicated package needed.
class WalletTools(Toolkit):
    def __init__(self):
        super().__init__(name="wallet_tools")
        self.register(self.send_usdc)

    def send_usdc(self, agent_id: str, to: str, amount_wei: str) -> str:
        """Send a USDC payment from an agent wallet.

        amount_wei is USDC base units (6 decimals), so "10000" is 0.01 USDC.
        """
        return str(
            blockchain0x.payments.create(body={"agentId": agent_id, "to": to, "amountWei": amount_wei})
        )

agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    tools=[WalletTools()],
    instructions=["You pay vendor invoices in USDC within owner-set limits."],
)

result = agent.run("Pay 0.01 USDC from agent agt_123 to 0xVendor for the dataset.")
print(result.content)

When agent.run() executes, the model decides to pay, calls send_usdc, the SDK submits the transfer, and you get a transaction hash back. amount_wei is base units, so 0.01 USDC is "10000". A sk_test_ key keeps it on Base Sepolia until you switch to sk_live_. Register more methods on the toolkit - read a wallet, settle an invoice - the same way.

WEBHOOK HANDLING

Confirm inbound payments with a signed webhook.

If your agent also receives USDC, confirm it with the webhook rather than polling. The verify helper ships in the Node SDK; in a Python service you verify by hand against the documented HMAC, which is all the helper does. FastAPI example below; the same code works in any async Python framework.

WEBHOOK.PY
import hmac, hashlib, os, time
from fastapi import FastAPI, Request, HTTPException

app = FastAPI()
SECRET = os.environ["BLOCKCHAIN0X_WEBHOOK_SECRET"].encode()

@app.post("/webhooks/payment")
async def receive(request: Request):
    raw = await request.body()  # RAW bytes - do not parse first
    sig = request.headers.get("X-Blockchain0x-Signature", "")
    ts = request.headers.get("X-Blockchain0x-Timestamp", "")
    parts = dict(p.split("=", 1) for p in sig.split(",") if "=" in p)
    t, v1 = parts.get("t", ts), parts.get("v1", sig)
    want = hmac.new(SECRET, t.encode() + b"." + raw, hashlib.sha256).hexdigest()
    if not hmac.compare_digest(want, v1) or abs(time.time() - int(t)) > 300:
        raise HTTPException(status_code=401)
    if request.headers.get("X-Blockchain0x-Event-Type") == "payment.received":
        await trigger_followup()  # USDC landed - run the next step
    return {"ok": True}

The algorithm is HMAC-SHA256 over the string t.rawBody, a constant-time compare, and a 300-second replay window. Read the raw body via await request.body(), never request.json() re-serialized, because that changes the bytes the signature covers. The shipped events are payment.received, payment.sent, wallet.deployed, and webhook.test. For heavy follow-up work, enqueue a job (Celery, arq) and respond 200 immediately rather than blocking the handler.

SOURCE AND DOCS

The client you are wrapping is open. Read it.

There is no Agno starter package to clone - the recipe above is the integration. The blockchain0x SDKs are open source on GitHub; this recipe wraps the Python SDK (blockchain0x-python), with the full method surface in the docs. Read it for a reference for the toolkit methods.

github.com/tosh-labs/blockchain0x-python

The full SDK method surface and scopes are documented at the docs. Start on a sk_test_ key against Base Sepolia, then switch to sk_live_ when the toolkit does what you expect.

COMMON PITFALLS

Five Agno-specific things to watch.

Agno is one of the cleaner agent frameworks to integrate with, but it has its own gotchas - especially around the Phidata renaming and markdown rendering.

PITFALL 1

There is no Agno package - you wrap the SDK in a Toolkit

Blockchain0x ships adapters for LangChain and CrewAI plus the MCP server; there is no dedicated Agno package. The recipe above is the path: a Toolkit subclass that registers a method calling the real blockchain0x client. Agno reads the method signature and docstring to build the tool schema, so keep the docstring accurate.

PITFALL 2

Phidata to Agno migration confusion

Agno was renamed from Phidata in 2024. Older codebases importing from phi.agent or phi.tools still work via a compatibility shim, but the agno.* imports are the current ones. The recipe uses agno.* throughout; if your code is still on phi.* imports, run pip install -U agno and switch the import paths before adding the Toolkit.

PITFALL 3

Amounts are USDC base units, as strings

payments.create takes amountWei: a string of USDC base units (6 decimals), so 0.01 USDC is "10000" and 5 USDC is "5000000". Type the method argument as str. It also does not retry by default and can answer 503 until the chain adapter is wired for your network - return a clear message rather than letting the agent loop.

PITFALL 4

Sync vs async run

Agno supports agent.run() (sync) and agent.arun() (async). Pick one mode per agent - call agent.run() and try to await the result and you get a coroutine where you expected a string. The blockchain0x call inside the Toolkit is synchronous; if you are on the async path and moving real volume, wrap it with asyncio.to_thread so the event loop stays responsive.

PITFALL 5

Verify webhooks against the raw body

If your agent also receives USDC, confirm it with the webhook, not by polling. Verify the signature over the RAW request bytes (await request.body()), never request.json() re-serialized, because the HMAC covers the exact bytes. It is HMAC-SHA256 with a 300-second replay window. The handler below is the whole thing.

FREQUENTLY ASKED

Three Agno-specific questions.

Is there a dedicated Agno package to install?

No. Agno already turns a Toolkit method into a tool, so the honest path is to wrap the real blockchain0x client in a Toolkit subclass yourself, as shown above. The only shipped framework packages are blockchain0x-langchain and blockchain0x-crewai (both Python) plus the @blockchain0x/mcp server. Agno, like the other frameworks without a dedicated adapter, is this few-line recipe.

Does this work with Agno Teams (multi-agent collaboration)?

Yes. Agno Teams combine multiple Agents into one coordinated unit. The WalletTools toolkit works in any agent that lists it. The clean pattern for Teams is to give the wallet toolkit to one dedicated treasurer agent and let the other members do work, so spending authority stays in one place - the same shape as the CrewAI recipe. Add read and settle methods to the toolkit the same way (blockchain0x.transactions.get, blockchain0x.agents.get, blockchain0x.payment_requests.settle).

Does it work with reasoning models and AgentUI?

Yes. Reasoning models (o1, DeepSeek R1) call tools the same way, just slower per turn, so stream the partial response if you want the user to see progress before the call completes. In AgentUI, Agno's run inspector, the send_usdc call shows up in the tool-calls panel like any other tool, which is handy for watching a payment go through on Base Sepolia during development.

Charge for your Agno agent's work.

A small Toolkit wrapping the real client, no package to install. Free to start.