Vercel Functions 支持 30 分钟运行:把长 AI 任务放进 serverless 前要先决定什么
Vercel 在 2026 年 6 月 15 日宣布,Pro 和 Enterprise 团队的 Node.js 与 Python Functions 最长可运行 30 分钟。超过 800 秒的 duration 仍为 beta,并要求 Fluid Compute。这对长时间 LLM streaming、OCR、抽取、媒体处理和有边界的自动化很有价值。
发生了什么
Vercel 在 2026 年 6 月 15 日宣布,Pro 和 Enterprise 团队的 Node.js 与 Python Functions 最长可运行 30 分钟。超过 800 秒的 duration 仍为 beta,并要求 Fluid Compute。这对长时间 LLM streaming、OCR、抽取、媒体处理和有边界的自动化很有价值。
关键判断没有变:如果用户正在等待结果,长 Function 加 streaming 可能合适。如果任务需要失败后恢复、分步骤重试或长时间 sleep,应使用 Workflow 或 Queue。如果需要文件、浏览器会话、测试运行器或 agent workspace,Sandbox 更合适。
实践判断
| Runtime | Best fit | Watch out |
|---|---|---|
| Function | User waits, streaming matters, bounded input | Needs explicit maxDuration, cancellation, logs |
| Workflow / Queue | Retry, checkpoint, durable steps | Requires idempotency and state design |
| Sandbox | Browser, filesystem, tests, agent workspace | Needs 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.
来源
- Vercel Changelog: Functions can now run up to 30 minutes
- Vercel Docs: Configuring Maximum Duration
- Vercel Docs: Fluid Compute
- Vercel Docs: Functions usage and pricing
- Vercel Changelog: Workflow SDK supports TanStack Start
- Vercel Changelog: Sandbox can run up to 24 hours
- Reddit: long-running task questions on Vercel
- Reddit: Vercel runtime limit discussion for LLM apps