Use Portkey with OpenAI Agents SDK to take your AI Agents to production
Install the required packages
Generate API Key
Connect to OpenAI Agents
Configure Portkey Client
Strategy | Code Touchpoints | Best For |
---|---|---|
Global Client via set_default_openai_client | One-time setup; agents need only model names | Whole app uses Portkey; simplest migration |
ModelProvider in RunConfig | Add a provider + pass run_config | Toggle Portkey per run; A/B tests, staged rollouts |
Explicit Model per Agent | Specify OpenAIChatCompletionsModel in agent | Mixed fleet: each agent can talk to a different provider |
Manage prompts in Portkey's Prompt Library
_user
field is specifically designed for user tracking.
Filter analytics by user
logfire
library from Pydantic:
Create Virtual Key
Create Default Config
Configure Portkey API Key
Step 2
Step 1: Implement Budget Controls & Rate Limits
Step 2: Define Model Access Rules
Step 3: Implement Access Controls
Step 4: Deploy & Monitor
How does Portkey enhance OpenAI Agents?
Can I use Portkey with existing OpenAI Agents?
Does Portkey work with all OpenAI Agents features?
How does Portkey handle streaming in OpenAI Agents?
How do I filter logs and traces for specific agent runs?
agent_name
, agent_type
, or session_id
to easily find and analyze specific agent executions.Can I use my own API keys with Portkey?