From 9723113755b1f48c0e2e37e457fd0eecffb6ecb4 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 6 Apr 2026 00:34:05 -0700 Subject: [PATCH] docs: add file upload to kickoff guide, clarify flow state population, all languages - Added new "File Uploads" section to kickoff-crew.mdx with multipart, JSON URL, and separate upload + kickoff examples - Clarified that file-typed fields in flow state schema signal the Platform UI to render file dropzones - Updated flows.mdx File Inputs section to show state population pattern - Updated files.mdx With Flows section with state schema example - Applied all changes to en, ar, ko, pt-BR translations Co-Authored-By: Claude Opus 4.5 --- docs/ar/concepts/files.mdx | 16 ++++-- docs/ar/concepts/flows.mdx | 25 ++++----- docs/ar/enterprise/guides/kickoff-crew.mdx | 54 +++++++++++++++++++ docs/en/concepts/files.mdx | 16 ++++-- docs/en/concepts/flows.mdx | 25 ++++----- docs/en/enterprise/guides/kickoff-crew.mdx | 54 +++++++++++++++++++ docs/ko/concepts/files.mdx | 16 ++++-- docs/ko/concepts/flows.mdx | 25 ++++----- docs/ko/enterprise/guides/kickoff-crew.mdx | 54 +++++++++++++++++++ docs/pt-BR/concepts/files.mdx | 16 ++++-- docs/pt-BR/concepts/flows.mdx | 25 ++++----- docs/pt-BR/enterprise/guides/kickoff-crew.mdx | 54 +++++++++++++++++++ 12 files changed, 316 insertions(+), 64 deletions(-) diff --git a/docs/ar/concepts/files.mdx b/docs/ar/concepts/files.mdx index 80c2e27da..4a13027bc 100644 --- a/docs/ar/concepts/files.mdx +++ b/docs/ar/concepts/files.mdx @@ -117,20 +117,28 @@ task = Task( ### مع التدفقات -مرر الملفات إلى التدفقات، والتي تنتقل تلقائيًا إلى الأطقم: +تعمل الحقول من نوع الملف (`File`، `ImageFile`، `PDFFile`) في مخطط حالة التدفق كإشارة لواجهة المنصة. عند النشر، تُعرض هذه الحقول كمناطق سحب وإفلات لرفع الملفات. يمكن أيضًا تمرير الملفات عبر `input_files` في API. ```python from crewai.flow.flow import Flow, start -from crewai_files import ImageFile +from crewai_files import File, ImageFile +from pydantic import BaseModel -class AnalysisFlow(Flow): +class MyState(BaseModel): + document: File # Renders as file dropzone in Platform UI + cover_image: ImageFile # Image-specific dropzone + title: str = "" + +class AnalysisFlow(Flow[MyState]): @start() def analyze(self): + # Files are automatically populated in state + content = self.state.document.read() return self.analysis_crew.kickoff() flow = AnalysisFlow() result = flow.kickoff( - input_files={"image": ImageFile(source="data.png")} + input_files={"document": File(source="report.pdf")} ) ``` diff --git a/docs/ar/concepts/flows.mdx b/docs/ar/concepts/flows.mdx index 5f81292c0..5150a9c42 100644 --- a/docs/ar/concepts/flows.mdx +++ b/docs/ar/concepts/flows.mdx @@ -343,27 +343,28 @@ flow.kickoff() ### مدخلات الملفات -عند استخدام الحالة المهيكلة، يمكنك تضمين حقول من نوع الملف باستخدام فئات من `crewai-files`. هذا يتيح رفع الملفات كجزء من مدخلات التدفق الخاص بك: +عند استخدام الحالة المهيكلة، يمكنك تضمين حقول من نوع الملف باستخدام فئات من `crewai-files`. تعمل الحقول من نوع الملف في حالة التدفق كإشارة للمنصة — فهي تُعرض تلقائيًا كمناطق سحب وإفلات لرفع الملفات في واجهة علامة تبويب Run ويتم تعبئتها عند رفع الملفات عبر المنصة أو تمريرها عبر `input_files` في API. ```python from crewai.flow.flow import Flow, start -from crewai_files import ImageFile, PDFFile +from crewai_files import File, ImageFile, PDFFile from pydantic import BaseModel -class OnboardingState(BaseModel): - document: PDFFile # File upload - cover_image: ImageFile # Image upload - title: str = "" # Text input +class MyState(BaseModel): + document: File # Renders as file dropzone in Platform + title: str = "" -class OnboardingFlow(Flow[OnboardingState]): +class MyFlow(Flow[MyState]): @start() - def process_upload(self): - # Access files directly from state - print(f"Processing: {self.state.title}") - return self.state.document + def process(self): + # File object is automatically populated in state + # when uploaded via Platform UI or passed via API + content = self.state.document.read() + print(f"Processing {self.state.title}: {len(content)} bytes") + return content ``` -عند النشر على **منصة CrewAI**، تُعرض الحقول من نوع الملف تلقائيًا كمناطق سحب وإفلات لرفع الملفات في واجهة المستخدم. يمكن للمستخدمين سحب وإفلات الملفات، والتي تُمرر بعد ذلك إلى التدفق الخاص بك. +عند النشر على **منصة CrewAI**، تُعرض الحقول من نوع الملف (`File`، `ImageFile`، `PDFFile` من `crewai-files`) تلقائيًا كمناطق سحب وإفلات لرفع الملفات في واجهة المستخدم. يمكن للمستخدمين سحب وإفلات الملفات، والتي تُملأ بعد ذلك في حالة التدفق الخاص بك. **بدء التشغيل مع الملفات عبر API:** diff --git a/docs/ar/enterprise/guides/kickoff-crew.mdx b/docs/ar/enterprise/guides/kickoff-crew.mdx index f1e477065..da90c2e19 100644 --- a/docs/ar/enterprise/guides/kickoff-crew.mdx +++ b/docs/ar/enterprise/guides/kickoff-crew.mdx @@ -86,6 +86,60 @@ curl -H "Authorization: Bearer YOUR_CREW_TOKEN" https://your-crew-url.crewai.com رمز الحامل متاح في علامة تبويب Status في صفحة تفاصيل طاقمك. +## رفع الملفات + +عندما يتضمن طاقمك أو تدفقك حقول حالة من نوع الملف (باستخدام `ImageFile` أو `PDFFile` أو `File` من `crewai-files`)، تُعرض هذه الحقول تلقائيًا كمناطق سحب وإفلات لرفع الملفات في واجهة علامة تبويب Run. يمكن للمستخدمين سحب وإفلات الملفات مباشرة، وتتولى المنصة التخزين والتسليم إلى وكلائك. + +### بدء تشغيل Multipart (موصى به) + +أرسل الملفات مباشرة مع طلب بدء التشغيل باستخدام `multipart/form-data`: + +```bash +curl -X POST https://your-deployment.crewai.com/kickoff \ + -H 'Authorization: Bearer YOUR_TOKEN' \ + -F 'inputs={"title": "Report"}' \ + -F 'document=@/path/to/file.pdf' +``` + +يتم تخزين الملفات تلقائيًا وتحويلها إلى كائنات ملفات. يتلقى الوكيل الملف مع تحسين خاص بالمزود (base64 مضمّن، أو API لرفع الملفات، أو مرجع URL حسب مزود LLM). + +### بدء تشغيل JSON مع عناوين URL للملفات + +إذا كانت لديك ملفات مستضافة بالفعل على عناوين URL، مررها عبر `input_files`: + +```bash +curl -X POST https://your-deployment.crewai.com/kickoff \ + -H 'Authorization: Bearer YOUR_TOKEN' \ + -H 'Content-Type: application/json' \ + -d '{ + "inputs": {"title": "Report"}, + "input_files": {"document": "https://example.com/file.pdf"} + }' +``` + +### رفع منفصل + بدء تشغيل + +ارفع الملفات أولاً، ثم أشِر إليها بواسطة URL: + +```bash +# Step 1: Upload +curl -X POST https://your-deployment.crewai.com/files \ + -H 'Authorization: Bearer YOUR_TOKEN' \ + -F 'file=@/path/to/file.pdf' \ + -F 'field_name=document' +# Returns: {"url": "https://...", "field_name": "document"} + +# Step 2: Kickoff with URL +curl -X POST https://your-deployment.crewai.com/kickoff \ + -H 'Authorization: Bearer YOUR_TOKEN' \ + -H 'Content-Type: application/json' \ + -d '{"inputs": {"title": "Report"}, "input_files": {"document": "https://..."}}' +``` + + +يعمل رفع الملفات بنفس الطريقة لكل من الطواقم والتدفقات. عرّف حقول من نوع الملف في مخطط حالتك، وستتولى واجهة المنصة وAPI الرفع تلقائيًا. + + ### التحقق من صحة الطاقم قبل تنفيذ العمليات، يمكنك التحقق من أن طاقمك يعمل بشكل صحيح: diff --git a/docs/en/concepts/files.mdx b/docs/en/concepts/files.mdx index 2629c66c6..596ab989f 100644 --- a/docs/en/concepts/files.mdx +++ b/docs/en/concepts/files.mdx @@ -117,20 +117,28 @@ task = Task( ### With Flows -Pass files to flows, which automatically inherit to crews: +File-typed fields (`File`, `ImageFile`, `PDFFile`) in your flow's state schema serve as the signal to the Platform UI. When deployed, these fields render as file upload dropzones. Files can also be passed via `input_files` in the API. ```python from crewai.flow.flow import Flow, start -from crewai_files import ImageFile +from crewai_files import File, ImageFile +from pydantic import BaseModel -class AnalysisFlow(Flow): +class MyState(BaseModel): + document: File # Renders as file dropzone in Platform UI + cover_image: ImageFile # Image-specific dropzone + title: str = "" + +class AnalysisFlow(Flow[MyState]): @start() def analyze(self): + # Files are automatically populated in state + content = self.state.document.read() return self.analysis_crew.kickoff() flow = AnalysisFlow() result = flow.kickoff( - input_files={"image": ImageFile(source="data.png")} + input_files={"document": File(source="report.pdf")} ) ``` diff --git a/docs/en/concepts/flows.mdx b/docs/en/concepts/flows.mdx index f8ff211cd..4a9bca3f6 100644 --- a/docs/en/concepts/flows.mdx +++ b/docs/en/concepts/flows.mdx @@ -343,27 +343,28 @@ By providing both unstructured and structured state management options, CrewAI F ### 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: +When using structured state, you can include file-typed fields using classes from `crewai-files`. File-typed fields in your flow state serve as the signal to the Platform—they automatically render as file upload dropzones in the Run tab UI and get populated when files are uploaded via the Platform or passed via `input_files` in the API. ```python from crewai.flow.flow import Flow, start -from crewai_files import ImageFile, PDFFile +from crewai_files import File, ImageFile, PDFFile from pydantic import BaseModel -class OnboardingState(BaseModel): - document: PDFFile # File upload - cover_image: ImageFile # Image upload - title: str = "" # Text input +class MyState(BaseModel): + document: File # Renders as file dropzone in Platform + title: str = "" -class OnboardingFlow(Flow[OnboardingState]): +class MyFlow(Flow[MyState]): @start() - def process_upload(self): - # Access files directly from state - print(f"Processing: {self.state.title}") - return self.state.document + def process(self): + # File object is automatically populated in state + # when uploaded via Platform UI or passed via API + content = self.state.document.read() + print(f"Processing {self.state.title}: {len(content)} bytes") + return content ``` -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. +When deployed on **CrewAI Platform**, file-typed fields (`File`, `ImageFile`, `PDFFile` from `crewai-files`) automatically render as file upload dropzones in the UI. Users can drag and drop files, which are then populated into your flow's state. **Kicking off with files via API:** diff --git a/docs/en/enterprise/guides/kickoff-crew.mdx b/docs/en/enterprise/guides/kickoff-crew.mdx index ba2408333..d3e6e33cc 100644 --- a/docs/en/enterprise/guides/kickoff-crew.mdx +++ b/docs/en/enterprise/guides/kickoff-crew.mdx @@ -86,6 +86,60 @@ curl -H "Authorization: Bearer YOUR_CREW_TOKEN" https://your-crew-url.crewai.com Your bearer token is available on the Status tab of your crew's detail page. +## File Uploads + +When your crew or flow includes file-typed state fields (using `ImageFile`, `PDFFile`, or `File` from `crewai-files`), these fields automatically render as file upload dropzones in the Run tab UI. Users can drag and drop files directly, and the Platform handles storage and delivery to your agents. + +### Multipart Kickoff (Recommended) + +Send files directly with the kickoff request using `multipart/form-data`: + +```bash +curl -X POST https://your-deployment.crewai.com/kickoff \ + -H 'Authorization: Bearer YOUR_TOKEN' \ + -F 'inputs={"title": "Report"}' \ + -F 'document=@/path/to/file.pdf' +``` + +Files are automatically stored and converted to file objects. The agent receives the file with provider-specific optimization (inline base64, file upload API, or URL reference depending on the LLM provider). + +### JSON Kickoff with File URLs + +If you have files already hosted at URLs, pass them via `input_files`: + +```bash +curl -X POST https://your-deployment.crewai.com/kickoff \ + -H 'Authorization: Bearer YOUR_TOKEN' \ + -H 'Content-Type: application/json' \ + -d '{ + "inputs": {"title": "Report"}, + "input_files": {"document": "https://example.com/file.pdf"} + }' +``` + +### Separate Upload + Kickoff + +Upload files first, then reference them by URL: + +```bash +# Step 1: Upload +curl -X POST https://your-deployment.crewai.com/files \ + -H 'Authorization: Bearer YOUR_TOKEN' \ + -F 'file=@/path/to/file.pdf' \ + -F 'field_name=document' +# Returns: {"url": "https://...", "field_name": "document"} + +# Step 2: Kickoff with URL +curl -X POST https://your-deployment.crewai.com/kickoff \ + -H 'Authorization: Bearer YOUR_TOKEN' \ + -H 'Content-Type: application/json' \ + -d '{"inputs": {"title": "Report"}, "input_files": {"document": "https://..."}}' +``` + + +File uploads work the same way for both crews and flows. Define file-typed fields in your state schema, and the Platform UI and API will handle uploads automatically. + + ### Checking Crew Health Before executing operations, you can verify that your crew is running properly: diff --git a/docs/ko/concepts/files.mdx b/docs/ko/concepts/files.mdx index dc298ef4c..e9e514392 100644 --- a/docs/ko/concepts/files.mdx +++ b/docs/ko/concepts/files.mdx @@ -117,20 +117,28 @@ task = Task( ### Flow와 함께 -flow에 파일을 전달하면 자동으로 crew에 상속됩니다: +flow의 상태 스키마에 있는 파일 타입 필드(`File`, `ImageFile`, `PDFFile`)는 플랫폼 UI에 대한 신호 역할을 합니다. 배포 시 이러한 필드는 파일 업로드 드롭존으로 렌더링됩니다. 파일은 API에서 `input_files`를 통해서도 전달할 수 있습니다. ```python from crewai.flow.flow import Flow, start -from crewai_files import ImageFile +from crewai_files import File, ImageFile +from pydantic import BaseModel -class AnalysisFlow(Flow): +class MyState(BaseModel): + document: File # Renders as file dropzone in Platform UI + cover_image: ImageFile # Image-specific dropzone + title: str = "" + +class AnalysisFlow(Flow[MyState]): @start() def analyze(self): + # Files are automatically populated in state + content = self.state.document.read() return self.analysis_crew.kickoff() flow = AnalysisFlow() result = flow.kickoff( - input_files={"image": ImageFile(source="data.png")} + input_files={"document": File(source="report.pdf")} ) ``` diff --git a/docs/ko/concepts/flows.mdx b/docs/ko/concepts/flows.mdx index 10d23415c..4d430f72f 100644 --- a/docs/ko/concepts/flows.mdx +++ b/docs/ko/concepts/flows.mdx @@ -336,27 +336,28 @@ CrewAI Flows는 비구조적 및 구조적 상태 관리 옵션을 모두 제공 ### 파일 입력 -구조화된 상태를 사용할 때, `crewai-files`의 클래스를 사용하여 파일 타입 필드를 포함할 수 있습니다. 이를 통해 flow의 입력으로 파일 업로드가 가능합니다: +구조화된 상태를 사용할 때, `crewai-files`의 클래스를 사용하여 파일 타입 필드를 포함할 수 있습니다. flow 상태의 파일 타입 필드는 플랫폼에 대한 신호 역할을 합니다 — Run 탭 UI에서 자동으로 파일 업로드 드롭존으로 렌더링되며, 플랫폼을 통해 파일을 업로드하거나 API에서 `input_files`를 통해 전달할 때 자동으로 채워집니다. ```python from crewai.flow.flow import Flow, start -from crewai_files import ImageFile, PDFFile +from crewai_files import File, ImageFile, PDFFile from pydantic import BaseModel -class OnboardingState(BaseModel): - document: PDFFile # File upload - cover_image: ImageFile # Image upload - title: str = "" # Text input +class MyState(BaseModel): + document: File # Renders as file dropzone in Platform + title: str = "" -class OnboardingFlow(Flow[OnboardingState]): +class MyFlow(Flow[MyState]): @start() - def process_upload(self): - # Access files directly from state - print(f"Processing: {self.state.title}") - return self.state.document + def process(self): + # File object is automatically populated in state + # when uploaded via Platform UI or passed via API + content = self.state.document.read() + print(f"Processing {self.state.title}: {len(content)} bytes") + return content ``` -**CrewAI 플랫폼**에 배포하면 파일 타입 필드가 UI에서 자동으로 파일 업로드 드롭존으로 렌더링됩니다. 사용자는 파일을 드래그 앤 드롭할 수 있으며, 해당 파일은 flow로 전달됩니다. +**CrewAI 플랫폼**에 배포하면 파일 타입 필드(`crewai-files`의 `File`, `ImageFile`, `PDFFile`)가 UI에서 자동으로 파일 업로드 드롭존으로 렌더링됩니다. 사용자는 파일을 드래그 앤 드롭할 수 있으며, 해당 파일은 flow의 상태에 자동으로 채워집니다. **API를 통한 파일 포함 시작:** diff --git a/docs/ko/enterprise/guides/kickoff-crew.mdx b/docs/ko/enterprise/guides/kickoff-crew.mdx index fcea67412..5aa1665b2 100644 --- a/docs/ko/enterprise/guides/kickoff-crew.mdx +++ b/docs/ko/enterprise/guides/kickoff-crew.mdx @@ -86,6 +86,60 @@ curl -H "Authorization: Bearer YOUR_CREW_TOKEN" https://your-crew-url.crewai.com 베어러 토큰은 crew의 상세 페이지의 Status 탭에서 확인할 수 있습니다. +## 파일 업로드 + +crew나 flow에 파일 타입 상태 필드(`crewai-files`의 `ImageFile`, `PDFFile`, 또는 `File` 사용)가 포함되어 있으면, 이러한 필드는 Run 탭 UI에서 자동으로 파일 업로드 드롭존으로 렌더링됩니다. 사용자는 파일을 직접 드래그 앤 드롭할 수 있으며, 플랫폼이 저장 및 에이전트 전달을 처리합니다. + +### Multipart Kickoff (권장) + +`multipart/form-data`를 사용하여 kickoff 요청과 함께 파일을 직접 전송합니다: + +```bash +curl -X POST https://your-deployment.crewai.com/kickoff \ + -H 'Authorization: Bearer YOUR_TOKEN' \ + -F 'inputs={"title": "Report"}' \ + -F 'document=@/path/to/file.pdf' +``` + +파일은 자동으로 저장되고 파일 객체로 변환됩니다. 에이전트는 프로바이더별 최적화(LLM 프로바이더에 따라 인라인 base64, 파일 업로드 API 또는 URL 참조)와 함께 파일을 수신합니다. + +### 파일 URL을 포함한 JSON Kickoff + +이미 URL에 호스팅된 파일이 있다면 `input_files`를 통해 전달합니다: + +```bash +curl -X POST https://your-deployment.crewai.com/kickoff \ + -H 'Authorization: Bearer YOUR_TOKEN' \ + -H 'Content-Type: application/json' \ + -d '{ + "inputs": {"title": "Report"}, + "input_files": {"document": "https://example.com/file.pdf"} + }' +``` + +### 분리된 업로드 + Kickoff + +먼저 파일을 업로드한 다음 URL로 참조합니다: + +```bash +# Step 1: Upload +curl -X POST https://your-deployment.crewai.com/files \ + -H 'Authorization: Bearer YOUR_TOKEN' \ + -F 'file=@/path/to/file.pdf' \ + -F 'field_name=document' +# Returns: {"url": "https://...", "field_name": "document"} + +# Step 2: Kickoff with URL +curl -X POST https://your-deployment.crewai.com/kickoff \ + -H 'Authorization: Bearer YOUR_TOKEN' \ + -H 'Content-Type: application/json' \ + -d '{"inputs": {"title": "Report"}, "input_files": {"document": "https://..."}}' +``` + + +파일 업로드는 crew와 flow 모두에서 동일하게 작동합니다. 상태 스키마에 파일 타입 필드를 정의하면 플랫폼 UI와 API가 자동으로 업로드를 처리합니다. + + ### 크루 상태 확인 작업을 실행하기 전에 크루가 정상적으로 실행되고 있는지 확인할 수 있습니다: diff --git a/docs/pt-BR/concepts/files.mdx b/docs/pt-BR/concepts/files.mdx index 91b5faba0..2223e28a3 100644 --- a/docs/pt-BR/concepts/files.mdx +++ b/docs/pt-BR/concepts/files.mdx @@ -117,20 +117,28 @@ task = Task( ### Com Flows -Passe arquivos para flows, que automaticamente herdam para crews: +Campos tipados como arquivo (`File`, `ImageFile`, `PDFFile`) no esquema de estado do seu flow servem como sinal para a interface da Plataforma. Quando implantado, esses campos são renderizados como zonas de upload de arquivos. Arquivos também podem ser passados via `input_files` na API. ```python from crewai.flow.flow import Flow, start -from crewai_files import ImageFile +from crewai_files import File, ImageFile +from pydantic import BaseModel -class AnalysisFlow(Flow): +class MyState(BaseModel): + document: File # Renders as file dropzone in Platform UI + cover_image: ImageFile # Image-specific dropzone + title: str = "" + +class AnalysisFlow(Flow[MyState]): @start() def analyze(self): + # Files are automatically populated in state + content = self.state.document.read() return self.analysis_crew.kickoff() flow = AnalysisFlow() result = flow.kickoff( - input_files={"image": ImageFile(source="data.png")} + input_files={"document": File(source="report.pdf")} ) ``` diff --git a/docs/pt-BR/concepts/flows.mdx b/docs/pt-BR/concepts/flows.mdx index f338eb837..ab57f08c2 100644 --- a/docs/pt-BR/concepts/flows.mdx +++ b/docs/pt-BR/concepts/flows.mdx @@ -175,27 +175,28 @@ Ao oferecer as duas opções de gerenciamento de estado, o CrewAI Flows permite ### Entradas de Arquivos -Ao usar estado estruturado, você pode incluir campos tipados como arquivo usando classes do `crewai-files`. Isso habilita uploads de arquivos como parte da entrada do seu flow: +Ao usar estado estruturado, você pode incluir campos tipados como arquivo usando classes do `crewai-files`. Campos tipados como arquivo no estado do seu flow servem como sinal para a Plataforma — eles são renderizados automaticamente como zonas de upload de arquivos na aba Run da interface e são preenchidos quando arquivos são enviados via Plataforma ou passados via `input_files` na API. ```python from crewai.flow.flow import Flow, start -from crewai_files import ImageFile, PDFFile +from crewai_files import File, ImageFile, PDFFile from pydantic import BaseModel -class OnboardingState(BaseModel): - document: PDFFile # File upload - cover_image: ImageFile # Image upload - title: str = "" # Text input +class MyState(BaseModel): + document: File # Renders as file dropzone in Platform + title: str = "" -class OnboardingFlow(Flow[OnboardingState]): +class MyFlow(Flow[MyState]): @start() - def process_upload(self): - # Access files directly from state - print(f"Processing: {self.state.title}") - return self.state.document + def process(self): + # File object is automatically populated in state + # when uploaded via Platform UI or passed via API + content = self.state.document.read() + print(f"Processing {self.state.title}: {len(content)} bytes") + return content ``` -Quando implantado na **Plataforma CrewAI**, campos tipados como arquivo são renderizados automaticamente como zonas de upload de arquivos na interface. Os usuários podem arrastar e soltar arquivos, que são então passados para o seu flow. +Quando implantado na **Plataforma CrewAI**, campos tipados como arquivo (`File`, `ImageFile`, `PDFFile` do `crewai-files`) são renderizados automaticamente como zonas de upload de arquivos na interface. Os usuários podem arrastar e soltar arquivos, que são então preenchidos no estado do seu flow. **Iniciando com arquivos via API:** diff --git a/docs/pt-BR/enterprise/guides/kickoff-crew.mdx b/docs/pt-BR/enterprise/guides/kickoff-crew.mdx index b5a0a1049..1746f9ec2 100644 --- a/docs/pt-BR/enterprise/guides/kickoff-crew.mdx +++ b/docs/pt-BR/enterprise/guides/kickoff-crew.mdx @@ -86,6 +86,60 @@ curl -H "Authorization: Bearer YOUR_CREW_TOKEN" https://your-crew-url.crewai.com Seu bearer token está disponível na aba Status na página de detalhes do seu crew. +## Upload de Arquivos + +Quando seu crew ou flow inclui campos de estado tipados como arquivo (usando `ImageFile`, `PDFFile` ou `File` do `crewai-files`), esses campos são renderizados automaticamente como zonas de upload de arquivos na aba Run da interface. Os usuários podem arrastar e soltar arquivos diretamente, e a Plataforma gerencia o armazenamento e entrega para seus agentes. + +### Kickoff Multipart (Recomendado) + +Envie arquivos diretamente com a requisição de kickoff usando `multipart/form-data`: + +```bash +curl -X POST https://your-deployment.crewai.com/kickoff \ + -H 'Authorization: Bearer YOUR_TOKEN' \ + -F 'inputs={"title": "Report"}' \ + -F 'document=@/path/to/file.pdf' +``` + +Os arquivos são armazenados automaticamente e convertidos em objetos de arquivo. O agente recebe o arquivo com otimização específica do provedor (base64 inline, API de upload de arquivo ou referência por URL dependendo do provedor LLM). + +### Kickoff JSON com URLs de Arquivos + +Se você já tem arquivos hospedados em URLs, passe-os via `input_files`: + +```bash +curl -X POST https://your-deployment.crewai.com/kickoff \ + -H 'Authorization: Bearer YOUR_TOKEN' \ + -H 'Content-Type: application/json' \ + -d '{ + "inputs": {"title": "Report"}, + "input_files": {"document": "https://example.com/file.pdf"} + }' +``` + +### Upload Separado + Kickoff + +Faça upload dos arquivos primeiro e depois referencie-os por URL: + +```bash +# Step 1: Upload +curl -X POST https://your-deployment.crewai.com/files \ + -H 'Authorization: Bearer YOUR_TOKEN' \ + -F 'file=@/path/to/file.pdf' \ + -F 'field_name=document' +# Returns: {"url": "https://...", "field_name": "document"} + +# Step 2: Kickoff with URL +curl -X POST https://your-deployment.crewai.com/kickoff \ + -H 'Authorization: Bearer YOUR_TOKEN' \ + -H 'Content-Type: application/json' \ + -d '{"inputs": {"title": "Report"}, "input_files": {"document": "https://..."}}' +``` + + +O upload de arquivos funciona da mesma forma tanto para crews quanto para flows. Defina campos tipados como arquivo no seu esquema de estado, e a interface da Plataforma e a API tratarão os uploads automaticamente. + + ### Verificando o Status do Crew Antes de executar operações, você pode verificar se seu crew está funcionando corretamente: