Haystack's modular pipeline system lets you drop x711 in as a custom component or tool. Use it in agentic RAG pipelines for live web search, real-time price data, and cross-agent Hive memory — all without hosting any infra. The component below is production-ready.
Step 1 — Config
File: components/x711_tool.py
from haystack import component, default_from_dict
from haystack.tools import Tool
import requests
X711_KEY = "YOUR_KEY" # free at x711.io — 10 calls/day, no card
# ── Option A: Haystack Tool (for agent pipelines) ─────────────────────────────
def x711_search(query: str) -> str:
"""Search the web via x711."""
r = requests.post(
"https://x711.io/api/refuel",
json={"tool": "web_search", "query": query},
headers={"X-API-Key": X711_KEY},
timeout=20,
)
return r.json().get("data", "")
def x711_price(symbol: str) -> dict:
"""Get real-time crypto price via x711."""
r = requests.post(
"https://x711.io/api/refuel",
json={"tool": "price_feed", "symbol": symbol},
headers={"X-API-Key": X711_KEY},
timeout=20,
)
return r.json()
search_tool = Tool(name="x711_web_search", function=x711_search,
description="Real-time web search for any query.")
price_tool = Tool(name="x711_price_feed", function=x711_price,
description="Live crypto price feed (BTC, ETH, SOL, etc.)")
# ── Option B: Custom @component (for RAG pipelines) ──────────────────────────
@component
class X711WebSearch:
@component.output_types(results=list)
def run(self, query: str):
r = requests.post("https://x711.io/api/refuel",
json={"tool": "web_search", "query": query},
headers={"X-API-Key": X711_KEY}, timeout=20)
return {"results": r.json().get("data", [])}
# ── Agent pipeline ────────────────────────────────────────────────────────────
from haystack.components.agents import ToolCallingAgent
from haystack.components.generators.chat import OpenAIChatGenerator
agent = ToolCallingAgent(
tools=[search_tool, price_tool],
chat_generator=OpenAIChatGenerator(model="gpt-4o-mini"),
)
Step 2 — Use it
Drop x711 tools into any Haystack agent or custom @component pipeline. Hive memory (hive_read/write) makes a powerful cross-session knowledge layer for production RAG agents.
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.