For the complete documentation index, see llms.txt. This page is also available as Markdown.

OpenAI Agents SDK

Use OpenAI Agents SDK with Infron AI models

Seamlessly integrate Infron AI AI with OpenAI Agents SDK for building multi-agent workflows.

The OpenAI Agents SDK is a lightweight yet powerful framework for building multi-agent workflows. And the SDK is compatible with any model providers that support the OpenAI Chat Completions API format.

This guide will walk you through how to use Infron AI LLM API with OpenAI Agents SDK.

Get Started

  1. Set up your Python environment and install the Agents SDK.

python -m venv env
source env/bin/activate
pip install openai-agents==0.0.7
  1. Set up your Infron AI API key.

Using Infron is to create an account and get your API key.

Hello world example

import os
from openai import AsyncOpenAI
from agents import (
    Agent,
    Runner,
    set_default_openai_api,
    set_default_openai_client,
    set_tracing_disabled,
)

BASE_URL = "https://llm.onerouter.pro/v1"
API_KEY = "Your_API_KEY"
MODEL_NAME = "openai/gpt-5.4"

set_default_openai_api("chat_completions")
set_default_openai_client(AsyncOpenAI(base_url=BASE_URL, api_key=API_KEY))
set_tracing_disabled(disabled=True)

agent = Agent(name="Assistant",
              instructions="You are a helpful assistant", model=MODEL_NAME)

result = Runner.run_sync(
    agent, "Write a haiku about recursion in programming. step by step.")
print(result.final_output)

# Code within the code,
# Functions calling themselves,
# Infinite loop's dance.

Handoffs example

Functions example

Last updated