early-window-29567
11/05/2025, 7:33 PM# Create agents - they will access state via self.session.userdata
intro_agent = IntroAgent()
roleplay_agent = RoleplayAgent()
quiz_agent = QuizAgent()
case_study_agent = CaseStudyAgent()
# Store agent references in userdata
userdata.intro_agent = intro_agent
userdata.roleplay_agent = roleplay_agent
userdata.quiz_agent = quiz_agent
userdata.case_study_agent = case_study_agent
or is there a better way?tall-airline-16756
11/05/2025, 7:33 PMtall-airline-16756
11/05/2025, 7:34 PMsession.userdata and within tools through RunContext, while agents themselves should remain stateless.
A better approach:
• Keep only identifiers/config in userdata (e.g., which module to use next, params).
• Expose each agent’s capabilities as callable tools and let the LLM invoke them to delegate or hand off work.
Helpful references:
• Userdata and access via RunContext Tool definition and use | LiveKit docs
• Agent/session architecture Building voice agents | LiveKit Docs
• Multi-agent design and delegating via tools/workflows Building Multi-Agent Architectures with LiveKit Agents
Would you like a minimal example showing how to register tools for IntroAgent, RoleplayAgent, etc., and route using userdata?
Sources: Workflows | LiveKit Docs | Tool definition and use | LiveKit docs | Building voice agents | LiveKit Docs | Building Multi-Agent Architectures with LiveKit Agentsearly-window-29567
11/05/2025, 7:42 PMtall-airline-16756
11/05/2025, 7:43 PMuserdata, but the recommended pattern is to keep agents stateless and store only lightweight session context in userdata, using tools for delegation between agents.
If you want, I can review a snippet of your current setup and suggest minimal changes to align with that pattern.