Add x711 as an Agent tool so OpenAI's official agent runtime can pay for live tools without forcing you to build per-tool function definitions by hand.
Get an API key (free tier, no signup) OpenAI Agents SDK docs ↗pip install openai-agents httpx
from agents import Agent, function_tool
import httpx, os
@function_tool
def x711(tool: str, query: str = "") -> dict:
"""Pay-per-use tool gateway. Free tier for read-only tools (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 = Agent(
name="researcher",
instructions="Use x711(tool, query) for live tool calls. Tools: web_search, price_feed, hive_read, hive_write, code_sandbox, llm_routing, data_retrieval.",
tools=[x711],
)