Skip to main content

AI Gateway

Overview

LangGraph is a framework for building stateful, multi-actor AI applications with LLMs. It extends LangChain with graph-based agent orchestration, cycles, and controllability. Connecting LangGraph to Orq.ai’s AI Gateway enables production-ready agentic workflows with access to 300+ models.

Key Benefits

Orq.ai’s AI Gateway enhances LangGraph applications with:

Complete Observability

Track every agent step, tool use, and graph transition with detailed traces

Built-in Reliability

Automatic fallbacks, retries, and load balancing for production resilience

Cost Optimization

Real-time cost tracking and spend management across all AI operations

Multi-Provider Access

Access 300+ LLMs and 20+ providers through a single, unified integration

Prerequisites

Before integrating LangGraph with Orq.ai, ensure the following are in place:
  • An Orq.ai account and API Key
  • Python 3.8 or higher
To set up an API key, see API keys & Endpoints.

Installation

Configuration

Configure LangGraph to use Orq.ai’s AI Gateway by passing a ChatOpenAI instance with a custom base_url:
Python
base_url: https://api.orq.ai/v3/router

Basic Agent Example

Here’s a complete example using create_react_agent with a tool:
Python

Agent with Multiple Tools

Python

Streaming

Stream agent steps as they happen:
Python

Model Selection

With Orq.ai, any supported model from 20+ providers can be used:
Python