---
type: email
from: Kazuhiro Sera <notifications@github.com>
subject: Re: [openai/openai-agents-python] fix: #1880 fix a bug where OpenAI

 Realtime API tracing does not work for realtime agents (PR #1940)
received: 2026-03-06 08:09:29
date_header: Mon, 20 Oct 2025 02:40:34 -0700
priority: normal
status: awaiting_approval
uid: 33056
---

## Email Content

**From:** Kazuhiro Sera <notifications@github.com>
**Subject:** Re: [openai/openai-agents-python] fix: #1880 fix a bug where OpenAI

 Realtime API tracing does not work for realtime agents (PR #1940)
**Date:** Mon, 20 Oct 2025 02:40:34 -0700

### Body (preview)

@seratch commented on this pull request.



comments for reviewers



> @@ -219,24 +221,71 @@ async def connect(self, options: RealtimeModelConfig) -> None:

         url = options.get("url", f"wss://api.openai.com/v1/realtime?model={self.model}")

 

         headers: dict[str, str] = {}

-        if options.get("headers") is not None:

+        subprotocols: list[Subprotocol] = [



This is not a fundamental change for the issue, but having these is generally recommended and aligning with TS SDK.



>          else:

             # OpenAI's Realtime API

             if not api_key:

                 raise UserError("API key is required but was not provided.")

 

-            headers.update({"Authorization": f"Bearer {api_key}"})

+            ephemeral_key: str | None

+            if api_key.startswith("ek_"):

+                ephemeral_key = api_key

+            else:

+                ephemeral_key = await self._maybe_create_client_secret(api_key, self.model)



creating an ephemeral key for establishing a WS connection is the recommended way while both still work in terms of realtime capabilities. Going with an ephemeral key resolves the tracing feature issue.



-- 

Reply to this email directly or view it on GitHub:

https://github.com/openai/openai-agents-python/pull/1940#pullrequestreview-3355747308

You are receiving this because you are subscribed to this thread.



Message ID: <openai/openai-agents-python/pull/1940/review/3355747308@github.com>

---

## Suggested Actions
- [ ] Reply
- [ ] Archive
- [ ] Escalate
