Skip to main content

Save Artifact

Saves a file as an artifact in the session's artifact storage, making it accessible to agents in the conversation.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.

Inputs

  • Session ID - (string) Unique identifier for the session where the artifact will be stored.
  • Artifact Filename - (string) Name for the artifact. Use "user:" prefix for user-scoped artifacts (e.g., "user:profile.jpg").
  • File Path - (string) Path to the file to save as an artifact.
  • MIME Type - (string) MIME type of the content (e.g., "image/png", "application/pdf"). If not provided, it will be auto-detected from the file extension.

Outputs

This node does not have outputs.

How It Works

The Save Artifact node stores files in the session's artifact service:

  1. File Reading - Reads the file from the specified file path
  2. MIME Type Detection - Auto-detects the MIME type if not provided based on file extension
  3. Artifact Creation - Creates an artifact object with the file data and MIME type
  4. Storage - Saves the artifact to the session's artifact service using the specified filename
  5. Versioning - Artifacts are versioned, allowing multiple versions of the same filename

Common Use Cases

  • Image Processing - Save images for agent analysis or generation
  • Document Storage - Store PDFs, Word documents, or text files for agent reference
  • Data Persistence - Save JSON, CSV, or Excel files for data analysis
  • User Uploads - Store user-uploaded files for processing
  • Generated Content - Save agent-generated content for later retrieval
  • Multimodal Input - Provide images or documents to vision-enabled agents

Error Handling

The node will return errors in the following cases:

  • Missing required fields - "Session ID, Filename, and File Path are required"
  • File not found - File path does not exist or is not accessible
  • Invalid file - File cannot be read or is corrupted
  • Artifact service error - Storage service is unavailable or has issues
  • Permission errors - Insufficient permissions to read the file

Usage Notes

  • MIME Type - If not specified, the node attempts to guess the MIME type from the file extension. For best results, specify it explicitly for non-standard file types.
  • File Paths - Use absolute file paths for reliability. Relative paths are resolved from the current working directory.
  • User-Scoped Artifacts - Prefix the filename with "user:" to create user-specific artifacts that persist across sessions.
  • Session-Scoped Artifacts - Regular filenames (without "user:" prefix) are scoped to the specific session.
  • Versioning - Each save creates a new version of the artifact. Use Load Artifact to retrieve specific versions.
  • Storage Limits - Be mindful of storage limits when saving large files or many artifacts.
  • Supported Types - Supports all file types including images (PNG, JPG, GIF), documents (PDF, DOCX), data files (CSV, JSON, Excel), and more.

Example MIME Types

  • Images: "image/png", "image/jpeg", "image/gif", "image/webp"
  • Documents: "application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document" (DOCX)
  • Data: "application/json", "text/csv", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" (XLSX)
  • Text: "text/plain", "text/html", "text/markdown"
  • Audio: "audio/mpeg", "audio/wav", "audio/ogg"
  • Video: "video/mp4", "video/webm", "video/quicktime"

Artifact Naming

  • Session-scoped: "report.pdf", "image.jpg", "data.json"
  • User-scoped: "user:profile.jpg", "user:settings.json", "user:avatar.png"

User-scoped artifacts persist across all sessions for a specific user, while session-scoped artifacts only exist within the current session.