Skip to main content

Overview

CrewAI supports native multimodal file inputs, allowing you to pass images, PDFs, audio, video, and text files directly to your agents. Files are automatically formatted for each LLM provider’s API requirements.
File support requires the optional crewai-files package. Install it with:
The file processing API is currently in early access.

File Types

CrewAI supports five specific file types plus a generic File class that auto-detects the type:

File Sources

The source parameter accepts multiple input types and auto-detects the appropriate handler:

From Path

From URL

From Bytes

Using Files

Files can be passed at multiple levels, with more specific levels taking precedence.

With Crews

Pass files when kicking off a crew:

With Tasks

Attach files to specific tasks:

With Flows

Pass files to flows, which automatically inherit to crews:

With Standalone Agents

Pass files directly to agent kickoff:

File Precedence

When files are passed at multiple levels, more specific levels override broader ones:
For example, if both Flow and Task define a file named "chart", the Task’s version is used.

Provider Support

Different providers support different file types. CrewAI automatically formats files for each provider’s API.
Google Gemini models support all file types including video (up to 1 hour, 2GB). Use Gemini when you need to process video content.
If you pass a file type that the provider doesn’t support (e.g., video to OpenAI), you’ll receive an UnsupportedFileTypeError. Choose your provider based on the file types you need to process.

How Files Are Sent

CrewAI automatically chooses the optimal method to send files to each provider:

Provider Transmission Methods

You don’t need to manage this yourself. CrewAI automatically uses the most efficient method based on file size and provider capabilities. Providers without file upload APIs use inline base64 for all files.

File Handling Modes

Control how files are processed when they exceed provider limits:

Provider Constraints

Each provider has specific limits for file sizes and dimensions:

OpenAI

  • Images: Max 20 MB, up to 10 images per request
  • PDFs: Max 32 MB, up to 100 pages
  • Audio: Max 25 MB, up to 25 minutes

Anthropic

  • Images: Max 5 MB, max 8000x8000 pixels, up to 100 images
  • PDFs: Max 32 MB, up to 100 pages

Google Gemini

  • Images: Max 100 MB
  • PDFs: Max 50 MB
  • Audio: Max 100 MB, up to 9.5 hours
  • Video: Max 2 GB, up to 1 hour

AWS Bedrock

  • Images: Max 4.5 MB, max 8000x8000 pixels
  • PDFs: Max 3.75 MB, up to 100 pages

Referencing Files in Prompts

Use the file’s key name in your task descriptions to reference files: