Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion instrumentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
| [opentelemetry-instrumentation-genai-claude-agent-sdk](./opentelemetry-instrumentation-genai-claude-agent-sdk) | claude-agent-sdk >= 0.1.14 | No | development
| [opentelemetry-instrumentation-genai-langchain](./opentelemetry-instrumentation-genai-langchain) | langchain >= 0.3.21 | No | development
| [opentelemetry-instrumentation-genai-openai](./opentelemetry-instrumentation-genai-openai) | openai >= 1.26.0 | Yes | development
| [opentelemetry-instrumentation-genai-openai-agents](./opentelemetry-instrumentation-genai-openai-agents) | openai-agents >= 0.3.3 | No | development
| [opentelemetry-instrumentation-genai-openai-agents](./opentelemetry-instrumentation-genai-openai-agents) | openai-agents >= 0.17.0 | Yes | development
| [opentelemetry-instrumentation-genai-weaviate-client](./opentelemetry-instrumentation-genai-weaviate-client) | weaviate-client >= 3.0.0,<5.0.0 | No | development
| [opentelemetry-instrumentation-google-genai](./opentelemetry-instrumentation-google-genai) | google-genai >= 1.32.0, <3 | No | development
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve OpenAI Agents SDK instrumentation support for current tracing payloads.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ Features

* Generates spans for agents, tools, generations, guardrails, and handoffs using
the OpenTelemetry GenAI semantic conventions.
* Captures prompts, responses, tool arguments, and system instructions when content
capture is enabled.
* Captures prompts, responses, tool arguments, tool results, and system
instructions when content capture is enabled.
* Handles current Agents SDK response and generation payloads, including response
IDs, models, token usage, and string response inputs.
* Preserves custom span attributes from Agents SDK custom spans, including
sandbox attributes such as ``sandbox.*`` and process exit data.
* Publishes duration and token metrics for every operation.
* Supports environment overrides so you can configure agent metadata or disable
telemetry without code changes.
Expand Down Expand Up @@ -76,6 +80,12 @@ Configure OpenTelemetry as usual, then call :class:`OpenAIAgentsInstrumentor`.
result = Runner.run_sync(assistant, "I'm visiting Barcelona this weekend. How should I pack?")
print(result.final_output)

The instrumentation maps Agents SDK spans to OpenTelemetry GenAI semantic
attributes where applicable. Custom Agents SDK spans are preserved without a
placeholder GenAI operation name, and supported ``CustomSpanData.data`` values
are copied to OpenTelemetry attributes, including sandbox attributes such as
``sandbox.*`` and process exit data.

Configuration
-------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# OTEL_GENAI_AGENT_NAME=Travel Concierge

# Update this with your real OpenAI API key
OPENAI_API_KEY=sk-YOUR_API_KEY
OPENAI_API_KEY=

# Uncomment to use Ollama instead of OpenAI
# OPENAI_BASE_URL=http://localhost:11434/v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ python-dotenv~=1.0

opentelemetry-sdk~=1.42.0
opentelemetry-exporter-otlp-proto-grpc~=1.42.0
opentelemetry-distro~=0.57b0
opentelemetry-distro~=0.62b1
opentelemetry-instrumentation-genai-openai-agents
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies = [

[project.optional-dependencies]
instruments = [
"openai-agents >= 0.3.3",
"openai-agents >= 0.17.0",
]

[project.entry-points.opentelemetry_instrumentor]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def _instrument(self, **kwargs) -> None:
tracer_provider,
schema_url=Schemas.V1_28_0.value,
)
meter_provider = kwargs.get("meter_provider")

system_override = kwargs.get("system") or os.getenv(
_SYSTEM_OVERRIDE_ENV
Expand Down Expand Up @@ -174,6 +175,7 @@ def _instrument(self, **kwargs) -> None:
!= ContentCaptureMode.NO_CONTENT,
content_mode=content_mode,
metrics_enabled=metrics_enabled,
meter_provider=meter_provider,
agent_name=agent_name,
agent_id=agent_id,
agent_description=agent_description,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

_instruments = ("openai-agents >= 0.3.3",)
_supports_metrics = False
_instruments = ("openai-agents >= 0.17.0",)
_supports_metrics = True
Loading