RealtimeSession does not emit history_updated for transcript_delta
Summary
I may be misunderstanding the intended API contract here, but RealtimeSession appears to update its local history on transcript_delta without emitting history_updated (or another high-level history event).
That seems a little surprising given the realtime docs, which suggest history_added / history_updated are the main events for UI state.
What I observed
When RealtimeSession receives a RealtimeModelTranscriptDeltaEvent:
- it accumulates transcript text,
- it updates
session._history,
- but it only forwards the raw model event to the queue.
So a UI that follows the docs and listens mainly to history_added / history_updated will not see live partial transcript changes, even though the session history has already changed.
Minimal repro
import asyncio
from agents.realtime.session import RealtimeSession
from agents.realtime.model_events import RealtimeModelTranscriptDeltaEvent
class DummyModel:
async def connect(self): pass
async def close(self): pass
async def send_event(self, event): pass
class DummyAgent:
output_guardrails = []
handoffs = []
tools = []
mcp_servers = []
model_settings = None
async def main():
session = RealtimeSession(DummyModel(), DummyAgent(), None)
await session.on_event(
RealtimeModelTranscriptDeltaEvent(
item_id="item_1",
delta="hello",
response_id="resp_1",
)
)
print("queue size:", session._event_queue.qsize())
while not session._event_queue.empty():
event = await session._event_queue.get()
print(type(event).__name__, getattr(event, "type", None))
print("history:", session._history)
asyncio.run(main())
Current behavior
- only the raw model event is emitted to the queue
session._history is updated with the partial transcript
Expected behavior
One of these seems reasonable:
- emit
history_updated when transcript_delta mutates local history, so UI subscribers stay in sync, or
- clarify in the docs that live transcript updates are only available through raw model events, not through session history events
Why this seems inconsistent with the docs
The realtime guide says:
The most useful events for UI state are usually history_added and history_updated.
But the transcript_delta path updates _history without emitting either of those events.
Implementation notes
In src/agents/realtime/session.py, the transcript_delta branch:
- accumulates transcript text,
- updates
_history via _get_new_history(...),
- but does not emit
RealtimeHistoryUpdated.
There is also a test in tests/realtime/test_session.py that currently treats transcript_delta as an ignored high-level event, which matches the current implementation.
Environment
- Agents SDK version: 0.14.2
- Python version: 3.13.5
RealtimeSession does not emit
history_updatedfortranscript_deltaSummary
I may be misunderstanding the intended API contract here, but
RealtimeSessionappears to update its local history ontranscript_deltawithout emittinghistory_updated(or another high-level history event).That seems a little surprising given the realtime docs, which suggest
history_added/history_updatedare the main events for UI state.What I observed
When
RealtimeSessionreceives aRealtimeModelTranscriptDeltaEvent:session._history,So a UI that follows the docs and listens mainly to
history_added/history_updatedwill not see live partial transcript changes, even though the session history has already changed.Minimal repro
Current behavior
session._historyis updated with the partial transcriptExpected behavior
One of these seems reasonable:
history_updatedwhentranscript_deltamutates local history, so UI subscribers stay in sync, orWhy this seems inconsistent with the docs
The realtime guide says:
But the
transcript_deltapath updates_historywithout emitting either of those events.Implementation notes
In
src/agents/realtime/session.py, thetranscript_deltabranch:_historyvia_get_new_history(...),RealtimeHistoryUpdated.There is also a test in
tests/realtime/test_session.pythat currently treatstranscript_deltaas an ignored high-level event, which matches the current implementation.Environment