Agent frameworks & SDKs

Connect OpenAI Agents SDK

Multi-agent workflows with handoffs. Point it at AgentKeyRoute so every request follows your governance profile and is recorded.

Get a key with the right protection
In the console, open Connect an app (opens in a new tab) and pick this tool. AgentKeyRoute recommends a governance profile, creates the key, and shows these same steps with your key and an allowed model filled in, plus a live test.

Setup

  1. Install OpenAI Agents SDK
    Terminal
    pip install openai-agents
  2. Point it at the gateway
    Python
    from openai import AsyncOpenAI
    from agents import Agent, Runner, set_default_openai_api, set_default_openai_client, set_tracing_disabled
    
    set_default_openai_client(AsyncOpenAI(base_url="https://gateway.agentkeyroute.com/v1", api_key="<your API key>"))
    set_default_openai_api("chat_completions")
    set_tracing_disabled(True)  # traces would otherwise go to OpenAI
    
    agent = Agent(name="Assistant", instructions="You are helpful.", model="gpt-4.1")
    print(Runner.run_sync(agent, "Hello").final_output)

    Replace <your API key> with your AgentKeyRoute key. gpt-4.1 is an example: use a model your key may use (GET /v1/models lists them).

  3. Check it works

    Run the code once. The request appears in Requests (opens in a new tab) with the policy decision, the model that answered and what was redacted.

Good to know

  • It acts autonomously, so it's registered as an autonomous workload. High-risk autonomous use waits for a person on risky requests.
  • It uses the OpenAI-compatible API, so the base URL ends in /v1.
  • If policy doesn't allow the model you chose for some data, the gateway answers with an allowed one. X-AIGov-Model names it.
  • Refused? See Why was a request blocked?