Commit ebf200d
fix(openai-agents): correct root step timestamp and use semantic step types
Review of the OpenAI Agents SDK tracing processor (OPEN-10883). Addresses three
issues affecting how traces render in Openlayer:
1. Root step timestamp (the reported bug): the synthetic "Agent Workflow" root
step was constructed inside on_trace_end, so steps.Step.__init__ stamped its
start_time with time.time() at trace-end. This placed the parent step after
its own children on the timeline and produced an incorrect inferenceTimestamp
for the whole trace. The root step is now anchored to the start time captured
in on_trace_start, clamped to the earliest child start time. This confirms
the issue was in the instrumentation rather than the UI.
2. Step types: agent, function and handoff spans were all emitted as generic
UserCallStep, so the backend bucketed them as user_call and lost dedicated
rendering. They now use the SDK's typed steps via step_factory
(AgentStep/ToolStep/HandoffStep) with their typed fields populated, matching
the convention used by the langchain/google_adk/claude_agent_sdk integrations.
3. New SDK span types (openai-agents 0.4.2): guardrail, mcp_tools, speech,
transcription and speech_group spans previously fell through to the generic
handler. They are now parsed and mapped to GuardrailStep, ToolStep and
ChatCompletionStep (speech/transcription) respectively; speech_group remains
a generic container step. The TracingProcessor interface itself is unchanged.
Also adds a guardrail scenario to the existing
examples/tracing/openai/openai_agents_tracing.ipynb notebook so it exercises the
GUARDRAIL step type alongside the existing agent/tool/handoff steps.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent d6852f1 commit ebf200d
2 files changed
Lines changed: 292 additions & 13 deletions
File tree
- examples/tracing/openai
- src/openlayer/lib/integrations
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
467 | 467 | | |
468 | 468 | | |
469 | 469 | | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
470 | 481 | | |
471 | 482 | | |
472 | 483 | | |
473 | 484 | | |
474 | 485 | | |
475 | | - | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
476 | 559 | | |
477 | 560 | | |
478 | 561 | | |
| |||
0 commit comments