strands.experimental.bidi.types.io
Protocol for bidirectional streaming IO channels.
Defines callable protocols for input and output channels that can be used with BidiAgent. This approach provides better typing and flexibility by separating input and output concerns into independent callables.
BidiInput
Section titled “BidiInput”@runtime_checkableclass BidiInput(Protocol)Defined in: src/strands/experimental/bidi/types/io.py:17
Protocol for bidirectional input callables.
Input callables read data from a source (microphone, camera, websocket, etc.) and return events to be sent to the agent.
async def start(agent: "BidiAgent") -> NoneDefined in: src/strands/experimental/bidi/types/io.py:24
Start input.
async def stop() -> NoneDefined in: src/strands/experimental/bidi/types/io.py:28
Stop input.
__call__
Section titled “__call__”def __call__() -> Awaitable[BidiInputEvent]Defined in: src/strands/experimental/bidi/types/io.py:32
Read input data from the source.
Returns:
Awaitable that resolves to an input event (audio, text, image, etc.)
BidiOutput
Section titled “BidiOutput”@runtime_checkableclass BidiOutput(Protocol)Defined in: src/strands/experimental/bidi/types/io.py:42
Protocol for bidirectional output callables.
Output callables receive events from the agent and handle them appropriately (play audio, display text, send over websocket, etc.).
async def start(agent: "BidiAgent") -> NoneDefined in: src/strands/experimental/bidi/types/io.py:49
Start output.
async def stop() -> NoneDefined in: src/strands/experimental/bidi/types/io.py:53
Stop output.
__call__
Section titled “__call__”def __call__(event: BidiOutputEvent) -> Awaitable[None]Defined in: src/strands/experimental/bidi/types/io.py:57
Process output events from the agent.
Arguments:
event- Output event from the agent (audio, text, tool calls, etc.)