Skip to content

feat(realtime): add SDK trace spans for realtime turns#3121

Draft
felmonon wants to merge 2 commits intoopenai:mainfrom
felmonon:fix/realtime-agent-spans
Draft

feat(realtime): add SDK trace spans for realtime turns#3121
felmonon wants to merge 2 commits intoopenai:mainfrom
felmonon:fix/realtime-agent-spans

Conversation

@felmonon
Copy link
Copy Markdown
Contributor

@felmonon felmonon commented May 5, 2026

Summary

Related to #1845

Adds SDK-local tracing spans for realtime sessions:

  • create agent spans for realtime turn lifecycles with current tool and handoff metadata
  • wrap realtime function tool execution in SDK function spans
  • wrap realtime handoff execution in SDK handoff spans
  • respect tracing_disabled and avoid adding tool input/output payloads to tracing

This is intentionally scoped to SDK-emitted spans and does not claim to fix separate dashboard visibility issues.

Validation

  • uv run pytest tests/realtime/test_session.py -q
  • uv run pytest tests/realtime -q
  • uv run ruff check src/agents/realtime/session.py tests/realtime/test_session.py
  • uv run mypy src/agents/realtime/session.py tests/realtime/test_session.py
  • uv run pyright src/agents/realtime/session.py tests/realtime/test_session.py
  • git diff --check

@github-actions github-actions Bot added enhancement New feature or request feature:realtime labels May 5, 2026
@felmonon
Copy link
Copy Markdown
Contributor Author

felmonon commented May 5, 2026

The formatting failure was fixed in 96541a4b.

The only remaining red check is tests (3.10), failing in make tests-asyncio-stability at tests/test_run_step_execution.py::test_multiple_tool_calls_surface_sleeping_post_invoke_failure_before_sibling_error.

This appears unrelated to this PR. The diff only touches:

  • src/agents/realtime/session.py
  • tests/realtime/test_session.py

I reran the same stability script locally under Python 3.10:

UV_PYTHON=3.10 bash .github/scripts/run-asyncio-teardown-stability.sh

It passed 5/5 locally.

I do not have permission to rerun the failed GitHub job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request feature:realtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant