-
Notifications
You must be signed in to change notification settings - Fork 557
Description
Problem Statement
I am trying out the new BidiAgent feature which is great, but I discovered it requires PyAudion and audio libraries to be installed on the system where the agent runs. The agent should not directly interface with the audio subsystem and only process audio as a byte array. Capture and rendering of the audio is normally done by the client interacting with the Agent, which is a browser or a native application. The python agent code would not run in either of these environments.
For demo purposes, it could be practical to have an agent that can interact directly with the audio subsystem but this should be provided as separate tool from the main SDK.
Proposed Solution
Make the io module and optional module. To use it run pip install strands-agents[bidi, bidi-io].
Use Case
I want to use strands-agent on the server side without need to install client side dependencies like PyAudio
Alternatives Solutions
__1. Client/Server Split __
Completely separate client and server into different packages/processes:
strands-agents-server/ # Server-side logic (no pyaudio)
- BidiAgent
- BidiModel
- Tool execution
strands-agents-client/ # Client-side IO (has pyaudio)
- BidiAudioIO
- BidiTextIO
- WebSocket/HTTP client to connect to serverCommunication:
# Client side
audio_io = BidiAudioIO()
client = BidiClient(server_url="https://myserver.com")
async for event in audio_io.input():
response = await client.send(event)
await audio_io.output(response)
# Server side (no pyaudio dependency)
@app.post("/agent")
async def handle_agent_request(event: BidiInputEvent):
result = await agent.process(event)
return resultPros:
- Complete dependency isolation - server has zero client dependencies
- Can deploy server without any audio/UI libraries
- Clients can be in different languages (Python, TypeScript, mobile)
- Scale server independently of clients
Cons:
- Separate packages
Additional Context
No response