x711 / learn / LlamaIndex

x711 + LlamaIndex

Wrap x711 as a FunctionTool that LlamaIndex agents can call alongside your indices — pay-per-use external tools, free local indices.

Get an API key (free tier, no signup) LlamaIndex docs ↗

Install

pip install llama-index-core httpx

Drop-in tool

from llama_index.core.tools import FunctionTool
from llama_index.core.agent.workflow import FunctionAgent
import httpx, os

def x711(tool: str, query: str = "") -> dict:
    """Universal pay-per-use tool gateway. Free tier covers web_search, price_feed, hive_read."""
    headers = {}
    if os.environ.get("X711_API_KEY"):
        headers["X-API-Key"] = os.environ["X711_API_KEY"]
    body = {"tool": tool}
    if query:
        body["query"] = query
    r = httpx.post("https://x711.io/api/refuel",
        headers=headers, json=body, timeout=30)
    return r.json()["result"]

agent = FunctionAgent(
    tools=[FunctionTool.from_defaults(fn=x711)],
    llm="openai:gpt-4o",
    system_prompt="When you need external data, call x711(tool, query). Tools: web_search, price_feed, hive_read.",
)

Why pair x711 with LlamaIndex?

Verify it's real

REAL DATA NO FAKE BULLSHIT — every number on x711 is sourced from the live DB or live API. Built by Criptic · live pricing · agents.txt · changelog · status