Loading
Prepare for Email to Become the Default Login ExperienceRead More
Agentforce and Einstein Generative AI
Set Up File Uploads for an Agent

Set Up File Uploads for an Agent

Add file upload support to your agent, so your users can share screenshots, receipts, and PDFs. Your agent can interpret individual files or a group of files, answer questions based on one or more files, and add files to a Salesforce record.

Required Editions

Available in: Lightning Experience
Available in: Enterprise, Performance, Unlimited, and Developer Editions. Required add-on licenses vary by agent type.
User Permissions Needed
To set up file uploads in an AI agent: Manage AI Agents AND the required permissions for your agent type

Before you begin, review the support and requirements for adding file uploads to your agent.

Agentforce File Upload Support
Agent Types

Agentforce Service agents, Agentforce Employee agents

Agents must be created in or upgraded to Agent Script and Agentforce Builder in Agentforce Studio.

Channels

Enhanced Chat v1, Enhanced Chat v2, Lightning Experience

Mobile isn't currently supported.

On some third-party messaging clients (Line, WeChat, WhatsApp), multiple attachments are split into individual messages and are processed by the agent individually.

Models

OpenAI GPT 4.1 only. Azure OpenAI isn’t currently supported. LLM Multimodal Support limits apply.

The HyperClassifier model doesn’t support images. If you use the HyperClassifier model for subagent classification, you can’t use the Agent Router to file uploads or route conversations based on the content of file uploads.

Files

PNG, JPEG, PDF

Files can be up to 5 MB each.

An agent can accept up to 5 files per message (varies by channel) and up to 10 files per conversation. If a user uploads more than 10 files, the agent saves the most recent 10.

  1. From the Agents list in the Agentforce Studio app, open the agent you want to receive file uploads.
  2. Optionally, add the file_upload sub-block to your agent’s script and specify the mode you want your agent to use for handling file uploads.

    Use this Agent Script setting to define how your agent uses and stores uploaded files. You can also use this setting to turn off file uploads for your agent. If you don’t specify a mode and your agent can receive file uploads, auto mode applies by default.

    1. If you’re viewing the agent in Canvas view, switch to Script view.
    2. In your agent's config block, add the file_upload field and specify a mode value.
      config:
          file_upload:
              mode: "auto" | "managed" | "disabled" | "error"
                  

      Available modes:

      • auto—Files are processed and saved to the conversation history. Use this mode to allow the agent to automatically manage how and when files are used.
      • managed—Files are stored in the uploaded_files system variable (@system_variables.uploaded_files), and you use the variable to control how files are used. Files aren’t saved to conversation history. Use this mode to explicitly manage how files are sent to the LLM, which subagents can access the files, and how the files are sent and used by other actions. To give the agent access to uploaded files, directly reference the variable in subagent instructions or assign it to action inputs and outputs.
      • disabled—File uploads are turned off silently. See Turn Off File Uploads for an Agent.
      • error—File uploads are turned off, and the agent sends an error message. See Turn Off File Uploads for an Agent.
  3. Customize your subagents and actions.
    1. Give your agent file-handling instructions. For best results, we recommend creating a dedicated subagent for handling file uploads, so you can provide detailed instructions and control subagent routing for your business case. For example, you may want to provide unique instructions for how to handle PDF files versus image files.
      Note
      Note Without explicit instructions that your agent can accept file uploads, when your agent receives a file, your agent can redirect the conversation to the Off Topic system subagent. At minimum, in a subagent that you want to use for file handling, tell your agent to use the subagent to process files.

      Here’s an example of Agent Script for a File and Image Analysis subagent block.

      subagent File_and_Image_Analysis:
         label: "File and Image Analysis"
         description: |
             Use this topic when the user uploads a PDF, document, or image file and asks to summarize, analyze, describe, extract text from, or answer questions about its contents.
         reasoning:
             instructions: ->
                 | 1. Evaluate standard user requests involving uploaded attachments (PDFs, images, or documents).
                 | 2. When a user asks to describe, summarize, or extract text from an uploaded PDF or image:
                 |    - Identify the primary topics, main takeaways, key data points, and structural highlights from the document or visual content.
                 |    - Provide a clear, structured summary using bullet points or concise paragraphs.
                 |    - Do not guess or fabricate information not present in the attached file.
                 | 3. If the document content is unclear or incomplete, politely ask the user for clarification while describing what is currently visible.
      
    2. If you use managed mode, make sure the uploaded_files system variable is added to your agent. To give your agent access to uploaded files, reference the variable in agent instructions, assign it to agent action inputs or outputs, or both.
      To learn more about using the uploaded_files system variable, see Agentforce Developer Guide: System Variables. To learn more about working with list variables, see Agentforce Developer Guide: Using List Variables.
  4. Save your changes.
  5. If you’re connecting an agent to Enhanced Chat:
    1. From the Messaging Settings page in Setup, turn on file sharing for end users. You can also specify allowed file types and maximum file size. See Customize the File Sharing Experience in Enhanced Chat.
    2. Make sure that your agent user has required access.
      • System Permissions: Chatter Internal User, Access Conversation Entries
      • Object Permissions: Messaging Session
      • Object Settings: Messaging Session, Messaging User
      Note
      Note If you created an agent user when you created your agent, your agent user is granted the required Messaging Session object permissions and settings by default.
  6. If you’re connecting your agent to an Experience Cloud site that allows guest users, give them permission to upload files. Guest users can upload files to a record only when guest user sharing rules are in place.
    1. From Setup, in the Quick Find box, enter Salesforce Files, and select General Settings.
    2. Select Allow site guest users to upload files.
  7. Before you deploy your agent, test your agent’s file upload configuration. Start a preview conversation in Agentforce Builder and send a file. File uploads can be tested end to end.
 
Loading
Salesforce Help | Article