tall-cricket-35295
04/08/2026, 8:26 PMtall-airline-16756
04/08/2026, 8:26 PMtall-airline-16756
04/08/2026, 8:26 PMinput_audio_noise_reduction.
If you meant a specific SDK, device type, or another provider where `near_field`/`far_field` appear, tell me which one and I’ll look up or compare alternatives and recommend settings.
Sources: OpenAI Realtime API plugin guide | LiveKit Documentation | Azure OpenAI Realtime API and LiveKit | LiveKit Documentation | Pricing | LiveKit | Turns overview | LiveKit Documentation, with interactive elementstall-cricket-35295
04/09/2026, 6:46 PMtall-airline-16756
04/09/2026, 6:46 PMsetup_fnc / Node prewarm) is designed to load long‑loading models into proc.userdata so agent jobs start faster.
• The docs do not explicitly show examples that prewarm Cartesia TTS or the OpenAI Realtime model, but the same prewarm pattern can be used for any model that needs loading time.
If you want to implement this, tell me which runtime you’re using (Node or Python) and whether you want:
• an example that preloads Cartesia TTS,
• an example that preloads an OpenAI Realtime client/connection,
or
• both — and I’ll provide concise code showing how to load them into proc.userdata and access them from entry. Sources: Server options | LiveKit Documentation | Understand and Improve Agent Latency | LiveKit | Cartesia TTS | LiveKit Documentation | Realtime models overview | LiveKit Documentation, with interactive elementstall-cricket-35295
04/09/2026, 6:47 PMtall-airline-16756
04/09/2026, 6:48 PMsetup_fnc (prewarm) to load models/clients into proc.userdata.
• Store the loaded objects on proc.userdata so entry can reuse them without reloading.
• Ensure any clients you pre-warm are safe to reuse across jobs in your environment (e.g., thread/process safety). If a client requires per-job state, pre-warm a factory or connection helper instead.
Example (Python)
1. Minimal pattern using setup_fnc to pre-warm Cartesia TTS and an OpenAI Realtime client:
from livekit_agents import AgentServer, JobProcess, JobContext
# Pseudo-imports - replace with actual Cartesia & OpenAI client libraries
# from cartesia import CartesiaTTS
# from openai_realtime_client import OpenAIRealtimeClient
server = AgentServer()
def prewarm(proc: JobProcess):
# Pre-warm Cartesia TTS (replace with actual Cartesia init)
proc.userdata["cartesia_tts"] = CartesiaTTS(api_key="YOUR_CARTESIA_KEY", model="cartesia-model")
# Pre-warm OpenAI Realtime client/connection (replace with actual client init)
proc.userdata["openai_realtime"] = OpenAIRealtimeClient(api_key="YOUR_OPENAI_KEY", model="gpt-realtime")
server.setup_fnc = prewarm
async def entry(ctx: JobContext):
# Access pre-warmed instances
tts = ctx.proc.userdata["cartesia_tts"]
openai_rt = ctx.proc.userdata["openai_realtime"]
# Example usage (pseudo-code)
audio_bytes = tts.synthesize_text("Hello from prewarmed Cartesia")
# send audio or use openai_realtime client for realtime interactions
await openai_rt.send_audio(audio_bytes)
# ... rest of job logic ...
server.entry_fnc = entry
if __name__ == "__main__":
server.run()
1. If the OpenAI realtime client requires an async connection handshake, pre-warm a ready-to-use client or a lightweight factory that opens connections on demand. Example pattern:
async def prewarm_async(proc: JobProcess):
proc.userdata["cartesia_tts"] = CartesiaTTS(api_key="KEY")
client = OpenAIRealtimeClient(api_key="OPENAI_KEY")
await client.connect() # if connect is async and reusable
proc.userdata["openai_realtime"] = client
server.setup_fnc = lambda p: None # keep sync signature, call async prewarm elsewhere if needed
# Or if framework supports async setup, register prewarm_async accordingly.
Recommendations
• Test reuse safety: verify the Cartesia TTS instance and OpenAI realtime client can be reused across jobs or processes in your deployment.
• If clients are not safe to share, pre-warm a heavy-weight artifact (model weights, tokenizer, etc.) and create per-job client instances quickly using those artifacts.
• Monitor memory: pre-warming large models increases resident memory per process.
If you want, I can:
• Provide a fully runnable example with a specific Cartesia TTS Python SDK and a real OpenAI Realtime client API (if you share which SDKs/libs you plan to use), or
• Show an async-compatible setup that fits your exact agent server version., with interactive elementstall-cricket-35295
04/13/2026, 7:22 PMtall-airline-16756
04/13/2026, 7:22 PM