- Newest
- Most votes
- Most comments
When encountering the "System instability detected" error with Amazon Nova Sonic, this is likely a validation exception that occurs during the streaming process.
To handle this error properly, you should follow these recommended steps:
- Send the
promptEndevent - Send the
sessionEndevent - If audio streaming has already started, also send the
contentEndevent
These steps will help free up GPU resources and memory that might be causing the instability.
The error could be related to several factors:
- Input validation issues where unsupported parameter values are being used
- Resource constraints on the GPU or memory
- Potential issues with the bidirectional streaming API
For more reliable operation, you might want to review your inference parameters. Setting the temperature to 0 (enabling greedy decoding) and ensuring your maximum token count is appropriate for your use case can help improve stability.
If the issue persists, you may need to implement a conversation resumption approach to recover from these errors and maintain the user experience.
Sources
Handling errors with Amazon Nova Sonic - Amazon Nova
Error handling - Amazon Nova
Tool usage - Amazon Nova
answered 10 months ago
I'm encurring in a similar situation. I'm using Strands Agents SDK with BidiAgent, with a very simple situation on AgentCore.
# Configure Nova Sonic model
sonic_model = BidiNovaSonicModel(
model_id=MODEL_ID,
provider_config={
"audio": {
"voice": "tiffany",
"input_rate": INPUT_SAMPLE_RATE,
"output_rate": OUTPUT_SAMPLE_RATE,
"channels": CHANNELS,
"format": FORMAT
},
"inference": {
"temperature":0
},
"turn_detection": { # solo v2, opzionale
"endpointingSensitivity": "MEDIUM", # "HIGH" | "MEDIUM" | "LOW"
},
},
client_config={
"region": BEDROCK_REGION
},
)
# Health check endpoint (required by AgentCore)
@app.get("/ping")
async def ping():
"""Health check endpoint for AgentCore Runtime"""
return {"status": "Healthy", "time_of_last_update": int(datetime.now().timestamp())}
# WebSocket endpoint for bidirectional voice chat
@app.websocket("/ws")
async def voice_chat(websocket: WebSocket) -> None:
"""
WebSocket endpoint for bidirectional voice streaming.
Connects to the MCP endpoint to load tools (add, greet, echo) then runs
the BidiAgent for the duration of the WebSocket connection.
"""
mcp_tools = mcp_client.list_tools_sync()
voice_agent = BidiAgent(
model=sonic_model,
tools=[*mcp_tools],
hooks=[ToolCallLogger()],
system_prompt=SYSTEM_PROMPT
)
try:
await websocket.accept()
print("WebSocket connection accepted")
_greeting_sent = False
async def receive_input():
nonlocal _greeting_sent
if not _greeting_sent:
_greeting_sent = True
# asyncio.sleep(0) yields to the event loop so _run_model registers
# on the output stream before the greeting arrives.
await asyncio.sleep(0)
await voice_agent.send({"type": "bidi_text_input", "text": "Start conversation greeting the user.", "role": "user"})
return await websocket.receive_json()
await voice_agent.run(
inputs=[receive_input],
outputs=[websocket.send_json]
)
except WebSocketDisconnect:
print("Client disconnected")
except Exception as e:
print(f"Error in voice chat: {e}")
import traceback
traceback.print_exc()
finally:
try:
await voice_agent.stop()
except Exception:
pass
try:
await websocket.close()
except Exception as cleanup_error:
print(f"Error during WebSocket close: {cleanup_error}")
I have the temperature set to 0. I've changed max tokens parameter (128,512,1024). I've experienced this both in eu-north-1 than in us-east-1.
Both local and AgentCore environments got:
aws_sdk_bedrock_runtime.models.ValidationException: System instability detected
Full logs are:
[BACKEND] INFO: connection open
[BACKEND] Traceback (most recent call last):
[BACKEND] File "/Users/davidedesio/Desktop/github/air-s2s-sonic-agent/agent/strands_agent.py", line 196, in voice_chat
[BACKEND] await voice_agent.run(
[BACKEND] ...<2 lines>...
[BACKEND] )
[BACKEND] File "/Users/davidedesio/Desktop/github/air-s2s-sonic-agent/agent/venv/lib/python3.13/site-packages/strands/experimental/bidi/agent/agent.py", line 392, in run
[BACKEND] async with _TaskGroup() as task_group:
[BACKEND] ~~~~~~~~~~^^
[BACKEND] File "/Users/davidedesio/Desktop/github/air-s2s-sonic-agent/agent/venv/lib/python3.13/site-packages/strands/experimental/bidi/_async/_task_group.py", line 59, in __aexit__
[BACKEND] raise cast(BaseException, exception)
[BACKEND] File "/Users/davidedesio/Desktop/github/air-s2s-sonic-agent/agent/venv/lib/python3.13/site-packages/strands/experimental/bidi/agent/agent.py", line 379, in run_outputs
[BACKEND] async for event in self.receive():
[BACKEND] await asyncio.gather(*[output(event) for output in outputs])
[BACKEND] File "/Users/davidedesio/Desktop/github/air-s2s-sonic-agent/agent/venv/lib/python3.13/site-packages/strands/experimental/bidi/agent/agent.py", line 294, in receive
[BACKEND] async for event in self._loop.receive():
[BACKEND] yield event
[BACKEND] File "/Users/davidedesio/Desktop/github/air-s2s-sonic-agent/agent/venv/lib/python3.13/site-packages/strands/experimental/bidi/agent/loop.py", line 170, in receive
[BACKEND] raise event
[BACKEND] File "/Users/davidedesio/Desktop/github/air-s2s-sonic-agent/agent/venv/lib/python3.13/site-packages/strands/experimental/bidi/agent/loop.py", line 218, in _run_model
[BACKEND] async for event in self._agent.model.receive():
[BACKEND] ...<18 lines>...
[BACKEND] )
[BACKEND] File "/Users/davidedesio/Desktop/github/air-s2s-sonic-agent/agent/venv/lib/python3.13/site-packages/strands/experimental/bidi/models/nova_sonic.py", line 369, in receive
[BACKEND] event_data = await output.receive()
[BACKEND] ^^^^^^^^^^^^^^^^^^^^^^
[BACKEND] File "/Users/davidedesio/Desktop/github/air-s2s-sonic-agent/agent/venv/lib/python3.13/site-packages/smithy_aws_event_stream/aio/__init__.py", line 154, in receive
[BACKEND] raise value
[BACKEND] aws_sdk_bedrock_runtime.models.ValidationException: System instability detected
[BACKEND] INFO: connection closed
Is there any official solution to this?
answered 4 months ago
Relevant content
asked 9 months ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 13 days ago
