Skip to content

Nova sonic Tool use problem. I tried to create new customer and existing customer using the voice based on System Microphone.

0

I have shared the code novasonic-system-microphone.py on the GitHub link

file structure:
 └──>audio_files
        └──>greeting.mp3
        └──>greeting.wav
  └──>utils
        └──>audio_creation.py
   	└──>database.py
	└──>email.py
  └──>s2s_events.py
  └──>novasonic-system-microphone.py
  └──>requirements.txt
  └──>env

How to the tool use implementation, the flow extends to: Tool use implementation of workflows

I getting the error or stuck-up or issue in the last message from nova sonic to customer/user.

Assistant: "You have successfully registered as a new customer. Thank you for using our customer service assistant"

Note 1: Initially, i'm triggered the Nova sonic using the 'hello_audio' function, it send message as 'hi'.

Note 2: phone and email id are not allowed to post here. therefore I'm given as "email:adsdawdw and phone:a4dswrqbut" but functionally are same.

Conversation summary:

User: hi
Assistant: Hello! May I ask if you consent to us saving your information for this interaction?
User: yes
Assistant: Great, thank you for your consent. Are you a new customer or an existing customer?
User: i am a new customer
Assistant: Thank you for letting me know. Could you please provide your full name, a valid email address, and a valid phone number so we can register you as a new customer?
User: my name is andrea my phone number is a4dswrqbut my email id is adsdawdw
Assistant : You have successfully registered as a new customer. Thank you for using our customer service assistant.

logs:

