How Voxray is structured: layers, data flow, session lifecycle, frame types, and key packages.
Voxray is a config-driven Go server for real-time AI voice agents. A single process handles any number of concurrent connections. Each connection gets its own Transport, Runner, and Pipeline — fully isolated, no shared mutable state between sessions.
Layer Overview
Every request travels through the same vertical stack. The diagram below shows the full path from the CLI entry point down to the external AI provider APIs.
Component Descriptions
HTTP Server — pkg/server
The server layer registers all HTTP routes and handles cross-cutting concerns: authentication, CORS headers, and Prometheus metrics scraping. For each new inbound connection it constructs a Transport and fires the onTransport callback, which builds the Pipeline and starts a Runner goroutine. Route sets vary by runner mode: WebSocket sessions use /ws; SmallWebRTC uses /webrtc/offer; runner-style deployments add /start and /sessions/{id}/api/offer backed by a SessionStore (in-memory by default, Redis for horizontal scale); telephony providers hit POST / for the XML webhook and establish a media stream on /telephony/ws; Daily.co deployments serve GET / as a room redirect with an optional /daily-dialin-webhook for PSTN dial-in.
Transport — pkg/transport
The Transport interface is the only abstraction between the network and the pipeline. It exposes two frame channels (Input() <-chan Frame and Output() chan<- Frame) plus Start(ctx) and Close(). All network details — framing, serialization, reconnection — are encapsulated here. Three production implementations ship out of the box:
websocket.ConnTransport — JSON envelope or binary Protobuf over a WebSocket connection; one reader goroutine and one writer goroutine per connection; optional write coalescing (ws_write_coalesce_ms, ws_write_coalesce_max_frames) to batch small frames and reduce syscalls.
smallwebrtc.Transport — WebRTC data-channel and media-track bridge; one goroutine per inbound track, one for outbound.
Telephony WebSocket — provider-specific serializers for Twilio, Telnyx, Plivo, and Exotel; the same Transport interface is exposed to the Runner so no pipeline changes are required when switching providers.
A memory.Transport is provided for tests and in-process pipelines.
Runner — pkg/pipeline (runner.go)
The Runner owns the goroutine lifecycle for a single session. It spawns two goroutines: a reader that reads frames off Transport.Input and enqueues them into a bounded channel (capacity configurable via pipeline_input_queue_cap, default 256), and a worker that drains that queue and calls Pipeline.Push. Back-pressure is explicit: when the queue is full, the reader blocks rather than allocating unbounded memory. Both goroutines honour context cancellation so shutdown drains cleanly. On startup the Runner calls Pipeline.Setup(ctx) and then pushes a StartFrame; on teardown it calls Pipeline.Cleanup(ctx). Pipeline output frames are forwarded to Transport.Output by the Sink processor at the tail of the chain.
Pipeline — pkg/pipeline (pipeline.go)
The Pipeline holds a linear slice of Processor values linked as a doubly-connected chain (each processor knows its next and prev). Pipeline.Add appends a processor and stitches the links; Pipeline.Link is a convenience wrapper for adding many at once. Pipeline.Push(ctx, frame) calls ProcessFrame on the first processor with direction Downstream; each processor either transforms the frame and calls PushDownstream, or drops it. Frames can also travel Upstream (right to left) — for example, an ErrorFrame generated deep in the chain propagates back toward the source. Pipeline.Setup and Pipeline.Cleanup call the corresponding lifecycle hooks on every processor in order (cleanup runs in reverse). A mutex guards the processor slice so frames can safely be pushed from concurrent goroutines.
Processors — pkg/processors
Processors are the fundamental unit of work. The Processor interface (see the Pipeline Processors page) is implemented by everything that touches a frame: VAD and turn detection (voice.TurnProcessor), speech-to-text (voice.STTProcessor), language model inference (voice.LLMProcessor), text-to-speech synthesis (voice.TTSProcessor), the Sink, and a growing library of utility processors — echo, logger, aggregators (DTMF, sentence, LLM context summariser), filters, and framework bridges (RTVI, external HTTP chain). The voice pipeline is assembled when config.provider and config.model are set; otherwise the pipeline is built from config.plugins.
Services — pkg/services
Services provide the provider-agnostic interfaces that processors call:
The factory package resolves the correct implementation from config. Over 40 provider implementations ship under pkg/services/, covering OpenAI, Groq, Sarvam, AWS (Bedrock / Polly / Transcribe), and others. An optional RealtimeService (OpenAI Realtime API) replaces the entire STT + LLM + TTS chain with a single bidirectional WebSocket connection.
Data Flow Sequence
The diagram below traces one complete voice turn, from raw audio bytes arriving on the wire to synthesised speech leaving the server.
UserStartedSpeakingFrame and UserStoppedSpeakingFrame are emitted by TurnProcessor and flow downstream alongside the audio. TTS watches for UserStartedSpeakingFrame as a barge-in signal and immediately clears its text buffer to prevent the bot from finishing a sentence the user has already interrupted.
Session Lifecycle
One HTTP connection maps to exactly one Transport, one Runner, and one Pipeline. The Runner spawns a reader goroutine and a worker goroutine — both scoped to the connection’s context.Context. The reader feeds a bounded queue; the worker consumes it and drives the pipeline. There is no shared state across sessions: each Pipeline has its own processor instances, service clients, and audio buffers.
The pipeline input queue capacity is tunable via pipeline_input_queue_cap (default 256 frames). Raise it if your workload sends very high-frequency audio bursts; lower it to tighten back-pressure and reduce latency tail.
Frame Types
Every object that flows through a pipeline is a Frame. Frames carry a monotonically increasing ID() and a FrameType() string for logging and routing. The table below covers the most important frame types; see pkg/frames for the full set.
Frame Type
Direction
Description
AudioRawFrame
Downstream
Raw 16-bit PCM audio from the client; carries SampleRate and Channels.
TTSAudioRawFrame
Downstream
Synthesised PCM audio from a TTS provider; routed to the Sink and sent to the client.
TranscriptionFrame
Downstream
Text transcript produced by STTProcessor; carries Text, Finalized, and Language.
LLMTextFrame
Downstream
A single streamed token from LLMProcessor; accumulated by TTSProcessor into utterances.
LLMContextFrame
Downstream
Full conversation context injected by aggregators or the RTVI processor.
StartFrame
Downstream
Signals pipeline startup; each processor’s Setup is called before this frame is pushed.
CancelFrame
Downstream
Signals immediate cancellation; processors should flush or discard buffered state.
EndFrame
Downstream
Signals graceful end-of-stream; processors should flush pending work.
ErrorFrame
Upstream
Non-fatal error from any processor; propagates upstream for logging or client notification.
InterruptionFrame
Downstream
Barge-in signal; instructs downstream processors to abort in-progress synthesis.
UserStartedSpeakingFrame
Downstream
Emitted by TurnProcessor when VAD transitions to speech.
UserStoppedSpeakingFrame
Downstream
Emitted by TurnProcessor after configured silence threshold.
BotStartedSpeakingFrame
Downstream
Emitted by TTSProcessor before the first audio frame of a bot response.
BotStoppedSpeakingFrame
Downstream
Emitted by TTSProcessor after the last audio frame of a bot response.
VADParamsUpdateFrame
Upstream
Runtime update to VAD stop/start thresholds; handled by TurnProcessor.
Runner Modes
The runner mode determines which HTTP routes are registered and which Transport implementations are instantiated. Set transport (for WebSocket/WebRTC) and runner_transport (for telephony/Daily) in config.json.
When scaling horizontally across multiple instances, set session_store: "redis" and redis_url in config. Without Redis, session IDs created on one instance are invisible to others and runner-mode connections will fail.
Key Packages Reference
Package path
Responsibility
cmd/voxray
Entry point: parse flags, load config, register plugins, start server
pkg/config
Config struct, LoadConfig, GetAPIKey (with env resolution and caching)
Plugin interface and Registry for config-driven pipeline assembly
pkg/utils
ExponentialBackoff, miscellaneous utilities
pkg/extensions
Voicemail and IVR extensions
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Voxray","colors":{"primary":"#0066FF","light":"#3385FF","dark":"#0044CC"},"logo":{"light":"https://mintcdn.com/voxray-cac3ed72/D8xQd7iPPY_KolNr/logo/light.svg?fit=max\u0026auto=format\u0026n=D8xQd7iPPY_KolNr\u0026q=85\u0026s=21c39f14efb17f68ce18462dfeae2503","dark":"https://mintcdn.com/voxray-cac3ed72/D8xQd7iPPY_KolNr/logo/dark.svg?fit=max\u0026auto=format\u0026n=D8xQd7iPPY_KolNr\u0026q=85\u0026s=fbcff98f39447414ae9b8e0458b0b152"},"favicon":"https://mintcdn.com/voxray-cac3ed72/D8xQd7iPPY_KolNr/favicon.svg?fit=max\u0026auto=format\u0026n=D8xQd7iPPY_KolNr\u0026q=85\u0026s=61774ea28c4cbe69d61b9e47d92f08a8","api":{"openapi":["swagger.json"]},"background":{"color":{"dark":"#0A0A0F"}},"navbar":{"links":[{"href":"https://github.com/Voxray-AI/Voxray","label":"GitHub"}],"primary":{"type":"button","label":"Get Started","href":"/get-started/introduction"}},"footer":{"socials":{"github":"https://github.com/Voxray-AI/Voxray","discord":"https://discord.gg/voxray"}},"styling":{"latex":true},"navigation":{"global":{"anchors":[{"anchor":"GitHub","icon":"github","href":"https://github.com/Voxray-AI/Voxray"},{"anchor":"Discord","icon":"discord","href":"https://discord.gg/voxray"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"voxray-cac3ed72","hasAudioNarration":false,"actualSubdomain":"voxray-cac3ed72","customDomains":[],"gitSource":{"type":"github","owner":"voxray-ai","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"feedback":{"thumbs":true,"edits":false,"issues":false},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6ae957e07c27206474c9bb8f:success","clientVersion":"0.0.4347","searchFilterCounts":[{"language":"default","tag":"Documentation","count":43},{"language":"default","tag":"Build","count":17},{"language":"default","tag":"Integrations","count":8},{"language":"default","tag":"Deploy","count":7},{"language":"default","tag":"Tutorials","count":6},{"language":"default","tag":"Core Concepts","count":6},{"language":"default","tag":"Get Started","count":5},{"language":"default","tag":"Reference","count":5},{"language":"default","tag":"Contributing","count":3}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"core-concepts/architecture","slug":"/core-concepts/architecture","pageMetadata":{"title":"Architecture","description":"How Voxray is structured: layers, data flow, session lifecycle, frame types, and key packages.","href":"/core-concepts/architecture"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"How Voxray is structured: layers, data flow, session lifecycle, frame types, and key packages.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Mermaid,Note,Table,Tip,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Mermaid)_missingMdxReference(`Mermaid`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Voxray is a config-driven Go server for real-time AI voice agents. A single process handles any number of concurrent connections. Each connection gets its own Transport, Runner, and Pipeline — fully isolated, no shared mutable state between sessions.`}),`\n`,_jsx(Heading,{level:`2`,id:`layer-overview`,children:`Layer Overview`}),`\n`,_jsx(_components.p,{children:`Every request travels through the same vertical stack. The diagram below shows the full path from the CLI entry point down to the external AI provider APIs.`}),`\n`,_jsx(Mermaid,{chart:`flowchart TB\n subgraph Entry[\"Entry\"]\n CLI[\"cmd/voxray — main, init\"]\n Config[\"pkg/config — Config, LoadConfig\"]\n end\n\n subgraph Server[\"Server Layer · pkg/server\"]\n HTTP[\"HTTP Server\"]\n WS[\"GET /ws (WebSocket)\"]\n WebRTC[\"POST /webrtc/offer (SmallWebRTC)\"]\n Start[\"POST /start (runner sessions)\"]\n Sessions[\"POST|PATCH /sessions/{id}/api/offer\"]\n Tel[\"POST / (telephony XML) + GET /telephony/ws\"]\n Daily[\"GET / (Daily redirect) + /daily-dialin-webhook\"]\n end\n\n subgraph Transport[\"Transport Layer · pkg/transport\"]\n TI[\"Transport interface\\\\nInput ←chan Frame · Output chan← Frame · Start · Close\"]\n WSTrans[\"websocket.ConnTransport\"]\n WRTCTrans[\"smallwebrtc.Transport\"]\n TelTrans[\"WebSocket + provider serializer\"]\n end\n\n subgraph Orchestration[\"Orchestration · pkg/pipeline\"]\n Runner[\"Runner — wires Transport ↔ Pipeline\"]\n end\n\n subgraph Pipeline[\"Pipeline · pkg/pipeline\"]\n PP[\"Pipeline — linear processor chain\"]\n Turn[\"voice.TurnProcessor (VAD)\"]\n STT[\"voice.STTProcessor\"]\n LLM[\"voice.LLMProcessor\"]\n TTS[\"voice.TTSProcessor\"]\n Sink[\"Sink → Transport.Output\"]\n end\n\n subgraph Services[\"Services · pkg/services\"]\n Factory[\"factory — NewLLM/STT/TTSFromConfig\"]\n LLMSvc[\"LLM: OpenAI, Groq, AWS, …\"]\n STTSvc[\"STT: OpenAI, Groq, Sarvam, …\"]\n TTSSvc[\"TTS: OpenAI, Groq, Sarvam, …\"]\n end\n\n subgraph External[\"External APIs\"]\n LLMAPI[\"LLM provider\"]\n STTAPI[\"STT provider\"]\n TTSAPI[\"TTS provider\"]\n end\n\n CLI --> Config\n CLI --> HTTP\n HTTP --> WS \u0026 WebRTC \u0026 Start \u0026 Sessions \u0026 Tel \u0026 Daily\n WS --> WSTrans --> TI\n WebRTC --> WRTCTrans --> TI\n Tel --> TelTrans --> TI\n TI --> Runner --> PP\n PP --> Turn --> STT --> LLM --> TTS --> Sink\n Sink --> Runner --> TI\n STT --> Factory --> STTSvc --> STTAPI\n LLM --> Factory --> LLMSvc --> LLMAPI\n TTS --> Factory --> TTSSvc --> TTSAPI`}),`\n`,_jsx(Heading,{level:`2`,id:`component-descriptions`,children:`Component Descriptions`}),`\n`,_jsxs(Heading,{level:`3`,id:`http-server-—-pkg/server`,children:[`HTTP Server — `,_jsx(_components.code,{children:`pkg/server`})]}),`\n`,_jsxs(_components.p,{children:[`The server layer registers all HTTP routes and handles cross-cutting concerns: authentication, CORS headers, and Prometheus metrics scraping. For each new inbound connection it constructs a Transport and fires the `,_jsx(_components.code,{children:`onTransport`}),` callback, which builds the Pipeline and starts a Runner goroutine. Route sets vary by runner mode: WebSocket sessions use `,_jsx(_components.code,{children:`/ws`}),`; SmallWebRTC uses `,_jsx(_components.code,{children:`/webrtc/offer`}),`; runner-style deployments add `,_jsx(_components.code,{children:`/start`}),` and `,_jsx(_components.code,{children:`/sessions/{id}/api/offer`}),` backed by a `,_jsx(_components.code,{children:`SessionStore`}),` (in-memory by default, Redis for horizontal scale); telephony providers hit `,_jsx(_components.code,{children:`POST /`}),` for the XML webhook and establish a media stream on `,_jsx(_components.code,{children:`/telephony/ws`}),`; Daily.co deployments serve `,_jsx(_components.code,{children:`GET /`}),` as a room redirect with an optional `,_jsx(_components.code,{children:`/daily-dialin-webhook`}),` for PSTN dial-in.`]}),`\n`,_jsxs(Heading,{level:`3`,id:`transport-—-pkg/transport`,children:[`Transport — `,_jsx(_components.code,{children:`pkg/transport`})]}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`Transport`}),` interface is the only abstraction between the network and the pipeline. It exposes two frame channels (`,_jsx(_components.code,{children:`Input() \u003c-chan Frame`}),` and `,_jsx(_components.code,{children:`Output() chan\u003c- Frame`}),`) plus `,_jsx(_components.code,{children:`Start(ctx)`}),` and `,_jsx(_components.code,{children:`Close()`}),`. All network details — framing, serialization, reconnection — are encapsulated here. Three production implementations ship out of the box:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`websocket.ConnTransport`})}),` — JSON envelope or binary Protobuf over a WebSocket connection; one reader goroutine and one writer goroutine per connection; optional write coalescing (`,_jsx(_components.code,{children:`ws_write_coalesce_ms`}),`, `,_jsx(_components.code,{children:`ws_write_coalesce_max_frames`}),`) to batch small frames and reduce syscalls.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`smallwebrtc.Transport`})}),` — WebRTC data-channel and media-track bridge; one goroutine per inbound track, one for outbound.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Telephony WebSocket`}),` — provider-specific serializers for Twilio, Telnyx, Plivo, and Exotel; the same `,_jsx(_components.code,{children:`Transport`}),` interface is exposed to the Runner so no pipeline changes are required when switching providers.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`A `,_jsx(_components.code,{children:`memory.Transport`}),` is provided for tests and in-process pipelines.`]}),`\n`,_jsxs(Heading,{level:`3`,id:`runner-—-pkg/pipeline-runner-go`,children:[`Runner — `,_jsx(_components.code,{children:`pkg/pipeline`}),` (`,_jsx(_components.code,{children:`runner.go`}),`)`]}),`\n`,_jsxs(_components.p,{children:[`The Runner owns the goroutine lifecycle for a single session. It spawns two goroutines: a `,_jsx(_components.strong,{children:`reader`}),` that reads frames off `,_jsx(_components.code,{children:`Transport.Input`}),` and enqueues them into a bounded channel (capacity configurable via `,_jsx(_components.code,{children:`pipeline_input_queue_cap`}),`, default 256), and a `,_jsx(_components.strong,{children:`worker`}),` that drains that queue and calls `,_jsx(_components.code,{children:`Pipeline.Push`}),`. Back-pressure is explicit: when the queue is full, the reader blocks rather than allocating unbounded memory. Both goroutines honour `,_jsx(_components.code,{children:`context`}),` cancellation so shutdown drains cleanly. On startup the Runner calls `,_jsx(_components.code,{children:`Pipeline.Setup(ctx)`}),` and then pushes a `,_jsx(_components.code,{children:`StartFrame`}),`; on teardown it calls `,_jsx(_components.code,{children:`Pipeline.Cleanup(ctx)`}),`. Pipeline output frames are forwarded to `,_jsx(_components.code,{children:`Transport.Output`}),` by the Sink processor at the tail of the chain.`]}),`\n`,_jsxs(Heading,{level:`3`,id:`pipeline-—-pkg/pipeline-pipeline-go`,children:[`Pipeline — `,_jsx(_components.code,{children:`pkg/pipeline`}),` (`,_jsx(_components.code,{children:`pipeline.go`}),`)`]}),`\n`,_jsxs(_components.p,{children:[`The Pipeline holds a linear slice of `,_jsx(_components.code,{children:`Processor`}),` values linked as a doubly-connected chain (each processor knows its `,_jsx(_components.code,{children:`next`}),` and `,_jsx(_components.code,{children:`prev`}),`). `,_jsx(_components.code,{children:`Pipeline.Add`}),` appends a processor and stitches the links; `,_jsx(_components.code,{children:`Pipeline.Link`}),` is a convenience wrapper for adding many at once. `,_jsx(_components.code,{children:`Pipeline.Push(ctx, frame)`}),` calls `,_jsx(_components.code,{children:`ProcessFrame`}),` on the first processor with direction `,_jsx(_components.code,{children:`Downstream`}),`; each processor either transforms the frame and calls `,_jsx(_components.code,{children:`PushDownstream`}),`, or drops it. Frames can also travel `,_jsx(_components.code,{children:`Upstream`}),` (right to left) — for example, an `,_jsx(_components.code,{children:`ErrorFrame`}),` generated deep in the chain propagates back toward the source. `,_jsx(_components.code,{children:`Pipeline.Setup`}),` and `,_jsx(_components.code,{children:`Pipeline.Cleanup`}),` call the corresponding lifecycle hooks on every processor in order (cleanup runs in reverse). A mutex guards the processor slice so frames can safely be pushed from concurrent goroutines.`]}),`\n`,_jsxs(Heading,{level:`3`,id:`processors-—-pkg/processors`,children:[`Processors — `,_jsx(_components.code,{children:`pkg/processors`})]}),`\n`,_jsxs(_components.p,{children:[`Processors are the fundamental unit of work. The `,_jsx(_components.code,{children:`Processor`}),` interface (see the `,_jsx(_components.a,{href:`/core-concepts/pipeline-processors`,children:`Pipeline Processors`}),` page) is implemented by everything that touches a frame: VAD and turn detection (`,_jsx(_components.code,{children:`voice.TurnProcessor`}),`), speech-to-text (`,_jsx(_components.code,{children:`voice.STTProcessor`}),`), language model inference (`,_jsx(_components.code,{children:`voice.LLMProcessor`}),`), text-to-speech synthesis (`,_jsx(_components.code,{children:`voice.TTSProcessor`}),`), the `,_jsx(_components.code,{children:`Sink`}),`, and a growing library of utility processors — echo, logger, aggregators (DTMF, sentence, LLM context summariser), filters, and framework bridges (RTVI, external HTTP chain). The voice pipeline is assembled when `,_jsx(_components.code,{children:`config.provider`}),` and `,_jsx(_components.code,{children:`config.model`}),` are set; otherwise the pipeline is built from `,_jsx(_components.code,{children:`config.plugins`}),`.`]}),`\n`,_jsxs(Heading,{level:`3`,id:`services-—-pkg/services`,children:[`Services — `,_jsx(_components.code,{children:`pkg/services`})]}),`\n`,_jsx(_components.p,{children:`Services provide the provider-agnostic interfaces that processors call:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`LLMService`}),` — `,_jsx(_components.code,{children:`Chat(ctx, messages, onToken)`}),` streaming interface`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`STTService`}),` — `,_jsx(_components.code,{children:`Transcribe(ctx, audio, sampleRate, channels)`}),` returning `,_jsx(_components.code,{children:`[]TranscriptionFrame`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`TTSService`}),` — `,_jsx(_components.code,{children:`Speak(ctx, text, sampleRate)`}),` returning `,_jsx(_components.code,{children:`[]TTSAudioRawFrame`})]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`factory`}),` package resolves the correct implementation from config. Over 40 provider implementations ship under `,_jsx(_components.code,{children:`pkg/services/`}),`, covering OpenAI, Groq, Sarvam, AWS (Bedrock / Polly / Transcribe), and others. An optional `,_jsx(_components.code,{children:`RealtimeService`}),` (OpenAI Realtime API) replaces the entire STT + LLM + TTS chain with a single bidirectional WebSocket connection.`]}),`\n`,_jsx(Heading,{level:`2`,id:`data-flow-sequence`,children:`Data Flow Sequence`}),`\n`,_jsx(_components.p,{children:`The diagram below traces one complete voice turn, from raw audio bytes arriving on the wire to synthesised speech leaving the server.`}),`\n`,_jsx(Mermaid,{chart:`sequenceDiagram\n participant Client\n participant Transport\n participant Runner\n participant Pipeline\n participant Turn as TurnProcessor\n participant STT as STTProcessor\n participant LLM as LLMProcessor\n participant TTS as TTSProcessor\n participant Sink\n\n Client->>Transport: connect (WS / WebRTC / telephony WS)\n Transport->>Runner: Start(ctx)\n Runner->>Pipeline: Setup(ctx)\n Runner->>Pipeline: Push(StartFrame)\n\n loop Per audio chunk\n Client->>Transport: bytes\n Transport->>Runner: AudioRawFrame (via Input channel)\n Runner->>Pipeline: Push(AudioRawFrame)\n Pipeline->>Turn: ProcessFrame(AudioRawFrame, Downstream)\n Note over Turn: VAD + silence detection; buffers chunks\n Turn->>STT: ProcessFrame(AudioRawFrame, Downstream) — on turn complete\n Note over STT: Buffers ≥500ms audio; calls STTService.Transcribe\n STT->>LLM: ProcessFrame(TranscriptionFrame, Downstream)\n Note over LLM: Appends user message; calls LLMService.Chat (streaming)\n LLM->>TTS: ProcessFrame(LLMTextFrame, Downstream) — per token\n Note over TTS: Batches tokens by sentence or 120 runes; calls TTSService.Speak\n TTS->>Sink: ProcessFrame(TTSAudioRawFrame, Downstream)\n Sink->>Transport: Output() \u003c- TTSAudioRawFrame\n Transport->>Client: bytes\n end\n\n Client->>Transport: disconnect / CancelFrame\n Runner->>Pipeline: Cleanup(ctx)`}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`UserStartedSpeakingFrame`}),` and `,_jsx(_components.code,{children:`UserStoppedSpeakingFrame`}),` are emitted by `,_jsx(_components.code,{children:`TurnProcessor`}),` and flow downstream alongside the audio. `,_jsx(_components.code,{children:`TTS`}),` watches for `,_jsx(_components.code,{children:`UserStartedSpeakingFrame`}),` as a barge-in signal and immediately clears its text buffer to prevent the bot from finishing a sentence the user has already interrupted.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`session-lifecycle`,children:`Session Lifecycle`}),`\n`,_jsxs(_components.p,{children:[`One HTTP connection maps to exactly one Transport, one Runner, and one Pipeline. The Runner spawns a reader goroutine and a worker goroutine — both scoped to the connection’s `,_jsx(_components.code,{children:`context.Context`}),`. The reader feeds a bounded queue; the worker consumes it and drives the pipeline. There is no shared state across sessions: each Pipeline has its own processor instances, service clients, and audio buffers.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`9`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`9`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`HTTP connection established`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` └─ Transport.Start(ctx)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` └─ Runner: reader goroutine ─── enqueue → bounded channel`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` worker goroutine ─── dequeue → Pipeline.Push`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` └─ Turn → STT → LLM → TTS → Sink`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`HTTP connection closed / ctx cancelled`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` └─ reader + worker goroutines drain and exit`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` └─ Pipeline.Cleanup(ctx) — reverse order`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`The pipeline input queue capacity is tunable via `,_jsx(_components.code,{children:`pipeline_input_queue_cap`}),` (default 256 frames). Raise it if your workload sends very high-frequency audio bursts; lower it to tighten back-pressure and reduce latency tail.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`frame-types`,children:`Frame Types`}),`\n`,_jsxs(_components.p,{children:[`Every object that flows through a pipeline is a `,_jsx(_components.code,{children:`Frame`}),`. Frames carry a monotonically increasing `,_jsx(_components.code,{children:`ID()`}),` and a `,_jsx(_components.code,{children:`FrameType()`}),` string for logging and routing. The table below covers the most important frame types; see `,_jsx(_components.code,{children:`pkg/frames`}),` for the full set.`]}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Frame Type`}),_jsx(_components.th,{children:`Direction`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`AudioRawFrame`})}),_jsx(_components.td,{children:`Downstream`}),_jsxs(_components.td,{children:[`Raw 16-bit PCM audio from the client; carries `,_jsx(_components.code,{children:`SampleRate`}),` and `,_jsx(_components.code,{children:`Channels`}),`.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`TTSAudioRawFrame`})}),_jsx(_components.td,{children:`Downstream`}),_jsx(_components.td,{children:`Synthesised PCM audio from a TTS provider; routed to the Sink and sent to the client.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`TranscriptionFrame`})}),_jsx(_components.td,{children:`Downstream`}),_jsxs(_components.td,{children:[`Text transcript produced by `,_jsx(_components.code,{children:`STTProcessor`}),`; carries `,_jsx(_components.code,{children:`Text`}),`, `,_jsx(_components.code,{children:`Finalized`}),`, and `,_jsx(_components.code,{children:`Language`}),`.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`LLMTextFrame`})}),_jsx(_components.td,{children:`Downstream`}),_jsxs(_components.td,{children:[`A single streamed token from `,_jsx(_components.code,{children:`LLMProcessor`}),`; accumulated by `,_jsx(_components.code,{children:`TTSProcessor`}),` into utterances.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`LLMContextFrame`})}),_jsx(_components.td,{children:`Downstream`}),_jsx(_components.td,{children:`Full conversation context injected by aggregators or the RTVI processor.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`StartFrame`})}),_jsx(_components.td,{children:`Downstream`}),_jsxs(_components.td,{children:[`Signals pipeline startup; each processor’s `,_jsx(_components.code,{children:`Setup`}),` is called before this frame is pushed.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`CancelFrame`})}),_jsx(_components.td,{children:`Downstream`}),_jsx(_components.td,{children:`Signals immediate cancellation; processors should flush or discard buffered state.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`EndFrame`})}),_jsx(_components.td,{children:`Downstream`}),_jsx(_components.td,{children:`Signals graceful end-of-stream; processors should flush pending work.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`ErrorFrame`})}),_jsx(_components.td,{children:`Upstream`}),_jsx(_components.td,{children:`Non-fatal error from any processor; propagates upstream for logging or client notification.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`InterruptionFrame`})}),_jsx(_components.td,{children:`Downstream`}),_jsx(_components.td,{children:`Barge-in signal; instructs downstream processors to abort in-progress synthesis.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`UserStartedSpeakingFrame`})}),_jsx(_components.td,{children:`Downstream`}),_jsxs(_components.td,{children:[`Emitted by `,_jsx(_components.code,{children:`TurnProcessor`}),` when VAD transitions to speech.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`UserStoppedSpeakingFrame`})}),_jsx(_components.td,{children:`Downstream`}),_jsxs(_components.td,{children:[`Emitted by `,_jsx(_components.code,{children:`TurnProcessor`}),` after configured silence threshold.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`BotStartedSpeakingFrame`})}),_jsx(_components.td,{children:`Downstream`}),_jsxs(_components.td,{children:[`Emitted by `,_jsx(_components.code,{children:`TTSProcessor`}),` before the first audio frame of a bot response.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`BotStoppedSpeakingFrame`})}),_jsx(_components.td,{children:`Downstream`}),_jsxs(_components.td,{children:[`Emitted by `,_jsx(_components.code,{children:`TTSProcessor`}),` after the last audio frame of a bot response.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`VADParamsUpdateFrame`})}),_jsx(_components.td,{children:`Upstream`}),_jsxs(_components.td,{children:[`Runtime update to VAD stop/start thresholds; handled by `,_jsx(_components.code,{children:`TurnProcessor`}),`.`]})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`runner-modes`,children:`Runner Modes`}),`\n`,_jsxs(_components.p,{children:[`The runner mode determines which HTTP routes are registered and which Transport implementations are instantiated. Set `,_jsx(_components.code,{children:`transport`}),` (for WebSocket/WebRTC) and `,_jsx(_components.code,{children:`runner_transport`}),` (for telephony/Daily) in `,_jsx(_components.code,{children:`config.json`}),`.`]}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Mode`}),_jsx(_components.th,{children:`Config value`}),_jsx(_components.th,{children:`Entry points`}),_jsx(_components.th,{children:`Transport source`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`WebSocket only`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`transport: \"websocket\"`}),` (or `,_jsx(_components.code,{children:`\"\"`}),`)`]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`GET /ws`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`pkg/transport/websocket`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`WebRTC only`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`transport: \"smallwebrtc\"`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`POST /webrtc/offer`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`pkg/transport/smallwebrtc`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Both`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`transport: \"both\"`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`/ws`}),` and `,_jsx(_components.code,{children:`POST /webrtc/offer`})]}),_jsx(_components.td,{children:`Both of the above`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Runner (session-based)`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`transport: \"both\"`}),` or WebRTC`]}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`POST /start`}),`, `,_jsx(_components.code,{children:`POST|PATCH /sessions/{id}/api/offer`})]}),_jsx(_components.td,{children:`SessionStore + SmallWebRTC`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Daily`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`runner_transport: \"daily\"`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`GET /`}),` → room redirect; `,_jsx(_components.code,{children:`POST /daily-dialin-webhook`})]}),_jsx(_components.td,{children:`Daily.co room client via /sessions`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Telephony`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`runner_transport: \"twilio\"|\"telnyx\"|\"plivo\"|\"exotel\"`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`POST /`}),` (XML webhook), `,_jsx(_components.code,{children:`GET /telephony/ws`})]}),_jsx(_components.td,{children:`WebSocket with provider serializer`})]})]})]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`When scaling horizontally across multiple instances, set `,_jsx(_components.code,{children:`session_store: \"redis\"`}),` and `,_jsx(_components.code,{children:`redis_url`}),` in config. Without Redis, session IDs created on one instance are invisible to others and runner-mode connections will fail.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`key-packages-reference`,children:`Key Packages Reference`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Package path`}),_jsx(_components.th,{children:`Responsibility`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`cmd/voxray`})}),_jsx(_components.td,{children:`Entry point: parse flags, load config, register plugins, start server`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`pkg/config`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`Config`}),` struct, `,_jsx(_components.code,{children:`LoadConfig`}),`, `,_jsx(_components.code,{children:`GetAPIKey`}),` (with env resolution and caching)`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`pkg/server`})}),_jsxs(_components.td,{children:[`HTTP server, route registration, `,_jsx(_components.code,{children:`onTransport`}),` callback, Prometheus metrics`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`pkg/transport`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`Transport`}),` interface; `,_jsx(_components.code,{children:`websocket`}),`, `,_jsx(_components.code,{children:`smallwebrtc`}),`, `,_jsx(_components.code,{children:`memory`}),`, `,_jsx(_components.code,{children:`whatsapp`}),` sub-packages`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`pkg/pipeline`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`Pipeline`}),`, `,_jsx(_components.code,{children:`Runner`}),`, `,_jsx(_components.code,{children:`Source`}),`, `,_jsx(_components.code,{children:`Sink`}),`, `,_jsx(_components.code,{children:`Registry`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`pkg/processors`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`Processor`}),` interface, `,_jsx(_components.code,{children:`BaseProcessor`}),`, direction constants`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`pkg/processors/voice`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`TurnProcessor`}),`, `,_jsx(_components.code,{children:`STTProcessor`}),`, `,_jsx(_components.code,{children:`LLMProcessor`}),`, `,_jsx(_components.code,{children:`TTSProcessor`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`pkg/processors/aggregators`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`dtmf_aggregator`}),`, `,_jsx(_components.code,{children:`gated`}),`, `,_jsx(_components.code,{children:`llmfullresponse`}),`, `,_jsx(_components.code,{children:`llmtext`}),`, `,_jsx(_components.code,{children:`userresponse`}),`, `,_jsx(_components.code,{children:`llmcontextsummarizer`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`pkg/processors/frameworks`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`external_chain`}),` (HTTP sidecar), `,_jsx(_components.code,{children:`rtvi`}),` (RTVI protocol)`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`pkg/services`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`LLMService`}),`, `,_jsx(_components.code,{children:`STTService`}),`, `,_jsx(_components.code,{children:`TTSService`}),` interfaces; `,_jsx(_components.code,{children:`factory`}),`; 40+ provider implementations`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`pkg/realtime`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`RealtimeSession`}),`, `,_jsx(_components.code,{children:`RealtimeService`}),` — OpenAI Realtime API integration`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`pkg/runner`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`SessionStore`}),` (memory / Redis); Daily room/token helpers; telephony serializers`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`pkg/frames`})}),_jsxs(_components.td,{children:[`All frame types; `,_jsx(_components.code,{children:`serialize`}),` sub-package (JSON envelope, binary Protobuf)`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`pkg/audio`})}),_jsx(_components.td,{children:`VAD, turn analyzer, resampler, WAV encoder`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`pkg/observers`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`ObservingProcessor`}),`, Prometheus metrics, turn tracking, user–bot latency`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`pkg/mcp`})}),_jsx(_components.td,{children:`MCP stdio client; tool schema conversion; LLM tool registration`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`pkg/plugin`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`Plugin`}),` interface and `,_jsx(_components.code,{children:`Registry`}),` for config-driven pipeline assembly`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`pkg/utils`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`ExponentialBackoff`}),`, miscellaneous utilities`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`pkg/extensions`})}),_jsx(_components.td,{children:`Voicemail and IVR extensions`})]})]})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Architecture","description":"How Voxray is structured: layers, data flow, session lifecycle, frame types, and key packages.","href":"/core-concepts/architecture"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Layer Overview","slug":"layer-overview","depth":2,"children":[]},{"title":"Component Descriptions","slug":"component-descriptions","depth":2,"children":[{"title":"HTTP Server — pkg/server","slug":"http-server-—-pkg/server","depth":3,"children":[]},{"title":"Transport — pkg/transport","slug":"transport-—-pkg/transport","depth":3,"children":[]},{"title":"Runner — pkg/pipeline (runner.go)","slug":"runner-—-pkg/pipeline-runner-go","depth":3,"children":[]},{"title":"Pipeline — pkg/pipeline (pipeline.go)","slug":"pipeline-—-pkg/pipeline-pipeline-go","depth":3,"children":[]},{"title":"Processors — pkg/processors","slug":"processors-—-pkg/processors","depth":3,"children":[]},{"title":"Services — pkg/services","slug":"services-—-pkg/services","depth":3,"children":[]}]},{"title":"Data Flow Sequence","slug":"data-flow-sequence","depth":2,"children":[]},{"title":"Session Lifecycle","slug":"session-lifecycle","depth":2,"children":[]},{"title":"Frame Types","slug":"frame-types","depth":2,"children":[]},{"title":"Runner Modes","slug":"runner-modes","depth":2,"children":[]},{"title":"Key Packages Reference","slug":"key-packages-reference","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"voxray-cac3ed72","siteName":"Voxray","title":"Architecture - Voxray","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-05-17T07:52:29.619Z","originalFileLocation":"core-concepts/architecture.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"How Voxray is structured: layers, data flow, session lifecycle, frame types, and key packages.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Voxray\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/voxray-cac3ed72/_p98wii-VDulolGf/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/voxray-cac3ed72/_p98wii-VDulolGf/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/voxray-cac3ed72/_p98wii-VDulolGf/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/voxray-cac3ed72/_p98wii-VDulolGf/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/voxray-cac3ed72/_p98wii-VDulolGf/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/voxray-cac3ed72/_p98wii-VDulolGf/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/voxray-cac3ed72/_p98wii-VDulolGf/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/voxray-cac3ed72/_p98wii-VDulolGf/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/voxray-cac3ed72/_p98wii-VDulolGf/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Architecture - Voxray\">\u003cmeta data-mint-head property=\"og:description\" content=\"How Voxray is structured: layers, data flow, session lifecycle, frame types, and key packages.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Voxray\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://voxray-cac3ed72.mintlify.app/core-concepts/architecture\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://voxray-cac3ed72.mintlify.site/_mintlify/api/og/v2?division=Core+Concepts\u0026amp;title=Architecture\u0026amp;description=How+Voxray+is+structured%3A+layers%2C+data+flow%2C+session+lifecycle%2C+frame+types%2C+and+key+packages.\u0026amp;theme=e11914ded5554c02ecb3b6b2\u0026amp;signature=9aaae9482943d58517cb34f5fb30e39b662dfc22557bf114fafd594333c0ea9c\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Architecture - Voxray\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"How Voxray is structured: layers, data flow, session lifecycle, frame types, and key packages.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://voxray-cac3ed72.mintlify.site/_mintlify/api/og/v2?division=Core+Concepts\u0026amp;title=Architecture\u0026amp;description=How+Voxray+is+structured%3A+layers%2C+data+flow%2C+session+lifecycle%2C+frame+types%2C+and+key+packages.\u0026amp;theme=e11914ded5554c02ecb3b6b2\u0026amp;signature=9aaae9482943d58517cb34f5fb30e39b662dfc22557bf114fafd594333c0ea9c\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/voxray-cac3ed72/_p98wii-VDulolGf/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Voxray\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0066FF\">\u003clink data-mint-head rel=\"canonical\" href=\"https://voxray-cac3ed72.mintlify.app/core-concepts/architecture\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/core-concepts/architecture.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://voxray-cac3ed72.mintlify.app/#organization\",\"name\":\"Voxray\",\"url\":\"https://voxray-cac3ed72.mintlify.app\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/voxray-cac3ed72/D8xQd7iPPY_KolNr/logo/light.svg?fit=max\u0026auto=format\u0026n=D8xQd7iPPY_KolNr\u0026q=85\u0026s=21c39f14efb17f68ce18462dfeae2503\"}},{\"@type\":\"WebSite\",\"@id\":\"https://voxray-cac3ed72.mintlify.app#website\",\"name\":\"Voxray\",\"url\":\"https://voxray-cac3ed72.mintlify.app\",\"publisher\":{\"@id\":\"https://voxray-cac3ed72.mintlify.app/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://voxray-cac3ed72.mintlify.app/core-concepts/architecture#webpage\",\"url\":\"https://voxray-cac3ed72.mintlify.app/core-concepts/architecture\",\"name\":\"Architecture\",\"description\":\"How Voxray is structured: layers, data flow, session lifecycle, frame types, and key packages.\",\"dateModified\":\"2026-05-17T07:52:29.619Z\",\"isPartOf\":{\"@id\":\"https://voxray-cac3ed72.mintlify.app#website\"},\"breadcrumb\":{\"@id\":\"https://voxray-cac3ed72.mintlify.app/core-concepts/architecture#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://voxray-cac3ed72.mintlify.app/core-concepts/architecture#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Voxray\",\"item\":\"https://voxray-cac3ed72.mintlify.app\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Architecture\",\"item\":\"https://voxray-cac3ed72.mintlify.app/core-concepts/architecture\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://voxray-cac3ed72.mintlify.app/core-concepts/architecture#article\",\"headline\":\"Architecture\",\"name\":\"Architecture\",\"description\":\"How Voxray is structured: layers, data flow, session lifecycle, frame types, and key packages.\",\"url\":\"https://voxray-cac3ed72.mintlify.app/core-concepts/architecture\",\"mainEntityOfPage\":{\"@id\":\"https://voxray-cac3ed72.mintlify.app/core-concepts/architecture#webpage\"},\"dateModified\":\"2026-05-17T07:52:29.619Z\",\"publisher\":{\"@id\":\"https://voxray-cac3ed72.mintlify.app/#organization\"},\"isPartOf\":{\"@id\":\"https://voxray-cac3ed72.mintlify.app#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Voxray\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Voxray\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/core-concepts/architecture.md","siteName":"Voxray","nav":{"global":{"anchors":[{"anchor":"GitHub","icon":"github","href":"https://github.com/Voxray-AI/Voxray"},{"anchor":"Discord","icon":"discord","href":"https://discord.gg/voxray"}]},"tabs":[{"tab":"Documentation","groups":[{"group":"Get Started","pages":[{"title":"Introduction","href":"/get-started/introduction"},{"title":"Quickstart: WebSocket","href":"/get-started/quickstart-websocket"},{"title":"WebRTC Quickstart","href":"/get-started/quickstart-webrtc"},{"title":"Installation","href":"/get-started/installation"},{"title":"Your First Voice Agent","description":"Build a working voice agent that greets users and answers questions — from a blank config to a live conversation in under 10 minutes.","href":"/get-started/first-voice-agent"}]},{"group":"Core Concepts","pages":[{"title":"Architecture","href":"/core-concepts/architecture"},{"title":"Pipeline \u0026 Processors","description":"How the linear processor chain works, the Processor interface, built-in voice processors, and how to write a custom processor.","href":"/core-concepts/pipeline-processors"},{"title":"Transport Layer","href":"/core-concepts/transport-layer"},{"title":"Audio \u0026 VAD","href":"/core-concepts/audio-vad"},{"title":"Providers \u0026 Services","href":"/core-concepts/providers-services"},{"title":"Configuration","href":"/core-concepts/configuration"}]},{"group":"Build","pages":[{"group":"Tutorials","pages":[{"title":"Tutorials Overview","href":"/build/tutorials/overview"},{"title":"Echo Bot","href":"/build/tutorials/echo-bot"},{"title":"Local LLM with Ollama","href":"/build/tutorials/local-llm-ollama"},{"title":"Full Cloud Voice Agent with OpenAI","href":"/build/tutorials/cloud-llm-openai"},{"title":"Phone Calls with Twilio","href":"/build/tutorials/telephony-twilio"},{"title":"Production Voice Agent Pipeline","href":"/build/tutorials/production-pipeline"}]},{"group":"Integrations","pages":[{"title":"Integrations Overview","href":"/build/integrations/overview"},{"title":"OpenAI","href":"/build/integrations/openai"},{"title":"Anthropic","href":"/build/integrations/anthropic"},{"title":"Groq","href":"/build/integrations/groq"},{"title":"Ollama","href":"/build/integrations/ollama"},{"title":"ElevenLabs","href":"/build/integrations/elevenlabs"},{"title":"Sarvam","href":"/build/integrations/sarvam"},{"title":"AWS","href":"/build/integrations/aws"}]},{"title":"Plugin System","href":"/build/plugin-system"},{"title":"MCP Tools","href":"/build/mcp-tools"},{"title":"Extensions","href":"/build/extensions"}]},{"group":"Deploy","pages":[{"title":"Docker","href":"/deploy/docker"},{"title":"Docker Compose","href":"/deploy/docker-compose"},{"title":"Production Deployment","href":"/deploy/production"},{"title":"Scaling","href":"/deploy/scaling"},{"title":"Telephony","href":"/deploy/telephony"},{"title":"Observability","href":"/deploy/observability"},{"title":"Security","href":"/deploy/security"}]},{"group":"Reference","pages":[{"title":"API Reference","href":"/reference/api-reference"},{"title":"Configuration Reference","href":"/reference/configuration-reference"},{"title":"Provider Matrix","href":"/reference/provider-matrix"},{"title":"FAQ","href":"/reference/faq"},{"title":"Glossary","href":"/reference/glossary"}]},{"group":"Contributing","pages":[{"title":"Contributing Guide","href":"/contributing/guide"},{"title":"Adding Providers","href":"/contributing/adding-providers"},{"title":"Testing","href":"/contributing/testing"}]}]}]},"basePath":"","title":"Architecture - Voxray","deploymentId":"dpl_6UE2cqB47X6P7P3F2hD3UphW6ijc","buildId":"dpl_6UE2cqB47X6P7P3F2hD3UphW6ijc","dynamics":[],"chunks":[]}