cold-soccer-35030
11/28/2025, 1:26 AMtall-airline-16756
11/28/2025, 1:26 AMtall-airline-16756
11/28/2025, 1:26 AMroom_name (i.e., ctx.room.name) from an AgentSession. You can access it from the JobContext passed to your agent entrypoint and then pass it into the session/agent so your agent logic can use it.
Which language are you using (Node.js or Python)? I can give the exact snippet — quick examples below; tell me which one you want.
Node.js example (use in your entry function):
export default defineAgent({
entry: async (ctx: JobContext) => {
console.log('Room name:', ctx.room.name);
const session = new voice.AgentSession({ /* stt/llm/etc */ });
await session.start({
agent: new voice.Agent({ instructions: '...' }),
room: ctx.room, // pass the Room
});
// or pass the name into your agent:
await session.start({
agent: new MyAgent(ctx.room.name),
room: ctx.room,
});
},
});
Python example (use in your rtc_session handler):
@server.rtc_session()
async def my_agent(ctx: JobContext):
print(f"Room name: {ctx.room.name}")
session = AgentSession(/* stt, llm, etc. */)
await session.start(
agent=MyAgent(ctx.room.name),
room=ctx.room,
)
If you need ctx.room.name inside agent methods (e.g., onEnter), initialize the agent with the room name (as shown) or store `ctx`/`ctx.room` on the session/agent when starting it. Want the full code for your specific agent class or a pattern for accessing it inside tools/handlers?
Sources: Job lifecycle | LiveKit docs | Agents v0.x migration guide - Node.js | LiveKit Docs | Authentication | LiveKit docs | Agents and handoffs | LiveKit docs | Agents (Node.js) | livekit/livekit_composite | DeepWiki