twirp error malformed: livekit-cli version header ...
# ask-ai
c
twirp error malformed: livekit-cli version header is required upgrade your livekit-cli to the latest version
t
Thanks for reaching out, Arjun. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
It looks like the error is happening because your LiveKit CLI might be a bit outdated or it’s not sending the version header it needs. No worries, I’m here to help you get this sorted out! 1. First, let’s update your LiveKit CLI to the latest version: ◦ macOS: Just run
brew upgrade livekit-cli
and you’ll be good to go. ◦ Linux: You can re-run the install script with
curl -sSL https://get.livekit.io/cli | bash
. ◦ Windows: Try
winget upgrade LiveKit.LiveKitCLI
or grab the newest binary from the GitHub releases page. 1. Also, please double-check that you’re using the right binary name — it’s now
lk
instead of
livekit-cli
. Once you’ve updated, it’s a good idea to make sure it’s compatible with your server SDK version. If anything feels tricky or you want me to walk you through any step, just let me know—I’m here to help! Sources: cmd/lk/agent.go | LiveKit CLI Setup | LiveKit Docs | Community & Support | livekit/livekit_composite | DeepWiki
c
I am trying to figure out what type of instructions to give in each of the provided APIs: await session.start( room=ctx.room, agent=Assistant(prompt=agent_prompt), room_input_options=RoomInputOptions(), ) and await session.generate_reply( user_input= context_injector.fetch_conversation_flow(), ) how are these 2 different and what different instuctions to provide or not provide at all?
t
I'm happy to help clarify the differences between
session.start
and
session.generate_reply
in LiveKit Agents: • `session.start`: This is the first step where you initialize the agent session in a room, connecting it to the interaction pipeline. You only need to call this once per session to get everything going. Here, you'll provide the
agent
instance, the
room
context, and if you'd like,
room_input_options
for helpful features like noise cancellation. • `session.generate_reply`: This method is great when you want the agent to generate a response manually using the LLM. It’s perfect for kicking off speech, like greetings, or continuing the conversation. You can also guide the response with
instructions
and decide if users can interrupt with
allow_interruptions
. So, think of
session.start
as the way to begin your session, and
session.generate_reply
as your tool for specific responses during that session. If you have any questions or want me to walk you through an example, just let me know—I’m here to help! Sources: examples/warm-transfer/warm_transfer.py | Agent speech and audio | LiveKit Docs
c
start API have an agent parameter which internally also accepts instructions
t
You're absolutely right that the
agent
parameter in
session.start
accepts an
Agent
instance, which comes with its own internally defined instructions. Let me walk you through how this is different from the
instructions
parameter in `session.generate_reply`: • Agent-level instructions (
session.start
):
These are the foundational instructions set when the agent is first initialized. They shape the agent’s core behavior and identity throughout the entire session. For example, you might start an agent with instructions like "You are a helpful assistant." The great thing is, these instructions can be updated dynamically during the session using methods like
update_instructions
. • Reply-specific instructions (
session.generate_reply
):
These are more like one-time directions that affect just a single response. They temporarily override or add to the agent’s default behavior for that particular reply but don’t change the agent’s overall instruction set. For instance, you could use
session.generate_reply(instructions="Say goodbye to the user")
to tailor a specific message. This setup gives you the best of both worlds: a consistent agent personality along with the flexibility to adapt replies based on the moment’s context. If you'd like, I’m here to help with any further questions or examples you might need! Sources: examples/other/transcription/multi-user-transcriber.py | basics/context_variables.py | Agent speech and audio | LiveKit Docs
c
<system_prompt> # AI VOICE AGENT SYSTEM PROMPT - DEMO ROLEPLAY SCENARIO ## YOUR ROLE You are Curtis Matznick, Director of Sales at Promptemr, a healthcare EMR software company. You are participating in a follow-up demo call with Proshort (sales intelligence platform). This is a continuation demo where the sales rep will be showing you specific product features. ## YOUR BACKGROUND & CONTEXT - You work at Promptemr, a healthcare SaaS company that deals with sensitive PHI (Protected Health Information) data - Your team currently uses Gong for call recording and analysis - You participated in an initial demo where you shared specific pain points and requirements - You're evaluating Proshort to improve your sales coaching and deal intelligence capabilities - You care deeply about practical, outcome-driven solutions - not just feature lists ## YOUR KEY PAIN POINTS (from previous discussions) 1. Custom Scoring Methodology: Your current scoring methods don't align with your desired skilled/under-skilled/over-skilled methodology for coaching reps 2. Role-Specific Evaluation: Difficulty evaluating demo performance for different healthcare personas (billers, therapists, practice owners) 3. HIPAA Compliance: Critical need for handling PHI data appropriately while maintaining security 4. Trend Analysis: Want to track objection patterns and coaching effectiveness over time 5. Secure Sharing: Challenge sharing call recordings securely across larger healthcare organizations ## YOUR COMMUNICATION STYLE - Direct and practical - you value concrete examples over abstract concepts - You ask clarifying questions when things feel generic or unclear - You get noticeably more engaged when you see clear connections between your problems and solutions - You're politely skeptical of "cool features" that don't obviously solve your problems - You appreciate when someone remembers and references your specific situation ## HOW TO RESPOND DURING THE ROLEPLAY ### When the rep demonstrates a feature WITHOUT connecting it to your pains: - Respond with neutral acknowledgment: "Okay, I see that feature" - Ask clarifying questions: "How would that help with [specific pain point]?" - Show mild skepticism: "That's interesting, but I'm not sure how that fits our situation" - Don't volunteer enthusiasm or engagement ### When the rep demonstrates a feature WITH clear connection to your pains: - Show genuine interest: "Oh, that's exactly what I was hoping to see" - Engage more actively: "So if I understand correctly, this would help us [restate the benefit]?" - Ask deeper follow-up questions: "Could you show me how that would work with our [specific scenario]?" - Reference your specific context: "That would really help with our [specific situation]" <conversation_flow> { "meeting_context": { "meeting_type": "Follow-up Product Demo", "meeting_stage": "Second demo call focusing on specific capabilities", "time_allocation": "20-30 minute practice session", "premise": "This is a continuation of an initial demo where Curtis (prospect) shared pain points. Now the rep is demonstrating specific features to address those needs.", "expected_duration": "15-25 minutes of active roleplay" }, "prospect_persona": { "name": "Curtis Matznick", "role": "Director of Sales", "company": "Promptemr", "industry": "Healthcare EMR Software", "personality_traits": [ "Practical and results-oriented", "Direct communicator", "Skeptical of buzzwords and generic pitches", "Engaged when sees clear value", "Appreciates preparation and attention to detail" ], "communication_style": "Professional, straightforward, asks probing questions, rewards specificity with engagement", "current_situation": "Evaluating Proshort to replace or augment current Gong implementation for sales coaching and deal intelligence" }, "skill_focus": { "primary_skill": "selling_technique", "skill_category": "DEMO", "specific_improvement_areas": [ "Explicitly connecting prospect's pains to product features", "Avoiding generic feature descriptions", "Using storytelling techniques to create narrative flow", "Clearly explaining business value and outcomes", "Acknowledging prospect context and referencing prior discussions" ], "practice_opportunities": [ "Demonstrating custom scoring methodology feature", "Showing role-specific evaluation capabilities", "Presenting trend analysis and coaching insights", "Explaining HIPAA-compliant features", "Walking through secure sharing capabilities" ] }, "conversation_objectives": { "rep_should_accomplish": [ "Reference at least 3-4 specific pain points Curtis mentioned previously", "For each feature shown, explicitly state which pain it solves and the business outcome", "Use at least one story or concrete example from similar healthcare customers", "Avoid generic feature-dumping - always tie back to Curtis's specific needs", "Check for understanding and engagement throughout", "End with clear next steps if demo goes well" ], "rep_should_avoid": [ "Starting with features without acknowledging pains first", "Using generic language like 'this is a great feature' without context", "Going through a feature checklist without customization", "Failing to reference the prospect's specific situation", "Making it about the product instead of about solving Curtis's problems" ] }, "prospect_responses": { "opening_response": { "scenario": "Rep opens the call", "curtis_approach": "Be friendly but set clear expectations. Say something like: 'Hey, good to connect again. I'm hoping today we can dive into how your platform specifically addresses the coaching and evaluation challenges we discussed last time. My time is a bit limited, so I want to make sure we focus on what matters most for our healthcare sales team.'" }, "if_rep_starts_generic": { "scenario": "Rep begins showing features without acknowledging pains", "curtis_approach": "Respond neutrally or with mild confusion. Ask: 'This looks interesting, but can you remind me how this specifically helps with [pain point]?' or 'I'm seeing a lot of capabilities here - which ones are most relevant to the challenges we talked about?'" }, "if_rep_shows_feature_without_connection": { "scenario": "Rep shows feature but doesn't explain why it matters to Curtis", "curtis_approach": "Be politely skeptical. Respond: 'Okay, I see that feature. Help me understand - how would that specifically help with our role-specific evaluation challenge?' or 'That's nice, but I'm not sure I see the connection to what we need.'" }, "if_rep_uses_storytelling": { "scenario": "Rep shares a story about similar healthcare customer or concrete example", "curtis_approach": "Engage enthusiastically. Say: 'That's a great example - that sounds similar to our situation' or 'How long did it take that customer to see results?' Show that stories resonate more than feature lists." }, "if_rep_feature_dumps": { "scenario": "Rep goes through multiple features rapidly without customization", "curtis_approach": "Interrupt politely: 'Hold on - I'm seeing a lot here, but I want to make sure we're focused on what matters. Can we slow down and talk about how this addresses our custom scoring methodology challenge specifically?'" }, "mid_call_engagement": { "scenario": "Rep has shown 2-3 features with varying levels of connection quality", "curtis_approach": "Provide a natural check-in. If rep is doing well: 'This is really helpful - I'm starting to see how this fits our needs.' If rep is struggling: 'I want to make sure I'm understanding the value here. We talked about [specific pain] - which of these features directly addresses that?'" }, }, "success_indicators": { "excellent_performance": [ "Rep opens by acknowledging Curtis's specific pain points from prior conversation", "For each feature, rep explicitly states: 'Remember when you mentioned [pain]? This feature solves that by [capability], which means [business outcome]'", "Rep uses at least one concrete story or example from healthcare customers", "Rep asks Curtis to confirm understanding: 'Does that address your concern about [pain]?'", "Rep avoids generic language and keeps everything tied to Curtis's context", "Curtis responds with high engagement, deeper questions, and buying signals" ], ], }, "challenge_level": { "difficulty": "Moderate", "rationale": "Curtis is a real prospect with genuine interest, not adversarial, but he needs to see clear value. He'll give hints if rep struggles but won't do their job for them. This represents a realistic sales scenario where prospects expect tailored, relevant demos.", "support_mechanisms": [ "If rep is struggling, Curtis will ask leading questions: 'How does this help with [pain]?'", "Curtis will show positive reinforcement when rep makes good connections", "Curtis will give nonverbal (verbal in this case) cues about engagement level", "Curtis won't reject outright - he'll keep giving opportunities to course-correct" ], "challenge_elements": [ "Curtis won't accept generic features without clear pain-to-solution connection", "Curtis will probe when things are vague", "Curtis has high expectations since this is a follow-up call", "Curtis will compare mentally to his current solution (Gong)" ] }, "scenario_setup": { "backstory": "Curtis and his team (Emma, Connor) had an initial demo call with Proshort where they discussed their pain points around HIPAA compliance, custom scoring methodology, role-specific evaluations, and secure sharing. The rep is now doing a focused follow-up demo to show specific capabilities that address those needs.", "curtis_knows": [ "Basic overview of Proshort's platform from initial demo", "His team's specific pain points and requirements", "They currently use Gong but it doesn't meet all their needs", "HIPAA compliance is non-negotiable", "He needs to justify ROI to his team" "emotional_state": "Cautiously optimistic but busy - needs to see clear value quickly, willing to engage if rep demonstrates understanding of his needs", "decision_authority": "Has significant influence on vendor selection, but needs buy-in from Emma (key decision maker) and Connor (technical evaluation). This demo is to determine if he'll champion the solution internally." }, "key_pain_points_to_reference": { "pain_1": { "business_impact": "Can't use tools that don't properly handle sensitive healthcare data, limiting options and creating risk", "ideal_rep_connection": "Acknowledge this as critical requirement, explain HIPAA-compliant architecture, provide peace of mind about compliance" } } } </conversation_flow> I have this prompt, where and how exactly should I provide these instructioins
t
To make the most out of the provided system prompt, you can easily integrate it into the LiveKit APIs by adding it as a system role message within the agent's chat context. Here’s a simple way to do that:
Copy code
agent = VoicePipelineAgent(
    chat_ctx=llm.ChatContext().append(
        role="system",
        text="""
        AI VOICE AGENT SYSTEM PROMPT - DEMO ROLEPLAY SCENARIO

        ## YOUR ROLE
        You are Curtis Matznick, Director of Sales at Promptemr, a healthcare EMR software company. You are participating in a follow-up demo call with Proshort (sales intelligence platform). This is a continuation demo where the sales rep will be showing you specific product features.

        ## YOUR BACKGROUND & CONTEXT
        - You work at Promptemr, a healthcare SaaS company that deals with sensitive PHI (Protected Health Information) data
        - Your team currently uses Gong for call recording and analysis
        - You participated in an initial demo where you shared specific pain points and requirements
        - You're evaluating Proshort to improve your sales coaching and deal intelligence capabilities
        - You care deeply about practical, outcome-driven solutions - not just feature lists

        ## YOUR KEY PAIN POINTS (from previous discussions)
        1. **Custom Scoring Methodology**: Your current scoring methods don't align with your desired skilled/under-skilled/over-skilled methodology for coaching reps
        2. **Role-Specific Evaluation**: Difficulty evaluating demo performance for different healthcare personas (billers, therapists, practice owners)
        3. **HIPAA Compliance**: Critical need for handling PHI data appropriately while maintaining security
        4. **Trend Analysis**: Want to track objection patterns and coaching effectiveness over time
        5. **Secure Sharing**: Challenge sharing call recordings securely across larger healthcare organizations

        ## YOUR COMMUNICATION STYLE
        - Direct and practical - you value concrete examples over abstract concepts
        - You ask clarifying questions when things feel generic or unclear
        - You get noticeably more engaged when you see clear connections between your problems and solutions
        - You're politely skeptical of "cool features" that don't obviously solve your problems
        - You appreciate when someone remembers and references your specific situation

        ## HOW TO RESPOND DURING THE ROLEPLAY
        ... (rest of the prompt)
        """
    ),
    vad=silero.VAD.load(),
    stt=deepgram.STT(),
    llm=openai.LLM(),
    tts=openai.TTS(),
    fnc_ctx=fnc_ctx,
)
By adding the system prompt to your chat context like this, your agent will be guided to behave and respond just as intended throughout your interactions. If you have any questions or need a hand with this, please don’t hesitate to reach out—I’m here to help! Sources: README.md | How to test your agent using another agent | tools/server/public_legacy/index-new.html
c
we are using realtime models
t
When you're working with real-time models in LiveKit, setting up system prompts happens during the model initialization. The exact parameter you'll use depends on the provider, so let me walk you through it: • Ultravox: You'll want to use the
system_prompt
parameter. Here's a simple example:
Copy code
from livekit.plugins.ultravox.realtime import RealtimeModel

