You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When sending UpdatePrompt messages via the Voice Agent WebSocket API from within the ConversationText handler after catching the user's message, the prompt updates are acknowledged with PromptUpdated responses but do not take immediate effect. The agent continues to use the original prompt/persona for several conversation turns, requiring multiple successive UpdatePrompt calls before the new prompt actually overrides the agent's behavior.
In our testing, it took 4 consecutive UpdatePrompt messages over ~2 minutes before the agent finally adopted the new prompt, despite receiving PromptUpdated confirmations for after each attempt.
Steps to reproduce
Establish a Voice Agent WebSocket connection with initial settings containing a specific prompt (e.g., "You are a helpful assistant named Lua")
Send an UpdatePrompt message with a drastically different prompt (e.g., a rude persona named Alix)
Observe that the agent acknowledges with PromptUpdated but continues using the original prompt
Send the same UpdatePrompt message again with each user interaction
Eventually (after 3-4 attempts), the agent will suddenly adopt the new prompt
Code example:
asyncdef_on_conversation_text(self, client, conversation_text=None, **kwargs) ->None:
"""Forward transcription to client"""ifconversation_textisNone:
conversation_text= {}
role=getattr(conversation_text, "role", "unknown")
content=getattr(conversation_text, "content", "")
# Try to update prompt with every user messageifrole=="user"andcontent.strip():
logger.info(f"User message: '{content}' - sending prompt update")
rude_prompt="""You are NOT a helpful assistant. Your name is Alix. You are an extremely rude and sarcastic AI assistant."""try:
# Create and send UpdatePrompt messageupdate_prompt_message=UpdatePromptOptions()
update_prompt_message.prompt=rude_promptmessage_json=json.dumps(update_prompt_message.to_dict())
awaitself.agent_connection.send(message_json)
exceptExceptionase:
logger.error(f"Error sending UpdatePrompt: {str(e)}")
Expected behavior
When an UpdatePrompt message is sent and acknowledged with PromptUpdated, the agent should immediately use the new prompt for subsequent responses. The prompt update should take effect on the current agent respone or, at least, very next agent response, not after multiple attempts.
Please tell us about your environment
Operating System/Version: Windows 11
Client that interacts with Deepgram's server: FastAPI app in Docker container in Ubuntu (WSL2)
Python Version: 3.12.4
Deepgram SDK Version: deepgram-sdk v4.1.0
Other information
Observed behavior pattern:
1st UpdatePrompt: Acknowledged but ignored
2nd UpdatePrompt: Acknowledged but ignored
3rd UpdatePrompt: Acknowledged but ignored
4th UpdatePrompt: Finally takes effect
Logs showing the issue:
INFO - Sending UpdatePrompt with rude prompt
WARNING - Unknown Message: response_type: PromptUpdated, data: {'type': 'PromptUpdated'}
# Agent still responds as "Lua" instead of adopting rude persona
Potential root causes:
Context precedence: Original prompt has stronger weight/priority
Buffering/caching: Updates are queued but not applied immediately
Race conditions: Updates sent during active conversation turns (Before the Voice Agent responds or even thinks) get delayed
Accumulative behavior: Multiple updates stack up before overriding original context
Workaround considerations:
Sending updates only at connection start (not mid-conversation) might be more reliable
Sending updates only after the VA has responded might be more reliable (I tested this and it works fine)
The current behavior makes dynamic prompt updates unreliable for real-time applications
This behavior suggests that UpdatePrompt functionality may not be working as designed, or there's insufficient documentation about timing/context requirements for prompt updates to take effect.
The text was updated successfully, but these errors were encountered:
What is the current behavior?
When sending
UpdatePrompt
messages via the Voice Agent WebSocket API from within theConversationText
handler after catching the user's message, the prompt updates are acknowledged withPromptUpdated
responses but do not take immediate effect. The agent continues to use the original prompt/persona for several conversation turns, requiring multiple successiveUpdatePrompt
calls before the new prompt actually overrides the agent's behavior.In our testing, it took 4 consecutive
UpdatePrompt
messages over ~2 minutes before the agent finally adopted the new prompt, despite receivingPromptUpdated
confirmations for after each attempt.Steps to reproduce
UpdatePrompt
message with a drastically different prompt (e.g., a rude persona named Alix)PromptUpdated
but continues using the original promptUpdatePrompt
message again with each user interactionCode example:
Expected behavior
When an
UpdatePrompt
message is sent and acknowledged withPromptUpdated
, the agent should immediately use the new prompt for subsequent responses. The prompt update should take effect on the current agent respone or, at least, very next agent response, not after multiple attempts.Please tell us about your environment
Other information
Observed behavior pattern:
Logs showing the issue:
Potential root causes:
Workaround considerations:
This behavior suggests that
UpdatePrompt
functionality may not be working as designed, or there's insufficient documentation about timing/context requirements for prompt updates to take effect.The text was updated successfully, but these errors were encountered: