modern-winter-66316
12/06/2025, 12:44 AMtall-airline-16756
12/06/2025, 12:44 AMtall-airline-16756
12/06/2025, 12:44 AMmodern-winter-66316
12/06/2025, 12:45 AMasync def (e.g., async def on_enter(self) and async def respond(self, message)), because the agent framework and session I/O are asynchronous.
• Read dispatch metadata from ctx.job.metadata (a JSON string). Parse it with json.loads(ctx.job.metadata) and read the "persona" key.
If that matches your worker, I’ll produce the full async agent.py with all 11 persona classes, starter prompts, persona registry, and an entrypoint that reads ctx.job.metadata. If your worker uses a different job variable name or a different metadata path, paste the small entrypoint snippet and I’ll match it exactly.
Sources: Agents and handoffs | LiveKit docs | Job lifecycle | LiveKit docs | Agent dispatch | LiveKit docs
Zak [1:38 PM]
Here’s the snippet from agent/main.py showing how the worker receives and handles each job dispatch:
async def entrypoint(_ctx_: JobContext):
"""
Agent entrypoint - called when agent is dispatched to a room
"""
logger.info(f"Agent {AGENT_NAME} connecting to room {ctx.job.room.name}")
# Connect to the room
await ctx.connect(_auto_subscribe_=AutoSubscribe.AUDIO_ONLY)
# Parse job metadata
metadata = parse_metadata(ctx.job.metadata or "{}")
scenario = metadata.get("scenario", "teaching")
logger.info(f"Job metadata: {metadata}")
logger.info(f"Scenario: {scenario}")
# ... configure assistant and start session ...
This shows the JobContext object (ctx) providing ctx.job and ctx.job.metadata, which is where your dispatch metadata (like persona/scenario) currently comes from.tall-airline-16756
12/06/2025, 12:46 AMagent.py that:
• Implements async lifecycle hooks (async def on_enter, async def respond, etc.)
• Parses dispatch metadata from ctx.job.metadata via json.loads(...)
• Matches the entrypoint snippet you pasted
Before I produce the full file, I need one thing from you: please paste the 11 persona names and their starter prompts (one-line or paragraph each) or point me to the exact text you want used for each persona. If you don't have them, tell me if you want example personas (I can create sensible defaults) or a shorter set to start with.
Sources: Agents and handoffs | LiveKit docs | Agent dispatch | LiveKit docs | External data and RAG | LiveKit Docsmodern-winter-66316
12/06/2025, 12:49 AMtall-airline-16756
12/06/2025, 12:50 AMmodern-winter-66316
12/06/2025, 1:08 AM