feat: Implement audio playback from URL #822
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
The
_process_audio_blockmethod in theAgentBaseclass included a TODO comment to implement playback of audio from a URL. This functionality was missing, limiting the agent's ability to handle audio content provided as a web link.Purpose
This pull request implements that missing feature, enabling agents to process and play audio directly from a URL.
Changes Made
This PR enhances the
_process_audio_blockmethod to support audio sources from URLs. The changes include:urllib.requestmodule to download the audio file from the given URL.wavemodule to read the audio data from the temporary file.sounddevicelibrary to play the audio.How to Test
"url"..wavfile.Example message content:
{ "type": "audio", "source": { "type": "url", "url": "https://example.com/path/to/audio.wav" } }Checklist
Please verify the following before marking the PR ready for review:
pre-commit run --all-files