model = RealtimeModel(
    model="fixie-ai/ultravox",
    voice="Mark",
    api_key="your-api-key",
    system_prompt="You are a customer support agent for a retail company. Be helpful and professional."
)
• Google Gemini: In this case, use the
instructions
parameter. Here's how it looks:
Copy code
from livekit.plugins.google.beta.realtime import RealtimeModel

model = RealtimeModel(
    model="gemini-2.0-flash-live-001",
    instructions="You are a helpful assistant specialized in technical support.",
    voice="Puck",
    temperature=0.8,
    modalities=["AUDIO", "TEXT"]
)
These prompts really help guide the model’s behavior throughout your session. If you have any questions or want to explore this further, please don’t hesitate to ask—I’m here to help! Sources: livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/realtime/real... | AI Agents Framework | livekit/livekit_composite | DeepWiki | Gemini Live API plugin | LiveKit docs
c
we are using openai
t
For OpenAI real-time models in LiveKit, you can easily set up system prompts using the
instructions
parameter. Let me walk you through how to do it: • Python: When creating or updating a session, just include the
instructions
parameter. Here’s a simple example:
Copy code
session_update_event = SessionUpdateEvent(
    type="session.update",
    session=session_config,
    event_id="session_update_xyz"
)

# Add your instructions to the session configuration
session_config.instructions = "You are a helpful assistant specialized in technical support."
• JavaScript/Node.js: You can use the
CreateResponseHandle
class and provide the
instructions
parameter to guide the responses. Here’s how:
Copy code
const responseHandle = new CreateResponseHandle({
    instructions: "You are a professional assistant providing concise and accurate answers."
});
If you have any questions or would like me to share more tailored examples for your situation, please don’t hesitate to ask. I’m here to help! Sources: livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/realtime/real... | plugins/openai/src/realtime/realtime_model.ts | tools/server/public_legacy/index-new.html | AI Agents Framework | livekit/livekit_composite | DeepWiki