I have developed an app which uses Vertex AI Gemini Live API and the models unpredictably start complaining of policy violation.
File “/code/.venv/lib/python3.11/site-packages/websockets/asyncio/connection.py”, line 322, in recv
raise self.protocol.close_exc from self.recv_exc
websockets.exceptions.ConnectionClosedError: received 1008 (policy violation) Publisher Model `projects/langtrak-adk-dev/locations/global/publishers/google/models/gemini-live-2.5-flash-native-audio` wa; then sent 1008 (policy violation) Publisher Model `projects/langtrak-adk-dev/locations/global/publishers/google/models/gemini-live-2.5-flash-native-audio` wa
In this case I switched to the preview model gemini-live-2.5-flash-native-audio → gemini-live-2.5-flash-preview-native-audio and the error is gone. Sometimes I have to do it vice versa.
My guess is that there are some infrastructure issues and its nothing do with my prompt or content.
Thank you for flagging the issue. To help us look into this further, could you please share relevant code snippets or any specific instructions to reproduce the same? This will help us debug the issue.
Meanwhile, you can have some kind of fallback logic to switch between models as errors occur rarely on both models.
model=“gemini-2.5-flash-native-audio-preview-12-2025”, # Live API model for bidirectional streaming on Agent Engine
instruction=GERMAN_TEACHER_INSTRUCTION,
# The agent should rely ONLY on the currently displayed image (passed via artifacts or live input)
# and the student’s conversation. It does not need to inspect data directories or lesson files.
tools=,
)
–
I have switched from Vertex AI to Gemini API and the service is very stable. The real time feedback is slightly slow but its better than getting errors. Since I have switched to Gemini API, I’m also able to use gemini-2.5-flash-native-audio-preview-12-2025
I switched to Gemini API and hence gemini-live-2.5-flash-preview-native-audio-12-2025 and changed language to es-US and this particular error has not occurred. I’m aware that on Vertex this model is not available.
The service itself both on Gemini and Vertex is quite unpredictable and hence I’m losing users because they leave when the API errors.
I’m not sure how to implement model or API fallback with ADK starter kit.