save_file
Download any file from a URL and save it locally. Persists crawl artifacts with custom filenames and directories, returning the absolute saved path.
Instructions
Download a resource from a URL and save it to the local output directory. Handles any file type (images, PDFs, CSVs, etc.) via HTTP GET. Returns the absolute path of the saved file. Use to persist crawl artifacts; path traversal is blocked for security.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | Fully qualified URL of the resource to download (e.g. "https://example.com/report.pdf"). Must include protocol. | |
| subdir | No | Subdirectory within the output directory to save into (e.g. "images", "data/csv"). Created automatically if it doesn't exist. | |
| headers | No | Optional HTTP request headers to send with the download (e.g. Referer, Origin, User-Agent). Use for CDNs that reject requests lacking a Referer. | |
| filename | No | Custom filename to save as (e.g. "report.pdf"). If omitted, derived from the URL's last path segment. Path traversal characters (../) are rejected. | |
| output_dir | No | Override the default output directory. Can be relative (resolved against CWD) or absolute. If omitted, uses the configured output_dir from settings. |