Problem
The current contextual_update WebSocket event appends context to the conversation state.
There is no way to replace the system prompt mid-conversation via WebSocket.
Use case
In voice agent applications with multi-step flows (e.g., debt negotiation), the agent transitions
through distinct phases — each requiring a completely different system prompt with different
instructions, constraints, and persona behavior. The previous prompt must be fully replaced,
not augmented, because:
- Conflicting instructions — the old prompt's rules may contradict the new phase's behavior
- Token waste — accumulated
contextual_update injections bloat the context window with
outdated instructions
- Non-deterministic behavior — when old and new prompts coexist, the LLM must resolve
conflicts on its own, leading to inconsistent responses
Current workaround
We route the agent through a custom LLM proxy (customLlm) and intercept /v1/chat/completions
to swap the system message before it reaches the LLM. This works but:
- Adds latency (extra network hop)
- Requires maintaining proxy infrastructure
- Doesn't work with native ElevenLabs LLMs (only
custom-llm mode)
contextual_update is still sent as a fallback but doesn't truly replace the prompt
Proposed solution
A new client-to-server WebSocket message type (e.g., prompt_override) that replaces the
active system prompt:
{
"type": "prompt_override",
"text": "You are now in phase 2. Your new instructions are..."
}
Expected behavior
- The previous system prompt is discarded
- The new text becomes the sole system prompt for all subsequent LLM calls
- Works with both native ElevenLabs LLMs and custom-llm mode
- Does not interrupt the ongoing conversation or TTS output
Alternative: replace mode on contextual_update
If adding a new message type is not desirable, a mode flag on the existing contextual_update
would also solve this:
{
"type": "contextual_update",
"text": "New full system prompt...",
"mode": "replace"
}
Where mode defaults to "append" (current behavior) for backwards compatibility.
Problem
The current
contextual_updateWebSocket event appends context to the conversation state.There is no way to replace the system prompt mid-conversation via WebSocket.
Use case
In voice agent applications with multi-step flows (e.g., debt negotiation), the agent transitions
through distinct phases — each requiring a completely different system prompt with different
instructions, constraints, and persona behavior. The previous prompt must be fully replaced,
not augmented, because:
contextual_updateinjections bloat the context window withoutdated instructions
conflicts on its own, leading to inconsistent responses
Current workaround
We route the agent through a custom LLM proxy (
customLlm) and intercept/v1/chat/completionsto swap the system message before it reaches the LLM. This works but:
custom-llmmode)contextual_updateis still sent as a fallback but doesn't truly replace the promptProposed solution
A new client-to-server WebSocket message type (e.g.,
prompt_override) that replaces theactive system prompt:
{ "type": "prompt_override", "text": "You are now in phase 2. Your new instructions are..." } Expected behavior - The previous system prompt is discarded - The new text becomes the sole system prompt for all subsequent LLM calls - Works with both native ElevenLabs LLMs and custom-llm mode - Does not interrupt the ongoing conversation or TTS output Alternative: replace mode on contextual_update If adding a new message type is not desirable, a mode flag on the existing contextual_update would also solve this: { "type": "contextual_update", "text": "New full system prompt...", "mode": "replace" } Where mode defaults to "append" (current behavior) for backwards compatibility.