From 202ca028d663127fbd4db13759c6d17bccf04723 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 28 Mar 2026 23:39:30 -0700 Subject: [PATCH] docs: Add file upload support documentation for flows Document how to use crewai-files types in flow state for file uploads, including CrewAI Platform integration with automatic file upload UI. Co-Authored-By: Claude Opus 4.5 --- docs/en/concepts/files.mdx | 4 ++++ docs/en/concepts/flows.mdx | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/docs/en/concepts/files.mdx b/docs/en/concepts/files.mdx index af86baabe..54d91914e 100644 --- a/docs/en/concepts/files.mdx +++ b/docs/en/concepts/files.mdx @@ -134,6 +134,10 @@ result = flow.kickoff( ) ``` + +When deployed on CrewAI Platform, `ImageFile`, `PDFFile`, and other file-typed fields in your flow state automatically get a file upload UI. Users can drag and drop files directly in the Platform interface. Files are stored securely and passed to agents using provider-specific optimizations (inline base64, file upload APIs, or URL references depending on the provider). + + ### With Standalone Agents Pass files directly to agent kickoff: diff --git a/docs/en/concepts/flows.mdx b/docs/en/concepts/flows.mdx index defbd3e01..71e4c7a5d 100644 --- a/docs/en/concepts/flows.mdx +++ b/docs/en/concepts/flows.mdx @@ -341,6 +341,36 @@ flow.kickoff() By providing both unstructured and structured state management options, CrewAI Flows empowers developers to build AI workflows that are both flexible and robust, catering to a wide range of application requirements. +### File Inputs + +When using structured state, you can include file-typed fields using classes from `crewai-files`. This enables file uploads as part of your flow's input: + +```python +from crewai.flow.flow import Flow, start +from crewai_files import ImageFile, PDFFile +from pydantic import BaseModel + +class OnboardingState(BaseModel): + document: PDFFile # File upload + cover_image: ImageFile # Image upload + title: str = "" # Text input + +class OnboardingFlow(Flow[OnboardingState]): + @start() + def process_upload(self): + # Access files directly from state + print(f"Processing: {self.state.title}") + return self.state.document +``` + +When deployed on **CrewAI Platform**, file-typed fields automatically render as file upload dropzones in the UI. Users can drag and drop files, which are then passed to your flow. + +**Kicking off with files via API:** +- **Multipart**: `POST /kickoff/multipart` with files embedded in the request +- **Separate upload**: `POST /files` first to upload files, then `POST /kickoff` with the returned URLs + +API users can also pass URL strings directly to file-typed fields—Pydantic coerces them automatically. + ## Flow Persistence The @persist decorator enables automatic state persistence in CrewAI Flows, allowing you to maintain flow state across restarts or different workflow executions. This decorator can be applied at either the class level or method level, providing flexibility in how you manage state persistence.