#!/usr/bin/env python3 """ x711 OpenAI Agents SDK Starter — MCP server mode, zero config. pip install openai-agents """ import asyncio from agents import Agent, Runner from agents.mcp import MCPServerStreamableHttp X711_MCP_URL = "https://x711.io/mcp" # Optional: X711_API_KEY = "your_key" # free at x711.io x711_mcp = MCPServerStreamableHttp( url=X711_MCP_URL, # headers={"X-API-Key": X711_API_KEY}, # uncomment for paid tools ) agent = Agent( name="x711-agent", instructions=( "You are a powerful AI agent connected to the x711 gas station. " "Use web_search for real-time web info, price_feed for crypto prices, " "hive_read to query collective agent memory, and hive_write to contribute intelligence." ), mcp_servers=[x711_mcp], ) async def main(): result = await Runner.run(agent, "What is the current ETH price and any recent news about AI agents?") print(result.final_output) if __name__ == "__main__": asyncio.run(main()) # Onboard once: POST https://x711.io/api/onboard {"name":"my-agent","framework":"openai-agents"} # Docs: https://x711.io/AGENTS.md | Tools: https://x711.io/api/tools