OPENAI AGENTS SDK + PROXIES.SX

The OpenAI Agents SDK is OpenAI's Python framework for agents with tools, handoffs and guardrails. The proxy goes into whichever tool touches the web; the model calls stay on OpenAI's API.

Sign up Get an API key

RUNNABLE SAMPLE

Replace ACCOUNT_ID and PROXY_PASSWORD with the values from GET https://api.proxies.sx/v1/gateway/credentials (header X-API-Key: psx_...). The proxy password is set once in the portal and is not your login password.

# pip install openai-agents httpx
import uuid, httpx
from agents import Agent, Runner, function_tool

SID = uuid.uuid4().hex[:12]                        # one session id per run
PROXY = f"http://psx_ACCOUNT_ID-peer-de-rot-sticky-sid-{SID}:PROXY_PASSWORD@gw.proxies.sx:7000"

@function_tool
def fetch_page(url: str) -> str:
    """Fetch a URL through a German residential/mobile exit."""
    with httpx.Client(proxy=PROXY, timeout=30) as c:
        return c.get(url).text[:4000]

agent = Agent(name="scout", instructions="Use fetch_page for any web lookup.", tools=[fetch_page])
print(Runner.run_sync(agent, "What IP does https://api.ipify.org report?").final_output)

Germany has no carrier modem, so the pool is peer-de; mbl-de always fails.

ROTATION FOR OPENAI AGENTS SDK

Use: sticky per Runner.run for multi-page research; ondemand for independent lookups. Create the session id once per run so every fetch the agent makes during that run shares one exit; a fresh id on the next run gives a fresh device.

Sticky pins the device for that session id, not the exit IP - mobile carriers re-NAT on their own schedule, so a pinned modem can still surface a new address. Without a -sid-, sticky and auto modes do nothing across connections. Unknown tokens are dropped silently, so -session- is not a substitute for -sid-.

CHANGE COUNTRY OR POOL

Edit the username only: peer-us, peer-jp, mbl-gb. peer covers ~127 countries; mbl is carrier modems in US, GB, FR, NL, PL and GE (Georgia). Check stock before you pick: GET https://api.proxies.sx/v1/gateway/pool/stock. $4/GB, $2.40/GB at 250 GB+, duration free.

MORE

/pool/skill.md (full username DSL and API contract) · /pool/ (Pool Gateway) · all integrations · skill.md for this section