microscopic-dress-75199
10/07/2025, 2:35 AMtall-airline-16756
10/07/2025, 2:35 AMtall-airline-16756
10/07/2025, 2:35 AMmicroscopic-dress-75199
10/07/2025, 2:35 AMtall-airline-16756
10/07/2025, 2:36 AMprewarm function within the main Agent! A helpful way to do this is by storing the object in the proc.userdata dictionary during the prewarm phase. Then, you can easily access this userdata in the entrypoint function using ctx.proc.userdata.
Here's a simple example to illustrate:
Prewarm Function:
def prewarm(proc: JobProcess):
proc.userdata["csv_handler"] = CSVHandler(client_data)
Entrypoint Function:
async def entrypoint(ctx: JobContext):
csv_handler = ctx.proc.userdata["csv_handler"] # Accessing prewarmed object
# Use csv_handler as needed
This method helps keep things efficient and speeds up your agent’s startup time. If anything feels unclear or if you’d like a hand with this, please don’t hesitate to reach out—I’m here to help!
Sources: Worker options | LiveKit Docs | agent/main.py | ivr-nagivator/README.mdocmicroscopic-dress-75199
10/07/2025, 2:36 AMtall-airline-16756
10/07/2025, 2:37 AMproc.userdata during the prewarm phase doesn’t automatically influence the LLM context. Think of proc.userdata as a place to keep persistent data or resources for the agent process, but it stays separate from the LLM’s conversational context.
If you’d like to shape the LLM context, you’ll want to explicitly set or update the chat_ctx parameter when you create an agent, start a session, or handle responses. For example, you can preload user-specific information into chat_ctx to make the conversation feel more personalized and relevant.
Please feel free to reach out if you’d like some help with setting up chat_ctx or integrating your data into the LLM context—I’m here to help!
Sources: Voice Assistant Applications | livekit/livekit_composite | DeepWiki | agent/main.py | livekit-agents/livekit/agents/voice/agent_session.py | External data and RAG | LiveKit Docs | examples/src/restaurant_agent.tsmicroscopic-dress-75199
10/07/2025, 2:39 AMtall-airline-16756
10/07/2025, 2:40 AMproc.userdata to your agent during initialization. For instance, if you store a resource like a preloaded model in proc.userdata during the prewarm phase, you can easily retrieve it later in the entry function and pass it to your agent when initializing.
Here’s a simple example to illustrate this:
Prewarm Function:
def prewarm(proc: JobProcess):
proc.userdata["csv_handler"] = CSVHandler(client_data)
Entrypoint Function:
async def entrypoint(ctx: JobContext):
csv_handler = ctx.proc.userdata["csv_handler"] # Accessing the prewarmed object
agent = MyAgent(csv_handler=csv_handler, ...)
This approach helps you reuse resources efficiently that were set up during prewarm. If you have any questions or need a hand with this, please don’t hesitate to ask—I’m here to help!
Sources: examples/src/drive-thru/drivethru_agent.ts | complex-agents/drive-thru/session_setup.py | Workflows | LiveKit Docsmicroscopic-dress-75199
10/07/2025, 2:46 AMtall-airline-16756
10/07/2025, 2:47 AMmicroscopic-dress-75199
10/07/2025, 2:48 AMtall-airline-16756
10/07/2025, 2:48 AM