AI Router
Overview
OpenAI Agents SDK enables powerful AI-driven automation through structured conversations and tool calling. By connecting the Agents SDK to Orq.ai’s AI Router, you transform experimental agents into production-ready systems with enterprise-grade capabilities.Key Benefits
Orq.ai’s AI Router enhances your OpenAI Agents with:Complete Observability
Track every agent step, tool use, and interaction with detailed traces and analytics
Built-in Reliability
Automatic fallbacks, retries, and load balancing for production resilience
Cost Optimization
Real-time cost tracking and spend management across all your AI operations
Multi-Provider Access
Access 300+ LLMs and 20+ providers through a single, unified integration
Prerequisites
Before integrating OpenAI Agents SDK with Orq.ai, ensure you have:- An Orq.ai account and API Key
- Python 3.8 or higher
- OpenAI Agents SDK installed
To setup your API key, see API keys & Endpoints.
Installation
Install the OpenAI Agents SDK:Configuration
Configure OpenAI Agents SDK to use Orq.ai’s AI Router by setting a custom AsyncOpenAI client:Python
base_url: https://api.orq.ai/v2/router
Basic Agent Example
Here’s a complete example of creating and running an OpenAI agent through Orq.ai:Python
Agent with Tools
OpenAI Agents can use tools while routing through Orq.ai:Python
Model Selection
With Orq.ai, you can use any supported model from 20+ providers:Python
Observability
Getting Started
Integrate OpenAI Agents with Orq.ai’s observability to gain complete insights into agent performance, token usage, tool utilization, and conversation flows using OpenTelemetry.Prerequisites
Before you begin, ensure you have:- An Orq.ai account and API Key
- OpenAI API key and access to the Assistants API
- Python 3.8+
Install Dependencies
Configure Orq.ai
Set up your environment variables to connect to Orq.ai’s OpenTelemetry collector: Unix/Linux/macOS:Basic Example
Python
Advanced Example with Function Calling
Python
Custom Spans for Agent Operations
Python
View Traces
View your traces in the AI Studio in the Traces tab.
Visit your AI Studio to view real-time analytics and traces.