Skip to main content

Internal Module Dependencies


External Service Integrations

AspectDetail
PurposeMedia server, SIP gateway, room management, Egress (recording)
SDKlivekit-api (backend), livekit-agents (worker), @livekit/components-react (widget)
ConfigLIVEKIT_API_KEY, LIVEKIT_API_SECRET, LIVEKIT_URL, LIVEKIT_SIP_URI
Integration PointsSIP trunk creation, dispatch rules, outbound SIP participant, room egress, webhook events
Failure HandlingLiveKit SIP errors caught and logged; LiveKitSIPError exception class
Critical Filesapp/services/livekit/livekit_api.py, app/services/livekit/livekit_singleton.py

Additional AI Providers

ProviderSDKConfig KeyUsed For
Groqlivekit-plugins-groqGROQ_API_KEYLLM
Deepgramlivekit-plugins-deepgramDEEPGRAM_API_KEYSTT, TTS
ElevenLabslivekit-plugins-elevenlabsELEVENLABS_API_KEYTTS
Cartesialivekit-plugins-cartesiaCARTESIA_API_KEYSTT, TTS
Sarvamlivekit-plugins-sarvamSARVAM_API_KEYSTT, TTS
Rimelivekit-plugins-rimeRIME_API_KEYTTS
Murflivekit-plugins-murfMURF_API_KEYTTS
Inworldlivekit-plugins-inworldINWORLD_API_KEYTTS

Secrets Management

All secrets are managed via environment variables, loaded by pydantic-settings.BaseSettings with optional .env file support.
# app/core/config/settings.py
DOTENV_PATH = Path(__file__).resolve().parents[2] / "env" / ".env"
ENV = os.getenv("ENV", "prod")

# .env file loaded ONLY in local/dev/development environments
ENV_FILE = DOTENV_PATH if LOAD_DOTENV or ENV in {"local", "dev"} else None

Secret Types

  • SecretStr fields: OPENAI_API_KEY, S3_ACCESS_KEY, JWT_API_SECRET, TWILIO_AUTH_TOKEN, LIVEKIT_API_SECRET, etc.
  • Access pattern: settings.SECRET_FIELD.get_secret_value() (prevents accidental logging)
  • Docker: Production uses env_file directive — values never committed to Git

Failure Handling Summary

IntegrationFailure Strategy
LiveKit SIPErrors caught with LiveKitSIPError; logged but may leave orphaned resources
Twilio/VonageSDK/HTTP exceptions caught; returned as error dicts
OpenAIPlugin-level handling; streaming errors terminate turn
S3 UploadLiveKit Egress handles directly; download errors return recording: null
RedisConnection errors may break capacity tracking
PostgreSQLSQLAlchemy session rollback on exception
CeleryAuto-retry with max_retries=3 for batch dispatch
Several integrations catch Exception broadly, which can mask unexpected errors. See Risks & Recommendations for details.