VoiceConversationDriver
AgentPrism.Core.dllRuns the real-time conversation pipeline: audio comes in, text is transcribed, the existing run path processes it, and audio goes out.
public sealed class VoiceConversationDriverInheritance
Section titled “Inheritance”object ← VoiceConversationDriver
Inherited Members
Section titled “Inherited Members”object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”Option A. Audio is not proxied to the real-time API of the provider; the streaming run path of the agent itself is called. The price is latency, and the return is everything: the run record, spans, cost, tool approval, tenancy and quota all work in a voice turn exactly as they do elsewhere. AgentPrism is a control plane; it cannot suspend those promises for voice.
The driver lives in AgentPrism.Core and is provider
independent: it knows only the ISpeechTranscriber and
ISpeechSynthesizer abstractions. ElevenLabs is one implementation.
The concurrency model is three rules: a single receive loop reads the
frames; turn processing runs on a separate task (otherwise cancel could
not be read until the turn ended); and every send passes through one gate,
because a WebSocket supports only one send at a time.
Constructors
Section titled “Constructors”VoiceConversationDriver(IAgentCatalog, AgentSessionManager, ChatHistoryProvider, IVoiceSessionStore, IAttachmentStore, AttachmentTypeGuard, IOptions<VoiceConversationOptions>, ILogger<VoiceConversationDriver>, ISpeechTranscriber?, ISpeechSynthesizer?, TimeProvider?)
Section titled “ VoiceConversationDriver(IAgentCatalog, AgentSessionManager, ChatHistoryProvider, IVoiceSessionStore, IAttachmentStore, AttachmentTypeGuard, IOptions<VoiceConversationOptions>, ILogger<VoiceConversationDriver>, ISpeechTranscriber?, ISpeechSynthesizer?, TimeProvider?)”Initializes a new instance of the VoiceConversationDriver class.
public VoiceConversationDriver(IAgentCatalog catalog, AgentSessionManager sessions, ChatHistoryProvider chatHistory, IVoiceSessionStore store, IAttachmentStore attachments, AttachmentTypeGuard guard, IOptions<VoiceConversationOptions> options, ILogger<VoiceConversationDriver> logger, ISpeechTranscriber? transcriber, ISpeechSynthesizer? synthesizer, TimeProvider? timeProvider = null)Parameters
Section titled “Parameters”catalog IAgentCatalog
The agent catalog.
sessions AgentSessionManager
The session manager.
chatHistory ChatHistoryProvider
The chat history provider.
store IVoiceSessionStore
The conversation record store.
attachments IAttachmentStore
The attachment store.
guard AttachmentTypeGuard
The attachment type guard.
options IOptions<VoiceConversationOptions>
The conversation options.
logger ILogger<VoiceConversationDriver>
The logger.
transcriber ISpeechTranscriber?
The transcription provider. When it is null a conversation cannot open (see VoiceConversationDriver.IsReady).
synthesizer ISpeechSynthesizer?
The synthesis provider.
timeProvider TimeProvider?
The time source.
Exceptions
Section titled “Exceptions”One of the required dependencies is null.
Properties
Section titled “Properties”IsReady
Section titled “ IsReady”Gets a value that indicates whether both providers that a conversation needs are registered.
public bool IsReady { get; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”Transcription and synthesis are both necessary: with only one of them the conversation would be one way, and that is not a conversation.
Limiter
Section titled “ Limiter”Gets the per-tenant concurrent connection limiter.
public VoiceConnectionLimiter Limiter { get; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”The endpoint reserves a slot before it upgrades the socket: when the limit is full the client sees an HTTP error. To close the socket after the upgrade is a far worse way to tell the client the reason.
PersistAudio
Section titled “ PersistAudio”Gets a value that indicates whether the audio is stored.
public bool PersistAudio { get; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”The user interface shows this value to the user; the audio is never recorded silently.
Methods
Section titled “Methods”RunAsync(WebSocket, VoiceConversationRequest, CancellationToken)
Section titled “ RunAsync(WebSocket, VoiceConversationRequest, CancellationToken)”Runs one conversation connection from start to end.
public Task RunAsync(WebSocket socket, VoiceConversationRequest request, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”socket WebSocket
The upgraded socket.
request VoiceConversationRequest
The immutable facts of the connection.
cancellationToken CancellationToken
The server shutdown token.
Returns
Section titled “Returns”A task that completes when the connection closes.
Exceptions
Section titled “Exceptions”One of the parameters is null.