Input Content
Provide user input to BidiAgent as text, images, or streaming audio. Text and image blocks form complete user messages, while audio deltas add samples to an ongoing input stream.
Send input
Section titled “Send input”Use agent.send() to provide input once the agent is running. A string is enough to send text:
import asyncio
from strands.bidi.agent import BidiAgentfrom strands.bidi.types import BidiResponseStopEvent
async def main() -> None: async with BidiAgent() as agent: await agent.send("Tell me about Lisbon.")
async for event in agent.receive(): if isinstance(event, BidiResponseStopEvent): break
asyncio.run(main())send() returns after sending the input. Read the model’s response separately through agent.receive(), as the example does.
BidiAgentInput defines the forms you can send:
| Content | Accepted forms |
|---|---|
| Text | A string, TextBlock, or {"text": ...}. |
| Image | ImageBlock or {"image": ...}. |
| Streaming audio | AudioDelta or {"audio_delta": ...}. |
A nonempty list of strings, text/image blocks, or their dictionary forms groups content into one user message, preserving block order.
For continuous input, pass input streams to agent.run(). Each read returns one of these input forms.
Streaming audio
Section titled “Streaming audio”Send live audio as individual AudioDelta inputs, outside text and image lists. Each delta carries a chunk of audio samples without explicitly ending the user’s turn; the model provider determines when the turn is complete.
The built-in models expect raw PCM bytes matching their configured input sample rate and channel count. This example forwards chunks from an asynchronous audio source to a running agent:
from collections.abc import AsyncIterable
from strands.bidi.agent import BidiAgentfrom strands.bidi.types import AudioDelta
async def send_audio(agent: BidiAgent, chunks: AsyncIterable[bytes]) -> None: async for chunk in chunks: await agent.send(AudioDelta(format="pcm", source={"bytes": chunk}))from collections.abc import AsyncIterable
from strands.bidi.agent import BidiAgent
async def send_audio(agent: BidiAgent, chunks: AsyncIterable[bytes]) -> None: async for chunk in chunks: await agent.send({ "audio_delta": {"format": "pcm", "source": {"bytes": chunk}}, })For microphone input, AudioIO creates these deltas using the model’s audio configuration.
Model messages
Section titled “Model messages”Your application sends user input through agent.send(), which prepares it for BidiModel.send(). Text and images become a BidiMessage containing an ordered list of typed blocks; audio deltas pass through individually.
The agent also uses BidiMessage to return tool results to the model, packaging each tool’s output as a ToolResultBlock. It handles this delivery automatically, so tool results aren’t part of BidiAgentInput. You can track tool calls and results through tool execution events.
See Messages for how the agent records user input and tool results alongside content assembled from stream events.