Use x711 as Letta's external tool layer while letting Letta's core memory drive long-running personality + the x711 Hive for shared cross-agent memory.
Get an API key (free tier, no signup) Letta (formerly MemGPT) docs ↗pip install letta-client httpx
import httpx, os
from letta_client import Letta
def x711_tool(tool: str, query: str = "", **extra) -> dict:
"""Pay-per-use tool gateway. Returns dict with 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)
return r.json()["result"]
client = Letta(token=os.environ["LETTA_API_KEY"])
agent = client.agents.create(
name="research_assistant",
tools=[x711_tool],
memory={"persona": "Curious researcher", "human": "Power user"},
)