can we make custom plugin for another TTS ?
# ask-ai
p
can we make custom plugin for another TTS ?
t
Thanks for reaching out, Adarsh. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Absolutely, you can create a custom plugin for a different Text-to-Speech (TTS) system in LiveKit! The framework is thoughtfully designed to be extensible, so you have the flexibility to implement a custom TTS engine by either overriding the
tts_node
in your agent or by building a reusable plugin. Here’s a friendly overview of how you might create a reusable plugin: • Inherit from
livekit.agents.tts.TTS
and implement the necessary methods like
synthesize()
. • Set up initialization parameters such as API keys, voice ID, and sample rate. • Make sure to handle authentication securely and validate credentials properly. • Declare the plugin’s capabilities, like streaming support, using
tts.TTSCapabilities
. • Optionally, register your plugin so it can be reused across different projects. LiveKit also offers examples of existing plugins (like Cartesia and ElevenLabs) that you can use as helpful templates. If you’d like, I’m here to guide you through the process or provide a starter template tailored to a specific TTS provider. Just let me know! Sources: Pipeline nodes and hooks | LiveKit docs | livekit-plugins/livekit-plugins-resemble/livekit/plugins/resemble/__init__.... | AI Agents Framework | livekit/livekit_composite | DeepWiki | Text-to-speech (TTS) models | LiveKit Docs
p
can we somehow update the instructions of an agent ?
t
Absolutely! You can easily update the instructions of an agent on the fly using the
update_instructions()
method. This is a great way to adjust the agent’s behavior during runtime by simply providing new instructions as a string. Here’s a quick example:
Copy code
await agent.update_instructions("You are now a helpful assistant speaking on the phone.")
This method works smoothly with both realtime and standard LLMs, making sure your instructions are refreshed in the current session or local chat context. If you’d like, I’m here to help with more details or examples—just let me know! Sources: examples/voice_agents/llamaindex-rag/retrieval.py | Agent Session Management & Turn Detection | livekit/livekit_composite | Dee... | complex-agents/ivr-agent/README.md
p
if a agent is calling and we want to change its instruction then only, can we do it while talking to user ? also explain how will the agent's context which was going to llm past chats will get affected. example through example flow
t
Absolutely! You can update an agent's instructions during a call by using the
update_instructions()
method. This is a great way to help the agent adjust its behavior on the fly while interacting with the user. For instance, if the agent is already on a call and you want to change its instructions, you can do this:
Copy code
await agent.update_instructions("You are now a helpful assistant speaking on the phone.")
How This Affects Context: • For Realtime Models: The new instructions are sent directly to the server and take effect immediately during the ongoing session, without changing any previous chat context. • For Standard LLMs: The instructions get updated in the local chat context. If there’s already an instruction message, it will be replaced; if not, a new instruction message is added right at the start of the context. Here’s an Example Flow: 1. The agent begins a call with the instructions: "You are a general assistant." 2. During the call, the user mentions they’re on the phone, so you update the instructions to: "You are a helpful assistant speaking on the phone." 3. The agent quickly adjusts its behavior based on these new instructions. 4. For standard LLMs, these updated instructions become part of the context used to generate responses. If you’d like me to walk you through this more or provide additional examples, just let me know—I’m here to help! Sources: Agent Session Management & Turn Detection | livekit/livekit_composite | Dee... | livekit-plugins/livekit-plugins-ultravox/livekit/plugins/ultravox/realtime/... | plugins/openai/src/realtime/realtime_model.ts | basics/change_agent_instructions.py