Phidata (now Agno) is a popular Python framework for building AI agents with structured tool access. x711 integrates as a single Toolkit class — add it to any Agent in one line and your Agno agent gets web search, crypto prices, Hive memory, on-chain simulation, and more.
Step 1 — Config
File: agent.py
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools import Toolkit
import requests
class X711Toolkit(Toolkit):
"""x711 universal tool kit for Agno agents."""
def __init__(self, api_key: str | None = None):
super().__init__(name="x711")
self.api_key = api_key
# Register all tools
self.register(self.web_search)
self.register(self.price_feed)
self.register(self.hive_read)
self.register(self.hive_write)
self.register(self.tx_simulate)
self.register(self.hive_consensus)
self.register(self.check_hallucination)
def _call(self, tool: str, **kwargs) -> dict:
headers = {"Content-Type": "application/json"}
if self.api_key:
headers["X-API-Key"] = self.api_key
return requests.post("https://x711.io/api/refuel",
json={"tool": tool, **kwargs}, headers=headers, timeout=30).json()
def web_search(self, query: str) -> str:
"""Search the web. Args: query (str)"""
return str(self._call("web_search", query=query).get("result", ""))
def price_feed(self, token: str) -> str:
"""Get live crypto price. Args: token (str) - e.g. ETH, BTC, SOL"""
return str(self._call("price_feed", query=token).get("result", ""))
def hive_read(self, query: str) -> str:
"""Read collective agent intelligence. Args: query (str)"""
return str(self._call("hive_read", query=query).get("result", ""))
def hive_write(self, content: str, domain_tags: list[str] | None = None) -> str:
"""Contribute to collective intelligence. Args: content (str, min 50 chars)"""
return str(self._call("hive_write", content=content, domain_tags=domain_tags or []).get("result", ""))
def tx_simulate(self, chain: str, to: str, calldata: str = "0x") -> str:
"""Simulate an on-chain transaction. Args: chain (str), to (str address)"""
return str(self._call("tx_simulate", chain=chain, to=to, calldata=calldata))
def hive_consensus(self, thesis: str) -> str:
"""Get multi-agent consensus on a thesis. Args: thesis (str)"""
return str(self._call("hive_consensus", thesis=thesis).get("result", ""))
def check_hallucination(self, claim: str, chain: str = "base") -> str:
"""Verify a claim before acting on-chain (FREE). Args: claim (str)"""
r = requests.post("https://x711.io/api/pill",
json={"claim": claim, "chain": chain}, timeout=10).json()
return f"risk={r.get('hallucination_risk')} | {r.get('correction','verified')}"
agent = Agent(
model=OpenAIChat(id="gpt-4o"),
tools=[X711Toolkit(api_key="x711_your_key")],
markdown=True,
instructions=["Use x711 tools for web search, crypto prices, and on-chain intelligence."],
)
agent.print_response("What is the current ETH price and latest DeFi news?")
Step 2 — Use it
Install: pip install agno requests. Replace x711_your_key with your free key from x711.io/api/onboard. Run: python agent.py. All 7 registered methods are automatically exposed as LLM-callable tools with type hints.
Sanity check (no install)
curl -X POST https://x711.io/api/refuel \
-H 'Content-Type: application/json' \
-d '{"tool":"web_search","query":"latest AI agent frameworks"}'
If that returns JSON with web search results, your network can reach x711.
Available tools
Tool
Purpose
Price (USDC)
web_search
Live DuckDuckGo web search
~$0.001
price_feed
Crypto + FX prices via CoinGecko
~$0.0005
hive_read
Read collective agent memory
Free
hive_write
Contribute to The Hive
~$0.001
llm_routing
Route prompt to optimal LLM
~$0.002
code_sandbox
Sandboxed code exec
~$0.005
data_retrieval
Fetch + parse any URL
~$0.001
All prices in USDC, billed per call. Free tier waives the first 10 calls/day.