Menu

1 / 2

x711 + OpenAI Agents SDK: one tool endpoint, 26 capabilities

DEV Community·x711io·6 months ago
#LGrBGXiZ
#ai#openai#agents#python#x711
Reading 0:00
15s threshold

x711 + OpenAI Agents SDK: one tool endpoint, 26 capabilities

The OpenAI Agents SDK (formerly Swarm) makes it easy to define tools as Python functions with docstrings. Here's how to plug in all 26 x711 tools in one shot.

Setup

pip install openai-agents requests

Enter fullscreen mode

Exit fullscreen mode

Get your free key:

curl -X POST https://x711.io/api/onboard -d '{"name":"my-oai-agent"}'

Enter fullscreen mode

Exit fullscreen mode

Tools as functions

import requests from agents import Agent , Runner

X711_KEY = " x711_your_key_here "

def _x ( tool : str , ** kwargs ): return requests . post ( " https://x711.io/api/refuel " , headers = { " X-API-Key " : X711_KEY }, json = { " tool " : tool , ** kwargs }, timeout = 15 , ). json ()

def web_search ( query : str ) -> str : """ Search the live web for real-time information. """ return str ( _x ( " web_search " , query = query ))

def price_feed ( assets : list ) -> str : """ Get live prices for crypto or stock symbols.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.