Skip to content

VoiceConversationBuilderExtensions

Namespace AgentPrism · Assembly AgentPrism.Core.dll

Extensions that enable the real-time voice conversation layer.

public static class VoiceConversationBuilderExtensions

objectVoiceConversationBuilderExtensions

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

This call changes the hosting model. A voice connection stays open for minutes and binds to one server instance; a multi-instance deployment requires sticky sessions, and the reverse proxy must allow WebSocket passthrough. For this reason the feature is opt-in: if the call is not made, no WebSocket endpoint is opened and behavior does not change.

The layer is provider-agnostic: it uses only the ISpeechTranscriber and ISpeechSynthesizer abstractions. This call does not register them — a voice provider must be enabled separately (e.g. UseVoice(...)).

UseVoiceConversation(IAgentPrismBuilder, IConfiguration)

Section titled “ UseVoiceConversation(IAgentPrismBuilder, IConfiguration)”

Enables the conversation layer, reading its settings from configuration.

public static IAgentPrismBuilder UseVoiceConversation(this IAgentPrismBuilder builder, IConfiguration configurationSection)

builder IAgentPrismBuilder

The AgentPrism chain.

configurationSection IConfiguration

The AgentPrism:Voice:Conversation section.

IAgentPrismBuilder

The continuation of the chain.

A speech provider is registered separately; this call only opens the conversation layer over it.

builder.AddAgentPrism()
.UseVoice(builder.Configuration.GetSection("AgentPrism:Voice"))
.UseVoiceConversation(builder.Configuration.GetSection("AgentPrism:Voice:Conversation"));

ArgumentNullException

One of the dependencies is null.

Enables the conversation layer with default settings.

public static IAgentPrismBuilder UseVoiceConversation(this IAgentPrismBuilder builder)

builder IAgentPrismBuilder

The AgentPrism chain.

IAgentPrismBuilder

The continuation of the chain.

Registrations are made with TryAdd*: if the consumer registered its own IVoiceSessionStore implementation before this call, theirs is preserved.

The transcription and synthesis providers are resolved optionally with ``ServiceProviderServiceExtensions.GetService```. Requesting a nullable dependency through constructor injection is not enough: the built-in DI container can treat an unregistered type as required even when a C# default value exists. This is why a factory is used.

ArgumentNullException

builder is null.

UseVoiceConversation(IAgentPrismBuilder, Action<VoiceConversationOptions>)

Section titled “ UseVoiceConversation(IAgentPrismBuilder, Action<VoiceConversationOptions>)”

Enables the conversation layer with settings given in code.

public static IAgentPrismBuilder UseVoiceConversation(this IAgentPrismBuilder builder, Action<VoiceConversationOptions> configure)

builder IAgentPrismBuilder

The AgentPrism chain.

configure Action<VoiceConversationOptions>

The settings.

IAgentPrismBuilder

The continuation of the chain.

ArgumentNullException

One of the parameters is null.