Skip to content

Scheduling infrastructure for absolutely everyone.

fix: reduce no-response errors in cal ai with increase of timeout threshold (#11845)

DexterStorey2c5cb6abe4ad
diff --git a/apps/ai/src/app/api/agent/route.ts b/apps/ai/src/app/api/agent/route.ts
index b707c9d56d5..e39f7329a59 100644
--- a/apps/ai/src/app/api/agent/route.ts
+++ b/apps/ai/src/app/api/agent/route.ts
@@ -5,6 +5,9 @@ import agent from "../../../utils/agent";
import sendEmail from "../../../utils/sendEmail";
import { verifyParseKey } from "../../../utils/verifyParseKey";
+// Allow agent loop to run for up to 5 minutes
+export const maxDuration = 300;
+
/**
* Launches a LangChain agent to process an incoming email,
* then sends the response to the user.
diff --git a/apps/ai/src/app/api/receive/route.ts b/apps/ai/src/app/api/receive/route.ts
index 1697bdd4a56..a988beb51b6 100644
--- a/apps/ai/src/app/api/receive/route.ts
+++ b/apps/ai/src/app/api/receive/route.ts
@@ -14,6 +14,10 @@ import now from "../../../utils/now";
import sendEmail from "../../../utils/sendEmail";
import { verifyParseKey } from "../../../utils/verifyParseKey";
+// Allow receive loop to run for up to 30 seconds
+// Why so long? the rate determining API call (getAvailability, getEventTypes) can take up to 15 seconds at peak times so we give it a little extra time to complete.
+export const maxDuration = 30;
+
/**
* Verifies email signature and app authorization,
* then hands off to booking agent.