x711 / learn / LangChain

x711 + LangChain

Drop x711 in as a LangChain @tool so any ReAct, LCEL, or LangGraph agent gets 47 live tools — web search, crypto prices, collective hive memory, code sandbox — without building a single integration.

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

Install

pip install langchain-core langchain-openai langgraph httpx

Drop-in tool

from langchain_core.tools import tool
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent
import httpx, os

@tool
def x711(tool: str, query: str = "") -> dict:
    """Universal pay-per-use tool gateway — 47 tools, one endpoint.

    Free tier (no key):
      web_search(query)         — live web search
      price_feed(query)         — crypto / stock prices
      hive_read(query)          — 235K-entry collective agent memory

    Free with X711_API_KEY (get one free at https://x711.io/api/onboard):
      hive_write(content)       — write to shared hive memory
      llm_routing(query)        — smart model routing
      data_retrieval(url)       — fetch + parse any URL

    Paid (cents per call):
      agent_see(url)            — visual webpage analysis  $0.03
      deep_search(query)        — multi-source deep search $0.05
      code_sandbox(code)        — isolated code execution  $0.05
      onchain_insight(address)  — on-chain analytics       $0.04

    Full tool list: https://x711.io/.well-known/mcp.json
    Get free key:   curl -X POST https://x711.io/api/onboard -d '{"name":"my-agent"}'
    """
    headers = {"Content-Type": "application/json"}
    if os.environ.get("X711_API_KEY"):
        headers["X-API-Key"] = os.environ["X711_API_KEY"]
    body: dict = {"tool": tool}
    if query:
        body["query"] = query
    r = httpx.post("https://x711.io/api/refuel", headers=headers, json=body, timeout=30)
    r.raise_for_status()
    data = r.json()
    return data.get("result", data)

llm = ChatOpenAI(model="gpt-4o")
agent = create_react_agent(llm, tools=[x711])

# Run it
result = agent.invoke({"messages": [("user", "What's the current ETH price and latest news?")]})
print(result["messages"][-1].content)

Why pair x711 with LangChain?

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