Skip to content

Read

Reads a file through the agent’s sandbox. Text files return cat -n style numbered lines so the model can cite path:line, with offset and limit for paging through large files. Images (png/jpg/jpeg/gif/webp) and binary documents (pdf/doc/docx/xls/xlsx) return as media content blocks when the model accepts media; otherwise make_read(media=False) / makeRead({ media: false }) returns a short text placeholder describing the file.

Supported in: Python, TypeScript (Node.js).

Example:

from strands import Agent
from strands.vended_tools import read
agent = Agent(tools=[read])
agent("Read /etc/hosts and summarize what it maps.")

Full API reference