Skip to main content

Introduction

OpenAI Agents SDK enables the development of complex AI agents with tools, planning, and memory capabilities. Obiguard enhances OpenAI Agents with observability, reliability, and production-readiness features. Obiguard turns your experimental OpenAI Agents into production-ready systems by providing:
  • Complete observability of every agent step, tool use, and interaction
  • Cost tracking and optimization to manage your AI spend
  • Access to 200+ LLMs through a single integration
  • Guardrails to keep agent behavior safe and compliant

OpenAI Agents SDK Official Documentation

Learn more about OpenAI Agents SDK’s core concepts

Installation & Setup

1

Install the required packages

2

Create an access key

Create an access key in the Obiguard dashboard. Your provider credentials stay stored in Obiguard and are never shared with your application.
3

Connect to OpenAI Agents

There are 3 ways to integrate Obiguard with OpenAI Agents:
  1. Set a client that applies to all agents in your application
  2. Use a custom provider for selective Obiguard integration
  3. Configure each agent individually
See the Integration Approaches section for more details.
4

Configure Obiguard Client

For a simple setup, we’ll use the global client approach:
Where are my provider keys? Your LLM provider credentials (OpenAI, Anthropic, etc.) are stored encrypted in Obiguard and never leave it. Your application only uses an access key.

Getting Started

Let’s create a simple question-answering agent with OpenAI Agents SDK and Obiguard. This agent will respond directly to user messages using a language model:
In this example:
  1. We set up Obiguard as the global client for OpenAI Agents SDK
  2. We create a simple agent with instructions and a model
  3. We run the agent synchronously with a user query
  4. We print the final output
Visit your Obiguard dashboard to see detailed logs of this agent’s execution!

Integration Approaches

There are three ways to integrate Obiguard with OpenAI Agents SDK, each suited for different scenarios:
Set a global client that affects all agents in your application:
Best for: Whole application migration to Obiguard with minimal code changes
Comparing the 3 approaches

End-to-End Example

Research Agent with Tools: Here’s a more comprehensive agent that can use tools to perform tasks.
Visit your Obiguard dashboard to see the complete execution flow visualized!

Production Features

1. Enhanced Observability

Obiguard provides comprehensive observability for your OpenAI Agents, helping you understand exactly what’s happening during each execution.
Traces provide a hierarchical view of your agent’s execution, showing the sequence of LLM calls, tool invocations, and state transitions.

2. Guardrails for Safe Agents

Guardrails ensure your OpenAI Agents operate safely and respond appropriately in all situations. Why Use Guardrails? OpenAI Agents can experience various failure modes:
  • Generating harmful or inappropriate content
  • Leaking sensitive information like PII
  • Hallucinating incorrect information
  • Generating outputs in incorrect formats
Obiguard’s guardrails protect against these issues by validating both inputs and outputs. Obiguard’s guardrails can:
  • Detect and redact PII in both inputs and outputs
  • Filter harmful or inappropriate content
  • Validate response formats against schemas
  • Check for hallucinations against ground truth
  • Apply custom business logic and rules

Learn More About Guardrails

Explore Obiguard’s guardrail features to enhance agent safety

3. Tracing

Obiguard provides an opentelemetry compatible backend to store and query your traces. You can trace your OpenAI Agents using any OpenTelemetry compatible tracing library.

Tool Use in OpenAI Agents

OpenAI Agents SDK natively supports tools that enable your agents to interact with external systems and APIs. Obiguard provides full observability for tool usage in your agents:

Set Up Enterprise Governance for OpenAI Agents

Why Enterprise Governance? If you are using OpenAI Agents inside your orgnaization, you need to consider several governance aspects:
  • Cost Management: Controlling and tracking AI spending across teams
  • Access Control: Managing which teams can use specific models
  • Usage Analytics: Understanding how AI is being used across the organization
  • Security & Compliance: Maintaining enterprise security standards
  • Reliability: Ensuring consistent service across all users
Obiguard adds a comprehensive governance layer to address these enterprise needs. Let’s implement these controls step by step. Enterprise Implementation Guide Obiguard allows you to use 1600+ LLMs with your OpenAI Agents setup, with minimal configuration required. Let’s set up the core components in Obiguard that you’ll need for integration.
1

Create guardrail policy

You can choose to create a guardrail policy to protect your data and ensure compliance with organizational policies. Add guardrail validators on your LLM inputs and output to govern your LLM usage.
2

Create an access key

Callers authenticate to the Obiguard gateway with an access key. Your provider credentials stay stored in Obiguard and are never shared with your application.In the Obiguard dashboard, create an access key for the agent or project that should use OpenAI Agents, and copy it.
Save your access key securely - you’ll need it for the next step.
3

Use the access key in your client

Once you have created your access key, you can directly pass the access key + base URL in the AsyncOpenAI client. Here’s how:

Enterprise Features Now Available

OpenAI Agents now has:
  • Model access governance
  • Usage tracking & attribution
  • Security guardrails
  • Reliability features

Frequently Asked Questions

Obiguard adds production-readiness to OpenAI Agents through comprehensive observability (traces, logs, metrics), reliability features (fallbacks, retries, caching), and access to 200+ LLMs through a unified interface. This makes it easier to debug, optimize, and scale your agent applications.
Yes! Obiguard integrates seamlessly with existing OpenAI Agents. You only need to replace your client initialization code with the Obiguard-enabled version. The rest of your agent code remains unchanged.
Obiguard supports all OpenAI Agents SDK features, including tool use, memory, planning, and more. It adds observability and reliability without limiting any of the SDK’s functionality.
Obiguard fully supports streaming responses in OpenAI Agents. You can enable streaming by using the appropriate methods in the OpenAI Agents SDK, and Obiguard will properly track and log the streaming interactions.
Obiguard allows you to add custom metadata to your agent runs, which you can then use for filtering. Add fields like agent_name, agent_type, or session_id to easily find and analyze specific agent executions.
Yes! Obiguard uses your own API keys for the various LLM providers. It securely stores them as provider credentials, allowing you to easily manage and rotate keys without changing your code.

Resources

OpenAI Agents Docs

Official OpenAI Agents SDK documentation

Agent Examples

Example implementations for various use cases

Book a Demo

Get personalized guidance on implementing this integration