strands.vended_tools.read.read
Sandbox-routed read tool.
Reads a file through a :class:~strands.sandbox.base.Sandbox: either one bound
at creation via :func:make_read or the agent’s configured sandbox read from
tool_context.agent.sandbox at call time. Text files return cat -n style
numbered lines so the model can cite path:line; images (png/jpg/jpeg/gif/webp)
and binary documents (pdf/doc/docx/xls/xlsx) return as media content blocks when
media is on.
make_read
Section titled “make_read”def make_read( *, media: bool = True, sandbox: Sandbox | None = None, name: str = "read", description: str = DEFAULT_READ_DESCRIPTION) -> DecoratedFunctionToolDefined in: src/strands/vended_tools/read/read.py:62
Create a sandbox-routed read tool.
If a sandbox is passed, it is bound at creation time. Otherwise the tool
reads the sandbox from tool_context.agent.sandbox at call time.
Arguments:
media- Return images and binary documents as viewable media. Set toFalsefor a model that rejects media blocks, andreaddescribes those files in text instead.sandbox- Sandbox to bind at creation. WhenNone, the agent’s configured sandbox is used at call time.name- Tool name. Defaults to"read".description- Tool description shown to the model.
Returns:
A decorated tool that reads files through the sandbox.
Default sandbox-routed read tool. Reads the sandbox from the agent’s context at call time.