Skip to main content
A voice pipeline defines how audio flows through your voice application. It connects speech-to-text, your agent logic, and text-to-speech into a seamless real-time conversation. Each Layercode agent has a config which defines how it works. The config is currently edited in the dashboard using the pipeline editor UI. In the near future we will allow a custom config JSON to be set on a per session basis.

Config Structure

A voice pipeline config has the following structure:
plugins and clients are required. All other fields are optional.

Root-Level Options

Required. Enable or disable specific client transports.Configuration:Example:
Custom key-value data attached to every session. This metadata is included in webhook payloads and can be used for tracking, analytics, or passing context to your agent.Example:
Configure webhooks for session lifecycle events. Useful for logging, analytics, or triggering external workflows when sessions start, end, or update.Configuration:Example:
Maximum session duration in minutes. Sessions automatically end after this timeout.Configuration:Example:
Voice Activity Detection (VAD) configuration. VAD detects when users start and stop speaking, enabling natural turn-taking. It is enabled by default, but in some cases you may want to disable it or edit the advanced settings. In most cases you do not need to include the vad config or edit these settings.Configuration:Example:

Plugins

Plugins are the processing steps in your voice pipeline. They must be specified in order:
Each plugin is configured with a use field (the plugin type) and an optional options object.

STT Plugins (Speech-to-Text)

Convert incoming audio to text transcripts. LayerCode supports two STT providers: Both providers are managed by LayerCode — no API keys required.
Deepgram speech-to-text with Nova-3 or Flux models.Configuration:

model_id: "flux"

model_id: "nova-3"

Example:
AssemblyAI Universal Streaming speech-to-text. Supports English and multilingual (English, Spanish, French, German, Italian, Portuguese). Managed by LayerCode—no API key required.Configuration:Example:

Turn Manager

Manages conversation turn-taking between user and assistant. Handles interruptions (barge-in) and determines when the user has finished speaking.
VAD-based turn management with configurable timeout.Configuration:Example:

Agent Plugins

Generate AI responses from user messages. Choose one based on your use case:
  • agent.llm - Hosted LLM for simple conversational agents
  • agent.webhook - Your own HTTPS endpoint for custom logic
  • agent.ws - Your own WebSocket server for real-time bidirectional communication
Hosted LLM agent using Google Gemini or OpenAI models. Best for simple conversational agents without custom business logic.Configuration:Example (Google):
Example (OpenAI):
Send user messages to your HTTPS endpoint and receive streaming responses. Best for integrating with existing backends or AI orchestration frameworks.Configuration:Example:

TTS Plugins (Text-to-Speech)

Convert agent text responses to audio. LayerCode supports three TTS providers: Inworld or Rime is the easiest way to get started — LayerCode manages the credentials, so it works immediately. For Cartesia or ElevenLabs**, add your API key in Settings → Providers.
Rime TTS with ultra-low latency streaming. Managed by LayerCode—no API key required.Configuration:Example:
Inworld TTS for gaming and interactive characters with voice tuning controls. Requires your own Inworld API credentials.Configuration:voice_config options:Example:
ElevenLabs TTS with high-quality voices and extensive voice customization. Requires your own ElevenLabs API key.Configuration:voice_settings options:Example:
Cartesia Sonic TTS with emotion controls and word-level timestamps. Requires your own Cartesia API key.Configuration:

model_id: "sonic-2"

model_id: "sonic-3"

voice_settings options:Example:

Complete Examples

A minimal configuration using LayerCode’s hosted LLM agent:

Audio Format

The pipeline automatically handles audio format conversion based on the client type: You don’t need to configure audio formats manually - the pipeline negotiates the correct format with each plugin automatically.