2025-06-21 10:27:49.130 | INFO     | utils.database:insert:38 - create new data with id:c333c63f-d233-4f1e-9466-47c918a5278f
2025-06-21 10:27:49.360 | INFO     | __main__:_send_hello_audio:337 - Sent initial hello audio to Nova Sonic
2025-06-21 10:27:55.955 | INFO     | __main__:_process_responses:554 - Completion Start
2025-06-21 10:27:55.956 | INFO     | __main__:_process_responses:589 - User: hi
2025-06-21 10:27:55.957 | INFO     | __main__:_process_responses:587 - Assistant: Hello! May I ask if you consent to us saving your information for this interaction?
2025-06-21 10:28:07.114 | INFO     | __main__:_process_responses:589 - User: yes
2025-06-21 10:28:07.126 | DEBUG    | utils.database:update:85 - Updated row: ('c333c63f-d233-4f1e-9466-47c918a5278f', 'Good morning! May I ask if you would like us to save your information for future reference?', 'yes', None, None, None)
2025-06-21 10:28:07.127 | DEBUG    | utils.database:fetch_by_id:59 - Fetched from DB by ID c333c63f-d233-4f1e-9466-47c918a5278f: ('c333c63f-d233-4f1e-9466-47c918a5278f', 'Good morning! May I ask if you would like us to save your information for future reference?', 'yes', None, None, None)
2025-06-21 10:28:07.127 | INFO     | __main__:_process_responses:596 - Fallback consent saved: ('c333c63f-d233-4f1e-9466-47c918a5278f', 'Good morning! May I ask if you would like us to save your information for future reference?', 'yes', None, None, None)
2025-06-21 10:28:07.128 | INFO     | __main__:_process_responses:587 - Assistant: Great, thank you for your consent. Are you a new customer or an existing customer?
2025-06-21 10:28:17.813 | INFO     | __main__:_process_responses:589 - User: i am a new customer
2025-06-21 10:28:17.814 | INFO     | __main__:_process_responses:587 - Assistant: Thank you for letting me know. Could you please provide your full name, a valid email address, and a valid phone number so we can register you as a new customer?
2025-06-21 10:28:38.084 | INFO     | __main__:_process_responses:589 - User: my name is
2025-06-21 10:28:42.174 | INFO     | __main__:_process_responses:589 - User: andrea
2025-06-21 10:29:09.057 | INFO     | __main__:_process_responses:589 - User: my email id is adsdawdw my phone number is
2025-06-21 10:29:11.107 | INFO     | __main__:_process_responses:589 - User: a4dswrq
2025-06-21 10:29:11.108 | INFO     | __main__:_process_responses:627 - Tool use : {'completionId': '086b8405-a02f-49a3-901a-3ebce752e49f', 'content': '{"phone":"a4dswrq","name":"Andrea","email":"adsdawdw"}', 'contentId': '0875cb42-4357-4dd0-a5d7-3b2145533d34', 'promptName': 'b5e8073a-df7c-439d-aa85-23801e52ba78', 'role': 'TOOL', 'sessionId': '7d88c9e7-e17f-4b61-897b-009ff64c1d0a', 'toolName': 'registerCustomerTool', 'toolUseId': 'c03f084f-f658-435b-b934-42be95a4597a'}
2025-06-21 10:29:11.108 | INFO     | __main__:_process_responses:628 - Tool use captured: registerCustomerTool
2025-06-21 10:29:11.109 | INFO     | __main__:_process_responses:631 - Processing tool use and sending result
2025-06-21 10:29:11.109 | INFO     | __main__:processToolUse:415 - Tool Use Content: {'completionId': '086b8405-a02f-49a3-901a-3ebce752e49f', 'content': '{"phone":"a4dswrq","name":"Andrea","email":"adsdawdw"}', 'contentId': '0875cb42-4357-4dd0-a5d7-3b2145533d34', 'promptName': 'b5e8073a-df7c-439d-aa85-23801e52ba78', 'role': 'TOOL', 'sessionId': '7d88c9e7-e17f-4b61-897b-009ff64c1d0a', 'toolName': 'registerCustomerTool', 'toolUseId': 'c03f084f-f658-435b-b934-42be95a4597a'}
2025-06-21 10:29:11.109 | INFO     | __main__:processToolUse:416 - Tool Name: registerCustomerTool
2025-06-21 10:29:11.110 | INFO     | __main__:processToolUse:432 - customer_data::{'phone': 'a4dswrq', 'name': 'Andrea', 'email': adsdawdw'}
2025-06-21 10:29:11.110 | INFO     | __main__:processToolUse:434 - name:Andrea
2025-06-21 10:29:11.110 | INFO     | __main__:processToolUse:436 - email:adsdawdw
2025-06-21 10:29:11.110 | INFO     | __main__:processToolUse:438 - phone:a4dswrq
2025-06-21 10:29:11.111 | DEBUG    | utils.database:fetch_by_id:59 - Fetched from DB by ID c333c63f-d233-4f1e-9466-47c918a5278f: ('c333c63f-d233-4f1e-9466-47c918a5278f', 'Good morning! May I ask if you would like us to save your information for future reference?', 'yes', None, None, None)
2025-06-21 10:29:11.111 | INFO     | __main__:processToolUse:440 - db_result:('c333c63f-d233-4f1e-9466-47c918a5278f', 'Good morning! May I ask if you would like us to save your information for future reference?', 'yes', None, None, None)
2025-06-21 10:29:13.157 | DEBUG    | __main__:_process_responses:635 - toolResult: {'text': 'You have successfully registered as a new customer. Thank you for using our customer service assistant.'}
2025-06-21 10:29:13.157 | DEBUG    | __main__:_process_responses:644 - tool_start_event: {'event': {'contentStart': {'promptName': 'b5e8073a-df7c-439d-aa85-23801e52ba78', 'contentName': 'b55a1c00-9ca2-497c-a4e7-98d66a65d156', 'interactive': False, 'type': 'TOOL', 'role': 'TOOL', 'toolResultInputConfiguration': {'toolUseId': 'c03f084f-f658-435b-b934-42be95a4597a', 'type': 'TEXT', 'textInputConfiguration': {'mediaType': 'text/plain'}}}}}
2025-06-21 10:29:13.157 | INFO     | __main__:_process_responses:667 - tool_result_event: {'event': {'toolResult': {'promptName': 'b5e8073a-df7c-439d-aa85-23801e52ba78', 'contentName': 'b55a1c00-9ca2-497c-a4e7-98d66a65d156', 'content': {'text': 'You have successfully registered as a new customer. Thank you for using our customer service assistant.'}, 'role': 'TOOL'}}}
2025-06-21 10:29:13.158 | INFO     | __main__:_process_responses:671 - tool_content_end_event: {'event': {'contentEnd': {'promptName': 'b5e8073a-df7c-439d-aa85-23801e52ba78', 'contentName': 'b55a1c00-9ca2-497c-a4e7-98d66a65d156'}}}
2025-06-21 10:29:15.148 | INFO     | utils.email:send_email:67 - receiver_email:hj343rfd
2025-06-21 10:29:19.297 | ERROR    | __main__:_process_responses:677 - Timeout sending tool_start_event
2025-06-21 10:29:25.447 | ERROR    | __main__:_process_responses:683 - Timeout sending tool_result_event
2025-06-21 10:29:31.587 | ERROR    | __main__:_process_responses:689 - Timeout sending tool_content_end_event
2025-06-21 10:29:31.587 | ERROR    | __main__:_process_responses:775 - Nova Sonic Error: Invalid input request, please fix your input and try again.
2025-06-21 10:29:59.557 | CRITICAL | __main__:mic_stream:847 - <======= Call ID: c333c63f-d233-4f1e-9466-47c918a5278f ===========>
2025-06-21 10:29:59.558 | CRITICAL | __main__:mic_stream:848 - <======= Total Time: 130.42s ===========>
2025-06-21 10:29:59.558 | CRITICAL | __main__:mic_stream:849 - <== Memory Usage: 59.57 MB ===>
1 Answer
0

Hey,

Hope you're keeping well.

It sounds like your Nova Sonic flow is completing the conversation but not continuing past the final “registered” message. In a Bedrock-powered voice application, this usually happens if your conversation loop isn’t set up to re-listen after sending the final assistant output. Check that after sending the last message from novasonic-system-microphone.py, you’re calling the microphone capture again and streaming audio back into the model session rather than exiting the process.

If you’re using Amazon Bedrock’s streaming API with an Amazon Nova model, make sure the WebSocket or event stream remains open until you explicitly close it, and that your `s2s_events.

Thanks and regards,
Taz

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.