victorious-ability-40525
02/28/2025, 5:03 PMgray-monkey-83525
02/28/2025, 5:03 PMvictorious-ability-40525
02/28/2025, 5:06 PMgray-monkey-83525
02/28/2025, 5:06 PMVoiceAssistant
class to manage the conversation state. This class provides a way to track the agent's state, such as listening
, thinking
, and speaking
. You can manipulate the chat context using voice_assistant.chat_ctx
to dynamically modify the conversation flow. This allows you to maintain control over state transitions and objectives, such as user identity verification.
2. Dynamic Tool Availability: You can update the set of tools or functions available to the language model by modifying the FunctionContext
. This is done by setting voice_assistant.fnc_ctx = newfuncctx
, allowing you to adapt the agent's capabilities as the conversation progresses through different states.
3. Multi-Agent Scenarios: To implement scenarios where the agent's capabilities or identity might change, you can spawn different agents within the same session. This requires identifying the right participant for the VoiceAssistant
to interact with, ensuring that the agent communicates with the user rather than another agent.
4. Data Persistence: Ensure that data extracted in earlier steps remains available for use in subsequent steps by injecting it into the chat_ctx
. This allows the LLM to access the necessary context throughout the conversation.
5. Agent Lifecycle: According to the Anatomy of an Agent, the agent lifecycle involves worker registration, agent dispatch, and room closure. Workers register with the LiveKit server and wait for rooms to be created. When a user connects, the server dispatches an agent to the room. The agent can then manage multiple instances simultaneously, each in its own process.
6. Handling Transitions: Use the before_llm_cb
hook to gain control before anything is sent to the LLM, allowing you to manage transitions effectively. This hook can be used to adjust the chat context or function context based on the current state of the conversation.
By following these steps, you can orchestrate different voice agents in a conversation, ensuring smooth transitions and maintaining transparency for the end user.
Sources:
- VoicePipelineAgent
- LiveKit Slack
- Anatomy of an Agent 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.tall-airline-16756
03/04/2025, 11:58 PMtall-airline-16756
03/04/2025, 11:58 PM