Skip to content

Workflow root span for openai agents#3825

Closed
nagkumar91 wants to merge 23 commits intoopen-telemetry:mainfrom
nagkumar91:workflow-root-span
Closed

Workflow root span for openai agents#3825
nagkumar91 wants to merge 23 commits intoopen-telemetry:mainfrom
nagkumar91:workflow-root-span

Conversation

@nagkumar91
Copy link
Copy Markdown
Contributor

@nagkumar91 nagkumar91 commented Oct 9, 2025

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Unit tests: pytest opentelemetry-instrumentation-openai-agents/tests/test_tracer.py
  • Why: Covers span-kind assignment with the new workflow root span, attribute propagation for generation/response/agent/function spans, and the various overrides.
  • Repro steps:
    1. cd instrumentation-genai/opentelemetry-instrumentation-openai-agents
    2. python3 -m pytest tests/test_tracer.py

Manual verification (optional but recommended)

  • Run the multi-agent handoff sample: Shows the emitted workflow SERVER span plus multiple invoke_agent and execute_tool spans.
    1. cd instrumentation-genai/opentelemetry-instrumentation-openai-agents/examples/handoffs
    2. python3 -m venv .venv && source .venv/bin/activate
    3. pip install "python-dotenv[cli]" and pip install -r requirements.txt
    4. Copy .env.example → .env, set OPENAI_API_KEY, adjust OTLP settings if needed
    5. dotenv run -- python main.py (or export the vars and run python main.py)

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@nagkumar91 nagkumar91 marked this pull request as ready for review October 9, 2025 18:02
@nagkumar91 nagkumar91 requested a review from a team as a code owner October 9, 2025 18:02
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import (
OTLPSpanExporter,
)
from opentelemetry.instrumentation.openai_agents import (
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.

@github-actions
Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 days of this comment.
If you're still working on this, please add a comment or push new commits.

@github-actions github-actions bot added the Stale label Mar 11, 2026
@github-actions
Copy link
Copy Markdown

This PR has been closed due to inactivity. Please reopen if you would like to continue working on it.

@github-actions github-actions bot closed this Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants