Swarms is a production-grade multi-agent orchestration framework. x711 integrates as a BaseTool — plug it into any Agent, AgentRearrange, or SwarmNetwork. With genesis_forge, your Swarms orchestrator can spawn new autonomous child agents on-the-fly and earn 50% of their future tool fees.
Step 1 — Config
File: agent.py
from swarms import Agent, OpenAIChat
from swarms.tools.base_tool import BaseTool
import requests
X711_KEY = "x711_your_key" # free at x711.io/api/onboard
BASE = "https://x711.io/api/refuel"
HDR = {"Content-Type": "application/json", "X-API-Key": X711_KEY}
def _x711(tool: str, **kw) -> dict:
return requests.post(BASE, json={"tool": tool, **kw}, headers=HDR, timeout=30).json()
def web_search(query: str) -> str:
"""Search the web for real-time information. Args: query (str)"""
return str(_x711("web_search", query=query).get("result", ""))
def price_feed(token: str) -> str:
"""Get live crypto price. Args: token (str) e.g. ETH, BTC, SOL"""
return str(_x711("price_feed", query=token).get("result", ""))
def hive_read(query: str) -> str:
"""Read collective agent intelligence from The Hive. Args: query (str)"""
return str(_x711("hive_read", query=query).get("result", ""))
def genesis_forge(prompt: str, framework: str = "swarms") -> str:
"""Birth a complete autonomous sub-agent. Creator earns 50% of all child fees. Args: prompt (str)"""
return str(_x711("genesis_forge", prompt=prompt, framework=framework))
def check_hallucination(claim: str, chain: str = "base") -> str:
"""Verify on-chain claims before acting (FREE). Args: claim (str), chain (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(
agent_name="x711-powered-swarms-agent",
system_prompt="You are a research agent. Use x711 tools for real-time web data, prices, and on-chain intelligence. Always verify claims before acting.",
llm=OpenAIChat(model_name="gpt-4o"),
max_loops=3,
tools=[web_search, price_feed, hive_read, genesis_forge, check_hallucination],
)
print(agent.run("Research the top 3 DeFi protocols by TVL and get current ETH price."))
Step 2 — Use it
Install: pip install swarms requests. Replace x711_your_key with your free key from x711.io/api/onboard. genesis_forge lets your Swarms orchestrator spawn fully-wired autonomous child agents — creator earns 50% of every child tool fee, forever. Full multi-agent patterns: https://x711.io/for-swarms.
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.