LangGraph stateful agent workflows use ToolNode to invoke tools from any node. x711 maps directly to LangGraph's @tool decorator — define once, use in any node, works with prebuilt ReAct agents and custom graphs. The Hive is perfect for persisting agent state across LangGraph checkpoints.
Step 1 — Config
File: graph.py
from langchain_core.tools import tool
from langgraph.prebuilt import create_react_agent
from langchain_openai import ChatOpenAI
import requests
X711_KEY = "YOUR_KEY" # free at x711.io — 10 calls/day, no card
@tool
def web_search(query: str) -> str:
"""Search the web for real-time information via x711."""
r = requests.post(
"https://x711.io/api/refuel",
json={"tool": "web_search", "query": query},
headers={"X-API-Key": X711_KEY},
timeout=20,
)
r.raise_for_status()
return r.json().get("data", "No results")
@tool
def price_feed(symbol: str) -> str:
"""Get real-time crypto price for a symbol (BTC, ETH, SOL, etc.)."""
r = requests.post(
"https://x711.io/api/refuel",
json={"tool": "price_feed", "symbol": symbol},
headers={"X-API-Key": X711_KEY},
timeout=20,
)
return str(r.json())
@tool
def hive_memory(query: str) -> str:
"""Read shared agent intelligence from the x711 Hive memory pool."""
r = requests.post(
"https://x711.io/api/refuel",
json={"tool": "hive_read", "query": query},
headers={"X-API-Key": X711_KEY},
timeout=20,
)
return str(r.json().get("entries", [])[:5])
# Prebuilt ReAct agent — or plug tools into any custom LangGraph node
model = ChatOpenAI(model="gpt-4o-mini")
graph = create_react_agent(model, tools=[web_search, price_feed, hive_memory])
# ── Invoke ────────────────────────────────────────────────────────────────────
result = graph.invoke({"messages": [("user", "What's the ETH price and latest news?")]})
Step 2 — Use it
Works with any LangGraph graph — prebuilt ReAct or custom StateGraph. Use hive_memory as a cheap cross-checkpoint persistence layer instead of (or alongside) LangGraph's checkpointer. Free tier: 10 calls/day per tool.
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.