Skip to content

Conversation

@jimini55
Copy link
Contributor

…lity

  • Add role: USER to audio content blocks (required by Nova Sonic)
  • Fix response processing timing to start after setup
  • Validate first content has SYSTEM role
  • Upgrade to aws-sdk-bedrock-runtime v0.1.0
  • Update imports to smithy_aws_core.identity module
  • Use auth_schemes with SigV4AuthScheme(service=bedrock)
  • Reduce logging verbosity (warn only on true silence)

Issue #, if available:

Description of changes:

This PR fixes two critical issues preventing the Python backend from working with Amazon Nova Sonic:

1. Nova Sonic Protocol Implementation Issues

  • Added required "role": "USER" field to audio content blocks - Nova Sonic requires explicit role specification
  • Fixed response processing timing by moving task creation to after session setup (prevents race condition)
  • Added validation ensuring first content block has "role": "SYSTEM" (Nova Sonic protocol requirement)
  • Enhanced audio validation to detect and log silent audio (helps diagnose frontend issues)
  • Reduced log verbosity to warn only on completely silent audio (amplitude = 0) instead of low audio

2. AWS SDK Breaking Changes (v0.1.0)

  • Upgraded from aws-sdk-bedrock-runtime==0.0.2 to 0.1.0 (released Sept 29, 2025)
  • Fixed imports: credential resolvers moved from smithy_aws_core.credentials_resolvers.* to smithy_aws_core.identity.*
  • Updated Config API: replaced http_auth_schemes with auth_schemes parameter
  • Updated SigV4AuthScheme to require service="bedrock" parameter
  • Maintained secure ContainerCredentialsResolver for ECS deployment

Testing:

  • ✅ Tested locally with test script
  • ✅ Deployed to ECS and verified working
  • ✅ Confirmed Nova Sonic responds to audio input and generates speech output

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

…lity - Add role: USER to audio content blocks (required by Nova Sonic) - Fix response processing timing to start after setup - Validate first content has SYSTEM role - Upgrade to aws-sdk-bedrock-runtime v0.1.0 - Update imports to smithy_aws_core.identity module - Use auth_schemes with SigV4AuthScheme(service=bedrock) - Reduce logging verbosity (warn only on true silence)
@krokoko krokoko merged commit 3ac0303 into main Oct 13, 2025
@krokoko krokoko deleted the fix/python-sdk-backend branch October 13, 2025 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants