high-continent-1096
11/13/2025, 11:51 AMlivekit-agents worker with the livekit-plugins-aws[realtime] package to power a speech-to-speech agent using Amazon Nova Sonic (amazon.nova-sonic-v1:0).
The agent works perfectly for the first few conversation turns (typically 3-4). After a few successful interactions (including tool use), the agent session will suddenly crash. The error is not in my Python tool logic but originates from the underlying AWS SDK, smithy_aws_event_stream.
The errors are consistently one of the following:
1. smithy_aws_event_stream.exceptions.ChecksumMismatch
2. smithy_aws_event_stream.exceptions.InvalidEventBytes (often a struct.error: unpack requires a buffer of 4 bytes)
ERROR 1:
ERROR livekit.plugins.aws - Response processing error: Checksum mismatch: expected 0x646f4f55, calculated 0xeda01444 (type: class 'smithy_aws_event_stream.exceptions.ChecksumMismatch')
ERROR livekit.agents - AgentSession is closing due to unrecoverable error
livekit.agents._exceptions.APIStatusError: Checksum mismatch: expected 0x646f4f55, calculated 0xeda01444 (status_code=500, request_id=None, body=Checksum mismatch: expected 0x646f4f55, calculated 0xeda01444, retryable=False)
ERROR livekit.plugins.aws - Error in _process_responses
Traceback (most recent call last):
File "C:\...\livekit\agents\utils\log.py", line 16, in async_fn_logs
return await fn(*args, **kwargs)
File "C:\...\livekit\plugins\aws\experimental\realtime\realtime_model.py", line 961, in _process_responses
result = await output_stream.receive()
File "C:\...\smithy_aws_event_stream\aio\__init__.py", line 107, in receive
event = await Event.decode_async(self._source)
File "C:\...\smithy_aws_event_stream\events.py", line 327, in decode_async
_validate_checksum(prelude_crc_bytes + message_bytes, crc, prelude_crc)
File "C:\...\smithy_aws_event_stream\events.py", line 789, in _validate_checksum
raise ChecksumMismatch(checksum, computed_checksum)
smithy_aws_event_stream.exceptions.ChecksumMismatch: Checksum mismatch: expected 0x646f4f55, calculated 0xeda01444
Error 2:
ERROR livekit.plugins.aws - Response processing error: Invalid event bytes. (type: class 'smithy_aws_event_stream.exceptions.InvalidEventBytes')
ERROR livekit.agents - AgentSession is closing due to unrecoverable error
livekit.agents._exceptions.APIStatusError: Invalid event bytes. (status_code=500, request_id=None, body=Invalid event bytes., retryable=False)
ERROR livekit.plugins.aws - Error in _process_responses
Traceback (most recent call last):
File "C:\...\smithy_aws_event_stream\events.py", line 323, in decode_async
crc: int = _DecodeUtils.unpack_uint32(await source.read(4))[0]
File "C:\...\smithy_aws_event_stream\events.py", line 597, in unpack_uint32
value = unpack(_DecodeUtils.UINT32_BYTE_FORMAT, data[:4])[0]
struct.error: unpack requires a buffer of 4 bytes
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\...\livekit\agents\utils\log.py", line 16, in async_fn_logs
return await fn(*args, **kwargs)
File "C:\...\livekit\plugins\aws\experimental\realtime\realtime_model.py", line 961, in _process_responses
result = await output_stream.receive()
File "C:\...\smithy_aws_event_stream\aio\__init__.py", line 107, in receive
event = await Event.decode_async(self._source)
File "C:\...\smithy_aws_event_stream\events.py", line 325, in decode_async
raise InvalidEventBytes() from e
smithy_aws_event_stream.exceptions.InvalidEventBytes: Invalid event bytes.
Can anyone please help me with this issue