Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

feat(alexandria): open discovery search and retrieve rollout gates (#4630)

Developers Digestb3cc08daf219
diff --git a/apps/api/src/controllers/v2/scrape-alexandria.ts b/apps/api/src/controllers/v2/scrape-alexandria.ts
index 51f4e63b3..6e2f91e0b 100644
--- a/apps/api/src/controllers/v2/scrape-alexandria.ts
+++ b/apps/api/src/controllers/v2/scrape-alexandria.ts
@@ -76,7 +76,14 @@ export async function providerScrapeController(
if (REQUEST_ID_PATTERN.test(requestId))
res.setHeader("x-request-id", requestId);
- if (!req.acuc?.flags?.exchangeRetrieve)
+ if (req.auth.team_id.startsWith("preview_keyless_")) {
+ return res.status(403).json({
+ success: false,
+ error: "An API key is required for provider tools.",
+ });
+ }
+
+ if (!req.acuc)
return res.status(403).json({
success: false,
error: "This endpoint is not enabled for this team.",
diff --git a/apps/api/src/controllers/v2/search.ts b/apps/api/src/controllers/v2/search.ts
index 3296b4dcd..5ea3b8d21 100644
--- a/apps/api/src/controllers/v2/search.ts
+++ b/apps/api/src/controllers/v2/search.ts
@@ -133,6 +133,15 @@ async function searchControllerInner(
const wantsTools = req.body.sources.some(
source => source.type === "alexandria",
);
+ if (
+ (wantsTools || req.body.domainTools) &&
+ req.auth.team_id.startsWith("preview_keyless_")
+ ) {
+ return res.status(403).json({
+ success: false,
+ error: "An API key is required for provider tools.",
+ });
+ }
if (wantsTools && !req.body.query.trim())
return res.status(400).json({
success: false,
@@ -140,15 +149,13 @@ async function searchControllerInner(
});
if (
(wantsTools || req.body.domainTools) &&
- (!req.acuc?.flags?.exchangeRetrieve ||
- teamForcedKind ||
+ (teamForcedKind ||
req.body.enterprise?.some(mode => mode === "zdr" || mode === "anon"))
)
return res.status(403).json({
success: false,
- error: !req.acuc?.flags?.exchangeRetrieve
- ? "The alexandria source is not enabled for this team."
- : "Provider discovery requires access and does not support zero data retention.",
+ error:
+ "Provider discovery requires access and does not support zero data retention.",
});
const requestedFormats = formatTypesOf(req.body.scrapeOptions?.formats);
diff --git a/apps/api/src/routes/exchange.ts b/apps/api/src/routes/exchange.ts
index cc5709fed..569333767 100644
--- a/apps/api/src/routes/exchange.ts
+++ b/apps/api/src/routes/exchange.ts
@@ -119,7 +119,7 @@ export const exchangeRouter = express.Router();
exchangeRouter.get(
"/discover{/*path}",
authMiddleware(RateLimiterMode.Labs),
- wrap(exchangeProxy(DISCOVER_TIMEOUT_MS)),
+ wrap(exchangeProxy(DISCOVER_TIMEOUT_MS, { requiresRetrieveFlag: false })),
);
// Both skills routes intentionally require the exchangeRetrieve flag during preview.
diff --git a/apps/api/src/search/execute.ts b/apps/api/src/search/execute.ts
index 86089f5e3..33dda1306 100644
--- a/apps/api/src/search/execute.ts
+++ b/apps/api/src/search/execute.ts
@@ -244,7 +244,6 @@ export async function executeSearch(
let toolsWarning: string | undefined;
if (
- flags?.exchangeRetrieve &&
!zeroDataRetention &&
!options.enterprise?.some(mode => mode === "zdr" || mode === "anon") &&
(wantsTools || options.domainTools)