Agent tools

write

write({ path, content })

Create a file, or replace one whole. The previous version is kept automatically.

category: writekeeps the old versionfree in auto
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

pathstringrequired

Relative to the workspace. Parent folders are created.

contentstringrequired

The whole file.

For an existing file, prefer edit

Rewriting a file whole costs its whole length in output tokens

The agent is instructed to use edit or multi_edit on a file that exists, and write only for new ones. A 600-line file rewritten to change one line is 600 lines of output, paid for and slow.

Nothing is lost

Replacing a file writes the previous content under .versions/ first. That is what lets auto mode let writes through without asking.

Text only

Content is a string. Generated media is written by its own tool, and a converted file by convert.