#Error sending audio chunk: received 1008 (policy violation) Missing required dynamic variables in t
1 messages · Page 1 of 1 (latest)
AI-generated Answer for alaqsasberserker
Short answer: your agent tried to call a tool whose parameters are templated with dynamic variables that are marked Required, but you didn’t provide values for them at runtime. When required dynamic variables are missing, the platform rejects the tool call and closes the WebSocket (you’re seeing “1008 policy violation” in the close reason). Fix by supplying those variables before the first tool call, or by marking the affected tool parameters as not required.
How to fix (pick one or more):
- Send the variables at conversation start over the Agent WebSocket using conversation_initiation_client_data. Include a dynamic_variables object with all required keys (street, city, governorate, branchId, orderId) before streaming any audio chunks. See the Agent WebSockets schema and example that shows dynamic_variables in the initiation message. (elevenlabs.io)
- If you’re using the public Talk‑to page, pass dynamic variables in the URL: either base64 JSON via ?vars=… or individual var_ parameters, e.g., ?var_street=…&var_city=…. Variable names are case‑sensitive and must use {{ variable_name }} in your tool config. (elevenlabs.io)
- If this is a telephony flow (e.g., Twilio), return the variables from your conversation‑init webhook so they’re injected before the agent speaks. (elevenlabs.io)
- Review your tool configuration:
- Ensure parameters that reference {{ street }}, {{ city }}, {{ governorate }}, {{ branchId }}, {{ orderId }} are either provided via dynamic_variables or not marked Required. Client and server tool docs show how to define required parameters and describe them so the LLM collects them before calling the tool. (elevenlabs.io)
- If you’re templating headers/params with dynamic variables, verify names match exactly and types are strings/numbers/booleans as supported. (elevenlabs.io)
Minimal example (WebSocket initiation payload fragment):
- type: "conversation_initiation_client_data"
- dynamic_variables: { "street": "...", "city": "...", "governorate": "...", "branchId": "...", "orderId": "..." }
Send this before user_audio_chunk frames so the first tool call has the values. (elevenlabs.io)
If you still hit the error:
- Double‑check that the variable placeholders in the tool (path/query/body/headers) use {{ variable_name }} and match the keys you send. (elevenlabs.io)
- Temporarily set those tool parameters to not required, verify the flow, then re‑enable Required once you’re correctly passing the variables. (elevenlabs.io)
References:
- Agent WebSockets (conversation initiation with dynamic_variables). (elevenlabs.io)
- Dynamic variables (usage in tools, URL passing, syntax, troubleshooting). (elevenlabs.io)
- Twilio personalization (inject variables via webhook at call start). (elevenlabs.io)
- Client tools / Server tools (defining required parameters and guiding the
those aren't required to me before the conversation starts, they are only needed when calling the tool