How rapidaai/voice-ai works
1. This repo is a polyglot monorepo for a voice-AI platform, but the architectural center is the Go backend suite under api/, plus a React UI under ui/, and a separate Python document-ingestion service under api/document-api.
2. The main runtime boundaries are four Go services plus one Python service:
- web-api for product-facing CRUD and account/workspace management
- assistant-api for real-time agent orchestration and voice sessions
- endpoint-api for endpoint definition/invocation workflows
- integration-api for provider normalization and external AI integrations
- document-api for knowledge/document ingestion and indexing
These are deployed independently, with their own configs, migrations, and routers.
3. web-api is the control-plane backend for the UI. It manages organizations, projects, users, notifications, vault/connect resources, and proxy endpoints that fan out to the other APIs. It also owns its own relational schema via migrations and uses shared auth/service clients from pkg/.
4. assistant-api is the core data-plane service. It handles live voice sessions, assistant configuration, deployments, conversations, messages, telemetry, knowledge attachment, tools, and webhooks. Its architecture is layered: HTTP/gRPC-facing api/ handlers on top, service/use-case code in internal/services, and domain entities in internal/entity.
5. Inside assistant-api, the most important subsystem is the channel/pipeline layer: internal/channel/*, internal/adapters/*, and internal/channel/telephony/* / webrtc/*. This is where audio and session events are turned into a real-time pipeline that can accept input, dispatch it through STT/LLM/tooling, and emit output back to the channel.
6. The assistant voice pipeline depends on several low-level audio components:
- VAD engines in internal/vad
- noise suppression in internal/denoiser
- end-of-speech detectors in internal/end_of_speech
- audio resampling/normalization in internal/audio and internal/normalizer
These are not UI concerns; they are latency-critical runtime components that sit directly on the audio stream.
7. Telephony is a major boundary in assistant-api. The repo includes adapters for Twilio, Vonage, Telnyx, Exotel, SIP/Asterisk, and WebRTC, with media/session/registration state machines and outbound/inbound call handling. That means the platform is designed to bridge external phone systems into the same assistant pipeline used for web or debugger sessions.
8. Model/provider integration is abstracted heavily. api/assistant-api/internal/transformer/* contains provider-specific STT/TTS adapters for vendors like OpenAI, Deepgram, Google, Azure, AssemblyAI, ElevenLabs, Cartesia, NVIDIA, and others; api/integration-api/internal/caller/* contains the normalized chat/embedding/reranking/provider layer for LLM and related APIs. Together, these separate “provider specifics” from the higher-level assistant orchestration.
9. integration-api acts as a provider gateway. It exposes chat, embedding, reranking, audit logging, and unified provider endpoints, and internally it contains vendor-specific caller implementations and credential verification paths. This service is the main integration boundary between the platform and external AI vendors.
10. endpoint-api is the endpoint management/service-execution backend. It stores endpoint definitions, retry/cache configs, versions, provider models, and logs, then exposes invocation and trace retrieval. In the architecture diagram, this is the service for API-style endpoint execution rather than live voice sessions.
11. document-api is a separate Python pipeline for knowledge ingestion and indexing. It includes connectors to storage and source systems, extractors/chunkers/cleaners, vector-store and docstore components, Celery workers, and bridges to other services via generated protobuf clients. It depends on infrastructure like PostgreSQL, Redis, and OpenSearch, and is the service to draw for RAG/document processing rather than online voice execution.
12. The React ui/ package is the management console. It talks to web-api and proxy-backed APIs to manage assistants, endpoints, knowledge bases, integrations, users, and observability views. The UI is organized by domain pages and shared components, with many provider/config forms that mirror the backend’s provider abstractions.
13. Shared infrastructure and libraries live in pkg/ and are used across services. This includes:
- auth and scope authenticators
- generated/protobuf and REST clients
- configuration and connector factories
- telemetry/logging helpers
- storage abstractions
- plugin/provider registries
- common domain types and utilities
This layer is the main cross-service reuse boundary.
14. Persistence and external systems are central to the architecture: PostgreSQL for core relational state, Redis for caching/worker coordination, OpenSearch for document/vector search, and object storage backends like S3/GCS/Azure Blob for files and media assets. The services also integrate with many external SaaS/AI providers for speech, LLM, telephony, email, and telemetry.
15. Operationally, the repo is designed for containerized deployment. Each service has its own Dockerfile and env/config file, the root includes Docker Compose and nginx/API-gateway setup, and CI/CD workflows build images and deploy individual services. This supports both fully managed and self-hosted topologies.
16. For an architecture diagram, the clearest top-level picture is: UI and external clients hit the web/API gateway layer; that layer coordinates with assistant, endpoint, integration, and document services; assistant handles realtime audio/session execution via telephony/WebRTC and model providers; document-api handles ingestion/indexing; shared libs and infrastructure sit underneath all services.
Main entry points: web-api web-api · assistant-api assistant-api · integration-api integration-api · document-api document-api
Components 18
API services
Independently deployed backend services under api/.
- web-api · Product-facing backend for organizations, projects, users, notifications, vault/connect resources, and proxy fan-out.
api/web-api - assistant-api · Core voice assistant backend for live sessions, deployments, conversations, telemetry, tools, knowledge, and webhooks.
api/assistant-api - endpoint-api · Endpoint definition, versioning, retry/cache config, invocation, and trace/log retrieval backend.
api/endpoint-api - integration-api · Unified external AI provider gateway for chat, embeddings, reranking, and audit logging.
api/integration-api - document-api · Python service for document ingestion, extraction, chunking, indexing, and vector/docstore writes.
api/document-api - Callers · Vendor-specific normalized chat, embedding, reranking, and credential verification implementations.
api/integration-api/internal/caller - Doc pipeline · Extraction, cleaning, chunking, splitting, indexing, and docstore/vector-store processing stages.
api/document-api/app/core - Connectors · Storage, source-system, and bridge adapters used by the ingestion service.
api/document-api/app/connectors - Cmd entrypoints · Top-level Go service binaries for web, assistant, endpoint, and integration processes.
cmd
Assistant internals
Core realtime voice runtime inside assistant-api.
- Pipeline · Realtime session pipeline that routes audio and events between input, STT/LLM/tools, and output.
api/assistant-api/internal/channel/pipeline - Telephony · Inbound/outbound call adapters and state machines for Twilio, Vonage, Telnyx, Exotel, SIP/Asterisk, and related media handling.
api/assistant-api/internal/channel/telephony - WebRTC · WebRTC streaming and session loops for browser-based assistant sessions.
api/assistant-api/internal/channel/webrtc - Audio core · Latency-critical audio processing: VAD, denoising, end-of-speech, resampling, normalization, and buffering.
api/assistant-api/internal/audio - Transformers · Provider-specific STT/TTS implementations and normalization for speech vendors.
api/assistant-api/internal/transformer - LLM runtime · AgentKit/model execution layer, websocket chat runtime, embeddings, reranking, variables, and tool dispatch.
api/assistant-api/internal/llm
Shared platform
Cross-service packages and infrastructure under pkg/.
- pkg · Cross-service shared auth, clients, configs, connectors, telemetry, storages, plugins, types, and utilities.
pkg - Infra · PostgreSQL, Redis, OpenSearch, object storage, and external SaaS/AI providers used across services.
Management UI
React console under ui/.
- UI · Management console for assistants, endpoints, knowledge, integrations, users, and observability.
ui
Connections 30
- UI → web-api: manage · UI drives product workflows through the control-plane backend.
- web-api → assistant-api: proxy · Control plane proxies assistant management and related workflows.
- web-api → endpoint-api: proxy · Control plane proxies endpoint management and invocation workflows.
- web-api → integration-api: proxy · Control plane proxies provider and integration management.
- web-api → document-api: proxy · Control plane coordinates knowledge/document ingestion workflows.
- assistant-api → Pipeline: orchestrates · Assistant API routes live sessions into the realtime pipeline.
- assistant-api → Telephony: bridges · Assistant API connects phone systems into the assistant pipeline.
- assistant-api → WebRTC: streams · Assistant API serves browser-based realtime sessions.
- Pipeline → Audio core: processes · Pipeline consumes audio runtime components for low-latency speech handling.
- Pipeline → Transformers: uses · Pipeline delegates STT/TTS vendor work to transformers.
- Pipeline → LLM runtime: executes · Pipeline invokes model/agent execution and tool dispatch.
- LLM runtime → integration-api: calls · Assistant runtime uses normalized integration APIs for provider access.
- integration-api → Callers: implements · Provider gateway is backed by vendor-specific caller implementations.
- document-api → Doc pipeline: runs · Ingestion service executes the document processing pipeline.
- document-api → Connectors: ingests · Ingestion service pulls from source systems and storage backends.
- document-api → integration-api: calls · Document service uses shared integration/provider capabilities where needed.
- web-api → pkg: shares · Web API reuses shared auth, clients, and storage abstractions.
- assistant-api → pkg: shares · Assistant API consumes shared libraries for auth, clients, telemetry, and utilities.
- endpoint-api → pkg: shares · Endpoint API reuses common platform libraries.
- integration-api → pkg: shares · Integration API reuses common platform libraries.
- document-api → pkg: shares · Document service depends on shared clients and utilities.
- Cmd entrypoints → web-api: starts · Service binary launches the web API process.
- Cmd entrypoints → assistant-api: starts · Service binary launches the assistant API process.
- Cmd entrypoints → endpoint-api: starts · Service binary launches the endpoint API process.
- Cmd entrypoints → integration-api: starts · Service binary launches the integration API process.
- document-api → Infra: depends on · Ingestion relies on relational, cache, search, and object-storage infrastructure.
- assistant-api → Infra: depends on · Realtime assistant runtime depends on persistence, cache, search, and external providers.
- web-api → Infra: depends on · Control plane persists relational state and integrates with external services.
- endpoint-api → Infra: depends on · Endpoint backend stores definitions, versions, and logs in core infrastructure.
- integration-api → Infra: depends on · Provider gateway uses shared persistence and external vendor APIs.