Vercel Functions 支援 30 分鐘執行:把長 AI 任務放進 serverless 前要先決定什麼

Tech

Vercel 在 2026 年 6 月 15 日宣布,Pro 與 Enterprise 團隊的 Node.js 與 Python Functions 最長可執行 30 分鐘。超過 800 秒的 duration 仍屬 beta,並需要 Fluid Compute。這對長時間 LLM streaming、OCR、抽取、媒體處理與有邊界的自動化很有用。

Vercel Functions 支援 30 分鐘執行:把長 AI 任務放進 serverless 前要先決定什麼
核心判斷沒有變:如果使用者正在等待結果,長 Function 搭配 streaming 可能適合。如果任務需要失敗後恢復、分步 retry 或長時間 sleep,應使用 Workflow 或 Queue。如果需要檔案、瀏覽器 session、測試 runner 或 agent workspace,Sandbox 較合適。

發生了什麼

Vercel 在 2026 年 6 月 15 日宣布,Pro 與 Enterprise 團隊的 Node.js 與 Python Functions 最長可執行 30 分鐘。超過 800 秒的 duration 仍屬 beta,並需要 Fluid Compute。這對長時間 LLM streaming、OCR、抽取、媒體處理與有邊界的自動化很有用。

核心判斷沒有變:如果使用者正在等待結果,長 Function 搭配 streaming 可能適合。如果任務需要失敗後恢復、分步 retry 或長時間 sleep,應使用 Workflow 或 Queue。如果需要檔案、瀏覽器 session、測試 runner 或 agent workspace,Sandbox 較合適。

實務判斷

RuntimeBest fitWatch out
FunctionUser waits, streaming matters, bounded inputNeeds explicit maxDuration, cancellation, logs
Workflow / QueueRetry, checkpoint, durable stepsRequires idempotency and state design
SandboxBrowser, filesystem, tests, agent workspaceNeeds permission and cleanup rules
檢查清單

Verify plan, runtime, beta availability and Fluid Compute settings.

Keep provider and database timeouts below the function maximum.

Add progress logs, correlation ids, cancellation and cost alerts.

Use idempotency keys before moving mutations into longer requests.

風險

上線前請確認 plan、runtime、beta 可用性、maxDuration、外部 API timeout、資料庫 timeout、進度日誌、取消機制、rate limit 與費用告警。更長的 timeout 不是 durable state machine。

Community discussions around Vercel timeouts show that developers have long been balancing streaming, queues and separate workers for LLM and long API work. Treat those discussions as product signal, while relying on the official Vercel changelog and docs for the actual limits.

來源