Skip to content

feat(integrations): Implement OpenAI Agents SDK Integration #475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 8, 2025

Conversation

viniciusdsmello
Copy link
Contributor

Implement OpenAI Agents SDK Integration with Example Notebook

Description

This PR implements a complete OpenAI Agents SDK integration for the Openlayer Python SDK and provides a comprehensive Jupyter notebook example demonstrating its usage. This enables automatic tracing and monitoring of multi-agent workflows built with the OpenAI Agents SDK.

What's Implemented

🔧 New Integration: src/openlayer/lib/integrations/openai_agents.py

Complete OpenAI Agents SDK Integration:

  • OpenlayerTracerProcessor - Main tracing processor class
  • Automatic span capture - Traces all agent interactions, handoffs, and tool calls
  • Conversation flow tracking - Maintains context across agent transitions
  • Performance monitoring - Captures latency, token usage, and metrics
  • Error handling - Comprehensive error capture and reporting

Key Features:

  • Agent workflow tracing - Complete visibility into multi-agent conversations
  • Tool call monitoring - Tracks function tool usage and outputs
  • Handoff tracking - Captures agent-to-agent transitions
  • Context preservation - Maintains conversation state across agents
  • Token usage tracking - Monitors LLM token consumption
  • Response capture - Extracts actual LLM outputs and agent responses

📓 Example Notebook: examples/tracing/openai/openai_agents_tracing.ipynb

Comprehensive Tutorial & Demo:

  • Google Colab compatible - Ready to run in Colab with installation instructions
  • Step-by-step tutorial - From setup to advanced multi-agent workflows
  • Real-world example - Airline customer service with 3 specialized agents
  • Production patterns - Best practices for agent architecture
  • Interactive examples - 4 different test scenarios

Demonstrates Integration Usage:

  1. Environment setup - API keys and dependencies
  2. Tracing configuration - Setting up OpenlayerTracerProcessor
  3. Agent creation - Triage, FAQ, and Seat Booking agents
  4. Function tools - Reusable tools for different tasks
  5. Agent handoffs - Seamless transfers between specialists
  6. Hook functions - Custom logic during handoffs
  7. Conversation flows - Complete customer interactions
  8. Monitoring results - What appears in Openlayer dashboard

Testing & Validation

  • Integration captures all agent interactions correctly
  • Notebook executes successfully in Colab and locally
  • Agent handoffs are traced properly
  • Tool calls are monitored accurately
  • Performance metrics are captured
  • Error handling works as expected
  • Openlayer dashboard displays traces correctly

The integration makes it trivial for developers to add world-class monitoring to their OpenAI Agents SDK applications, improving both development velocity and production reliability.

…nversation monitoring

This notebook demonstrates the integration of OpenAI Agents SDK with Openlayer, showcasing setup, environment configuration, agent creation, function tools, and conversation flow monitoring. It includes installation instructions, environment variable setup, and examples of testing the multi-agent system with various queries.
@viniciusdsmello viniciusdsmello self-assigned this Jul 8, 2025
@gustavocidornelas gustavocidornelas force-pushed the adds-openai-sdk-integration branch from 61158eb to 4bab67f Compare July 8, 2025 13:00
@gustavocidornelas gustavocidornelas force-pushed the adds-openai-sdk-integration branch from 43a7d2f to 27ec90a Compare July 8, 2025 13:17
@gustavocidornelas gustavocidornelas merged commit 0050703 into main Jul 8, 2025
3 checks passed
@gustavocidornelas gustavocidornelas deleted the adds-openai-sdk-integration branch July 8, 2025 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy