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 Agentfrom strands.vended_tools import edit
agent = Agent(tools=[edit])agent("In /tmp/hello.txt, replace 'world' with 'Strands'.")import { Agent } from '@strands-agents/sdk'import { edit } from '@strands-agents/sdk/vended-tools/edit'
const agent = new Agent({ tools: [edit],})
await agent.invoke("In /tmp/hello.txt, replace 'world' with 'Strands'.")