Documentation Index
Fetch the complete documentation index at: https://arize-ax.mintlify.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
Openai-agents is an AI agent framework developed by OpenAI, designed for easy agent orchestration and tool use. You can view two examples below! To get started, sign up for a free Arize AX account and get your Space ID and API Key.
| Example | Links |
|---|
| Tracing | Colab Link |
| Full Cookbook | Colab Link |
Install
pip install openinference-instrumentation-openai-agents openai-agents arize-otel
API Key Setup
Add your OpenAI API key as an environment variable. The OpenAI Agents SDK will use this to interact with OpenAI models.
export OPENAI_API_KEY='your_openai_api_key'
Setup
Use the register function to connect your application to Arize AX and instrument the OpenAI Agents.
# Import open-telemetry dependencies
from arize.otel import register
# Setup OTel via our convenience function
tracer_provider = register(
space_id = "your-space-id", # in app space settings page
api_key = "your-api-key", # in app space settings page
project_name="agents" # As used in the example, or your preferred project name
)
from openinference.instrumentation.openai_agents import OpenAIAgentsInstrumentor
OpenAIAgentsInstrumentor().instrument(tracer_provider=tracer_provider)
Run your Agent
Now you can run your openai-agents code as usual.
from agents import Agent, Runner # Assuming 'agents' package provides these
# Ensure OPENAI_API_KEY is set in your environment
agent = Agent(name="Assistant", instructions="You are a helpful assistant")
result = Runner.run_sync(agent, "Write a haiku about recursion in programming.")
if result:
print(result.final_output)
else:
print("Agent execution did not produce a result or failed.")
Observe
Once you’ve started your instrumentation, all invocations and steps of your Agent will be sent to your Arize AX account for observability and evaluation.
Resources