Skip to content

read_file — read a file by path

read_file returns the full contents of a file. It also records that the file has been read in the current session so the read-before-write guard on edit_file can succeed.

ArgTypeRequiredDescription
pathstringyesRelative path (resolved against the environment’s workdir) or absolute.
{"path": "chimera/core/agent.py"}
from chimera.tools.read import ReadFileTool
tool = ReadFileTool()
result = tool.execute({"path": "README.md"}, env=local_env)
print(result.output[:200])
# Chimera
Compose coding agents from modular primitives.
...

On a missing file, output is empty and error reads File not found: <path>.

  • edit_file — requires the target to have been read_file-d first when the read-before-write guard is on.
  • write_file — the create-only counterpart.
  • apply_patch — multi-file atomic edits.