Built-in tools
builtin__save_file
Stores text or JSON you already have as a file and returns its ref, with no model call.
Behavior
- A string
contentis written as it is. An object or list is written as pretty JSON. nameis a file name, not a path, and its extension sets the file's type:snapshot.jsonisapplication/json,styles.cssistext/css. Any lowercase extension of up to 16 letters and digits is kept, so a type Dive doesn't know is stored asapplication/octet-streamwith its own extension.- A name without an extension takes one from
typewhen given, else.txtfor a string and.jsonfor anything else. - Returns
{name, ref, mime, bytes}, and lists the file underfileslike any tool that returns one.
When to use it
- Keep data a plan or agent already has, such as a backup of a setting before changing it, as a ref to pass on or read back later with
builtin__read_file. - Hand text to a tool that takes a file: pass the ref to an input declared
format: blob.
| Available to | Effect |
|---|---|
| Any agent or plan step | Read-only |
Input
The text, or an object or list to store as JSON
File name with extension, such as snapshot.json
typestring
MIME type, used only when the name has no extension
Output
bytesinteger
mimestring
namestring
refstring
- id: E1
tool_name: builtin__save_file
input:
name: "{{input.name}}"
content: "{{input.content}}"