Docs / Recipes / OpenAI Agents
// AGENT FRAMEWORK · OPENAI AGENTS SDK
OpenAI Agents SDK
Pattern A · full governance
Set the SDK's default OpenAI client to one pointed at the gateway. Every agent run, tool call, and handoff routes through Agentics.
Pattern A — routed through the gateway. Your call travels through Agentics via a base-URL swap, so it is governed (routing, budgets, guardrails) inline and the Proof Ledger writes one verifiable receipt server-side. The receipt hash comes back in the
x-agentics-receipt response header.
Install
shell
pip install openai-agentsPoint the framework's OpenAI client at the gateway
set_default_openai_client makes every agent in the process use the gateway client.
Python
from openai import AsyncOpenAI
from agents import set_default_openai_client, Agent, Runner
client = AsyncOpenAI(
base_url="https://agentics.you/api/v1", # the only change
api_key="ak_…", # AGENTICS_API_KEY
)
set_default_openai_client(client)
agent = Agent(name="helper", model="@anthropic/claude-opus-4-8")
print(Runner.run_sync(agent, "hi").final_output)Run one call → see the receipt
Run your normal invocation, then read the receipt for that call off the ledger:
shell
# after your run, the last call's receipt hash:
agentics log tail --limit 1
# → shows x-agentics-receipt: <receipt_hash> (verify it at /trust)Every call the framework makes is now routed, governed, and receipted server-side.