strands.experimental.bidi.io
¶
IO channel implementations for bidirectional streaming.
strands.experimental.bidi.io.audio
¶
Send and receive audio data from devices.
Reads user audio from input device and sends agent audio to output device using PyAudio. If a user interrupts the agent, the output buffer is cleared to stop playback.
Audio configuration is provided by the model via agent.model.config["audio"].
BidiAudioIO
¶
Send and receive audio data from devices.
Source code in strands/experimental/bidi/io/audio.py
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
__init__(**config)
¶
Initialize audio devices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**config
|
Any
|
Optional device configuration:
|
{}
|
Source code in strands/experimental/bidi/io/audio.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 | |
input()
¶
Return audio processing BidiInput.
Source code in strands/experimental/bidi/io/audio.py
288 289 290 | |
output()
¶
Return audio processing BidiOutput.
Source code in strands/experimental/bidi/io/audio.py
292 293 294 | |
strands.experimental.bidi.io.text
¶
Handle text input and output to and from bidi agent.
BidiTextIO
¶
Handle text input and output to and from bidi agent.
Accepts input from stdin and outputs to stdout.
Source code in strands/experimental/bidi/io/text.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
__init__(**config)
¶
Initialize I/O.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**config
|
Any
|
Optional I/O configurations.
|
{}
|
Source code in strands/experimental/bidi/io/text.py
71 72 73 74 75 76 77 78 79 | |
input()
¶
Return text processing BidiInput.
Source code in strands/experimental/bidi/io/text.py
81 82 83 | |
output()
¶
Return text processing BidiOutput.
Source code in strands/experimental/bidi/io/text.py
85 86 87 | |