Skip to content

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.

@runtime_checkable
class 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") -> None

Defined in: src/strands/experimental/bidi/types/io.py:24

Start input.

async def stop() -> None

Defined in: src/strands/experimental/bidi/types/io.py:28

Stop input.

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.)

@runtime_checkable
class 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") -> None

Defined in: src/strands/experimental/bidi/types/io.py:49

Start output.

async def stop() -> None

Defined in: src/strands/experimental/bidi/types/io.py:53

Stop output.

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.)