import { RealtimeAgent, RealtimeSession, TransportLayerAudio, } from '@openai/agents/realtime'; const agent = new RealtimeAgent({ name: 'My agent' }); const session = new RealtimeSession(agent); const newlyRecordedAudio = new ArrayBuffer(0); session.on('audio', (event: TransportLayerAudio) => { // play your audio }); // send new audio to the agent session.sendAudio(newlyRecordedAudio);