Drop a single x711 tool into any AutoGen ConversableAgent so the agent can pay for and call live tools without bespoke connectors.
Get an API key (free tier, no signup) AutoGen (Microsoft) docs ↗pip install autogen-agentchat httpx
from autogen_agentchat.agents import AssistantAgent
import httpx, os
async def x711(tool: str, **params) -> dict:
"""Pay-per-call tool gateway. Free tier: web_search, price_feed, hive_read.
Pass tool name + tool's required params at the top level (e.g. query=...)."""
headers = {}
if os.environ.get("X711_API_KEY"):
headers["X-API-Key"] = os.environ["X711_API_KEY"]
async with httpx.AsyncClient(timeout=30) as c:
r = await c.post("https://x711.io/api/refuel",
headers=headers, json={"tool": tool, **params})
r.raise_for_status()
return r.json()["result"]
# usage: await x711("web_search", query="latest llama release notes")
agent = AssistantAgent(
name="researcher",
tools=[x711],
system_message=(
"Call x711(tool, **params) for live tools. "
"Tools: web_search(query), price_feed(query), hive_read(query), "
"hive_write(content, domain_tags), llm_routing(query), "
"code_sandbox(code), data_retrieval(url)."
),
)