Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
import { describe, it, expect, beforeAll } from "vitest";
import { DEEP_RESEARCH_LIVE, deepResearch, idmux, Identity } from "./lib";
import { describeIf, HAS_AI, TEST_PRODUCTION } from "../lib";
let identity: Identity;
beforeAll(async () => {
identity = await idmux({
name: "deep-research",
concurrency: 100,
tokens: 1000000,
});
}, 10000);
const describeDeepResearch = describeIf(
(TEST_PRODUCTION || HAS_AI) && DEEP_RESEARCH_LIVE,
);
describeDeepResearch("Deep Research", () => {
it("successfully completes a basic research query", async () => {
const query = "What is artificial intelligence?";
try {
const result = await deepResearch(
{
query: query,
maxDepth: 2,
maxUrls: 3,
timeLimit: 300, // 5 minutes in seconds
},
identity,
);
expect(result).toBeDefined();
expect(result.success).toBe(true);
expect(result.status).toBe("completed");
expect(result.data).toBeDefined();
expect(typeof result.data.finalAnalysis).toBe("string");
expect(result.data.finalAnalysis.length).toBeGreaterThan(0);
expect(Array.isArray(result.data.sources)).toBe(true);
expect(result.data.sources.length).toBeGreaterThan(0);
expect(Array.isArray(result.data.activities)).toBe(true);
expect(result.data.activities.length).toBeGreaterThan(0);
} catch (error) {
console.error("Deep research test failed with error:", error);
throw error;
}
}, 300000); // 5 minutes timeout to account for processing time
});