Skip to content

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

Add end-to-end test for deep research functionality (ENG-2627) (#1760)

devin-ai-integration[bot]b5b6ca0a3223
diff --git a/apps/api/src/__tests__/snips/deep-research.test.ts b/apps/api/src/__tests__/snips/deep-research.test.ts
new file mode 100644
index 000000000..5ba89c821
--- /dev/null
+++ b/apps/api/src/__tests__/snips/deep-research.test.ts
@@ -0,0 +1,47 @@
+import { describe, it, expect, beforeAll } from '@jest/globals';
+import { deepResearch, idmux, Identity } from './lib';
+
+let identity: Identity;
+
+beforeAll(async () => {
+ identity = await idmux({
+ name: "deep-research",
+ concurrency: 100,
+ tokens: 1000000,
+ });
+}, 10000);
+
+describe('Deep Research', () => {
+ if (!process.env.TEST_SUITE_SELF_HOSTED || process.env.OPENAI_API_KEY || process.env.OLLAMA_BASE_URL) {
+ 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
+ } else {
+ it("dummy test", () => {
+ expect(true).toBe(true);
+ });
+ }
+});