Skip to content

Add sample for openai agents instrumentation - #13

Closed
Radhika Gupta (rads-1996) wants to merge 4 commits into
microsoft:mainfrom
rads-1996:add-openai-agents-sample
Closed

Radhika Gupta (rads-1996) wants to merge 4 commits into
microsoft:mainfrom
rads-1996:add-openai-agents-sample

Conversation

@rads-1996

Copy link
Copy Markdown
Member

No description provided.

@rads-1996
Radhika Gupta (rads-1996) marked this pull request as ready for review April 3, 2026 16:47
Copilot AI review requested due to automatic review settings April 3, 2026 16:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Python sample demonstrating how to instrument OpenAI Agents v2 with Azure Monitor / OpenTelemetry, intended to help users quickly validate telemetry capture for agent runs.

Changes:

  • Added a new OpenAI Agents v2 instrumentation sample script.
  • Included an example agent that calls a function_tool and runs via Runner.run_sync.
  • Enabled GenAI message-content capture via an OTEL environment variable in the sample.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread samples/openai-agents-v2/sample_agents_v2.py
Comment thread samples/openai-agents-v2/sample_agents_v2,py Outdated
Comment thread samples/openai-agents-v2/sample_agents_v2.py
Comment thread samples/openai-agents-v2/sample_agents_v2.py Outdated
Comment thread samples/openai-agents-v2/sample_agents_v2.py
from agents.models.openai_chatcompletions import OpenAIChatCompletionsModel
from openai import AsyncAzureOpenAI, OpenAI

OpenAIAgentsInstrumentor().instrument()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are adding support for this internally, maybe we can update later when configuration is completed

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.

3 participants