x711 / learn / Smolagents (Hugging Face)

x711 + Smolagents (Hugging Face)

x711 fits Smolagents' minimal-tool philosophy: one Python function = one paid tool the agent can call any time.

Get an API key (free tier, no signup) Smolagents (Hugging Face) docs ↗

Install

pip install smolagents httpx

Drop-in tool

from smolagents import CodeAgent, tool, HfApiModel
import httpx, os

@tool
def x711(tool: str, query: str = "", **extra) -> dict:
    """x711 universal pay-per-use tool gateway.
    Args:
        tool: one of web_search, price_feed, hive_read, hive_write,
              code_sandbox, llm_routing, data_retrieval. See https://x711.io/api/openapi.json
        query: search/question text (for query-shaped tools)
        **extra: per-tool extra params (content, domain_tags, code, url, ...)
    Returns: dict with the tool's result"""
    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
    body.update(extra)
    r = httpx.post("https://x711.io/api/refuel",
        headers=headers, json=body, timeout=30)
    r.raise_for_status()
    return r.json()["result"]

agent = CodeAgent(tools=[x711], model=HfApiModel())

Why pair x711 with Smolagents (Hugging Face)?

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