early-restaurant-74591
10/07/2025, 8:56 PMtall-airline-16756
10/07/2025, 8:56 PMtall-airline-16756
10/07/2025, 8:56 PMearly-restaurant-74591
10/07/2025, 9:13 PMearly-restaurant-74591
10/07/2025, 9:13 PMtall-airline-16756
10/07/2025, 9:13 PMinstructions parameter in LiveKit agents is like a helpful guide that shapes how the agent behaves, its tone, and its overall purpose. Think of it as the system-level direction for the language model (LLM) that influences how the agent interacts with you.
Here’s a friendly overview of how it works:
• Initialization: When the agent is first created, the instructions parameter is set and stored internally. This helps shape the agent’s responses and behavior right from the beginning.
• Dynamic Updates: If you want the agent to adjust its behavior as things progress, you can update the instructions anytime using the update_instructions() method. This way, the agent can better respond to the context or your interactions.
• Temporary Adjustments: For specific replies, you can pass temporary instructions through the generate_reply() method. These work alongside the main instructions for that moment but aren’t saved permanently.
• Multi-Agent Workflows: In setups with multiple agents, each one can have its own special instructions tailored to its role. This makes sure interactions flow smoothly and stay relevant to the context.
• Text-to-Speech (TTS): If you’re using TTS plugins, the instructions parameter helps guide the tone, pace, and style of the speech output, making the experience more natural and engaging.
If you’d like, I’m here to help with more details or examples on how to make the most of the instructions parameter. Just let me know!
Sources: examples/voice_agents/multi_agent.py | examples/src/comprehensive_test.ts | multi-agent/long_or_short_agent.py | Gemini TTS plugin guide | LiveKit Docs | OpenAI TTS plugin guide | LiveKit Docstall-airline-16756
10/07/2025, 9:13 PMinstructions parameter in your custom InterviewAgent class is a wonderful tool to shape how your agent behaves, its tone, and its overall purpose. Think of it as the guiding voice for the language model (LLM) behind the scenes. Here's a friendly breakdown of how it works:
• Initialization: When you set instructions=dynamic_instructions during initialization, these instructions become the foundation that guides your agent’s responses.
• Dynamic Updates: You’re also able to tweak these instructions on the fly with methods like update_instructions(), so your agent can smoothly adjust based on the situation or what the user needs.
• Per-Reply Customization: And if you want to tailor a single response differently, you can pass temporary instructions to the generate_reply() method. These blend with the main instructions just for that reply and don’t change the overall setup.
If you have any particular scenarios in mind or more questions about making the most out of the instructions parameter in your custom agent, please don’t hesitate to reach out—I’m here to help!early-restaurant-74591
10/07/2025, 11:03 PMtall-airline-16756
10/07/2025, 11:04 PMinstructions parameter in LiveKit agents work! This feature lets you modify the agent's behavior during runtime using the update_instructions() method, which is super handy for tailoring the agent's tone or purpose based on the context, user attributes, or session state.
Here are some examples to guide you through:
• Adjusting Instructions Based on Participant Type: For example, if a user joins via phone (SIP), you can update the instructions so the agent speaks in a telephony-appropriate tone:
class ChangeInstructionsAgent(Agent):
def __init__(self):
super().__init__(instructions="You are a helpful agent. When the user speaks, you listen and respond.")
async def on_enter(self):
if self.session.participant.name.startswith("sip"):
await self.update_instructions("You are a helpful agent speaking on the phone.")
self.session.generate_reply()
• Using Participant Attributes: In an IVR system, you might want to update instructions based on a specific task assigned to the user:
async def on_enter(self):
task = self.session.participant.attributes.get("task")
if task:
await self.update_instructions(f"Guide the user through completing task: {task}")
• Context Injection in Retrieval-Augmented Generation (RAG): You can also dynamically add context retrieved from a knowledge base into the instructions to make responses even more relevant:
async def llm_node(self, chat_ctx: llm.ChatContext, ...):
user_query = chat_ctx.items[-1].text_content
retriever = self.index.as_retriever()
nodes = await retriever.aretrieve(user_query)
instructions = "Context that might help answer the user's question:"
for node in nodes:
instructions += f"\n\n{node.get_content(metadata_mode=MetadataMode.LLM)}"
await self.update_instructions(instructions)
When you call update_instructions(), it updates the agent's internal state and, if the agent is in a realtime session, it also refreshes the active session's instructions. This way, the agent can adapt smoothly to any new context.
If you have any questions or would like more examples, please don't hesitate to ask. I'm here to help!
Sources: examples/warm-transfer/warm_transfer.py | multi-agent/long_or_short_agent.py | Gemini Live API plugin | LiveKit Docs | Gemini TTS plugin guide | LiveKit Docs