Skip to content

Edit

Lets your agent make surgical, in-place changes to a text file by replacing an exact, unique string (old_str must appear in the file exactly once).

The edit tool pairs with the read and write vended tools and supersedes file_editor.

Example:

from strands import Agent
from strands.vended_tools import edit
agent = Agent(tools=[edit])
agent("In /tmp/hello.txt, replace 'world' with 'Strands'.")