How to avoid timeout concerns on agentic deep research

I’m experiencing timeouts with Vercel Functions during long-running AI research tasks that can take up to ten minutes to complete.

Current Behavior: Vercel Functions time out after 15 seconds, leading to errors in my FastAPI backend

Expected Behavior: Functions should run for the duration of the research task, up to ten minutes, without timing out.

Architecture (in a single vercel deployment)
Frontend: Next.js application with a React progress view that streams updates.
Middleware: Next.js server-side layer handling authentication and streaming passthrough.
Backend: FastAPI service that maintains a single stream for the frontend and middleware, performing multiple iterations with Large Language Model (LLM) calls to OpenAI or Anthropic. Each iteration can take up to 2 minutes, totaling approximately 7 iterations.

Additional Context:

I understand that Vercel Functions have default timeout limits (15 seconds for Pro accounts) but can be configured up to 300 seconds (5 minutes) for Pro users and up to 900 seconds (15 minutes) for Enterprise users.  Despite these configurations, my functions still time out after 15 seconds. Given the nature of my AI research tasks, which can take up to ten minutes, I’m seeking guidance on how to extend the function timeout appropriately or alternative solutions to handle long-running processes within Vercel’s infrastructure.

Additionally, I noticed that Vercel’s AI SDK is designed to support AI applications, which often require longer processing times. This suggests that there should be a way to accommodate such use cases within Vercel’s platform.

Questions:

  1. Is it possible to configure Vercel Functions to support execution times of up to ten minutes?
  2. If not, what are the recommended approaches to handle long-running processes in a Vercel-hosted environment?
  3. Are there specific configurations or architectural changes needed to support streaming responses for extended durations?

I moved to the new Fluid Compute feature and set the max duration to 800s. All good!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.