@elizaos/plugin-research 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +400 -0
  2. package/dist/index.cjs +9366 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.js +9284 -0
  5. package/dist/index.js.map +1 -0
  6. package/package.json +80 -0
  7. package/src/__tests__/action-chaining.test.ts +532 -0
  8. package/src/__tests__/actions.test.ts +118 -0
  9. package/src/__tests__/cache-rate-limiter.test.ts +303 -0
  10. package/src/__tests__/content-extractors.test.ts +26 -0
  11. package/src/__tests__/deepresearch-bench-integration.test.ts +520 -0
  12. package/src/__tests__/deepresearch-bench-simplified.e2e.test.ts +290 -0
  13. package/src/__tests__/deepresearch-bench.e2e.test.ts +376 -0
  14. package/src/__tests__/e2e.test.ts +1870 -0
  15. package/src/__tests__/multi-benchmark-runner.ts +427 -0
  16. package/src/__tests__/providers.test.ts +156 -0
  17. package/src/__tests__/real-world.e2e.test.ts +788 -0
  18. package/src/__tests__/research-scenarios.test.ts +755 -0
  19. package/src/__tests__/research.e2e.test.ts +704 -0
  20. package/src/__tests__/research.test.ts +174 -0
  21. package/src/__tests__/search-providers.test.ts +174 -0
  22. package/src/__tests__/single-benchmark-runner.ts +735 -0
  23. package/src/__tests__/test-search-providers.ts +171 -0
  24. package/src/__tests__/verify-apis.test.ts +82 -0
  25. package/src/actions.ts +1677 -0
  26. package/src/benchmark/deepresearch-benchmark.ts +369 -0
  27. package/src/evaluation/research-evaluator.ts +444 -0
  28. package/src/examples/api-integration.md +498 -0
  29. package/src/examples/browserbase-integration.md +132 -0
  30. package/src/examples/debug-research-query.ts +162 -0
  31. package/src/examples/defi-code-scenarios.md +536 -0
  32. package/src/examples/defi-implementation-guide.md +454 -0
  33. package/src/examples/eliza-research-example.ts +142 -0
  34. package/src/examples/fix-renewable-energy-research.ts +209 -0
  35. package/src/examples/research-scenarios.md +408 -0
  36. package/src/examples/run-complete-renewable-research.ts +303 -0
  37. package/src/examples/run-deep-research.ts +352 -0
  38. package/src/examples/run-logged-research.ts +304 -0
  39. package/src/examples/run-real-research.ts +151 -0
  40. package/src/examples/save-research-output.ts +133 -0
  41. package/src/examples/test-file-logging.ts +199 -0
  42. package/src/examples/test-real-research.ts +67 -0
  43. package/src/examples/test-renewable-energy-research.ts +229 -0
  44. package/src/index.ts +28 -0
  45. package/src/integrations/cache.ts +128 -0
  46. package/src/integrations/content-extractors/firecrawl.ts +314 -0
  47. package/src/integrations/content-extractors/pdf-extractor.ts +350 -0
  48. package/src/integrations/content-extractors/playwright.ts +420 -0
  49. package/src/integrations/factory.ts +419 -0
  50. package/src/integrations/index.ts +18 -0
  51. package/src/integrations/rate-limiter.ts +181 -0
  52. package/src/integrations/search-providers/academic.ts +290 -0
  53. package/src/integrations/search-providers/exa.ts +205 -0
  54. package/src/integrations/search-providers/npm.ts +330 -0
  55. package/src/integrations/search-providers/pypi.ts +211 -0
  56. package/src/integrations/search-providers/serpapi.ts +277 -0
  57. package/src/integrations/search-providers/serper.ts +358 -0
  58. package/src/integrations/search-providers/stagehand-google.ts +87 -0
  59. package/src/integrations/search-providers/tavily.ts +187 -0
  60. package/src/processing/relevance-analyzer.ts +353 -0
  61. package/src/processing/research-logger.ts +450 -0
  62. package/src/processing/result-processor.ts +372 -0
  63. package/src/prompts/research-prompts.ts +419 -0
  64. package/src/providers/cacheProvider.ts +164 -0
  65. package/src/providers.ts +173 -0
  66. package/src/service.ts +2588 -0
  67. package/src/services/swe-bench.ts +286 -0
  68. package/src/strategies/research-strategies.ts +790 -0
  69. package/src/types/pdf-parse.d.ts +34 -0
  70. package/src/types.ts +551 -0
  71. package/src/verification/claim-verifier.ts +443 -0
@@ -0,0 +1,454 @@
1
+ # DeFi Research Implementation Guide
2
+
3
+ ## Overview
4
+
5
+ This guide demonstrates how to implement and use the Deep Research plugin's DeFi-specific scenarios and actions. The plugin provides specialized research capabilities for DeFi security, yield farming, MEV, gas optimization, cross-chain bridges, and more.
6
+
7
+ ## Quick Start
8
+
9
+ ### 1. Basic DeFi Security Research
10
+
11
+ ```typescript
12
+ import { IAgentRuntime } from '@elizaos/core';
13
+ import { executeDeFiScenario, DEFI_SCENARIOS } from '@elizaos/plugin-research/scenarios/defi-scenarios';
14
+
15
+ async function securityResearch(runtime: IAgentRuntime) {
16
+ // Start a security research project
17
+ const project = await executeDeFiScenario(
18
+ runtime,
19
+ DEFI_SCENARIOS.SMART_CONTRACT_SECURITY,
20
+ 'Aave v3 reentrancy vulnerabilities 2024'
21
+ );
22
+
23
+ console.log(`Research started: ${project.id}`);
24
+
25
+ // Monitor progress
26
+ const service = runtime.getService('research');
27
+ const status = await service.getProject(project.id);
28
+ console.log(`Current phase: ${status.phase}`);
29
+ }
30
+ ```
31
+
32
+ ### 2. Yield Farming Analysis
33
+
34
+ ```typescript
35
+ async function yieldAnalysis(runtime: IAgentRuntime) {
36
+ const project = await executeDeFiScenario(
37
+ runtime,
38
+ DEFI_SCENARIOS.YIELD_FARMING_OPTIMIZATION,
39
+ 'Arbitrum Optimism stablecoin yield farming low risk'
40
+ );
41
+
42
+ // Wait for completion
43
+ await new Promise(resolve => setTimeout(resolve, 30000));
44
+
45
+ // Get the report
46
+ const report = generateScenarioReport(
47
+ DEFI_SCENARIOS.YIELD_FARMING_OPTIMIZATION,
48
+ project
49
+ );
50
+
51
+ console.log(report);
52
+ }
53
+ ```
54
+
55
+ ## Available DeFi Actions
56
+
57
+ ### 1. defi_security_research
58
+
59
+ Conducts deep security analysis of DeFi protocols.
60
+
61
+ ```typescript
62
+ // Example usage in chat
63
+ User: "Research security vulnerabilities in Aave v3"
64
+ Assistant: "I'll conduct a comprehensive security analysis of Aave v3."
65
+ // Triggers defi_security_research action
66
+ ```
67
+
68
+ ### 2. analyze_yield_farming
69
+
70
+ Analyzes yield farming opportunities across chains.
71
+
72
+ ```typescript
73
+ // Example usage
74
+ User: "Find the best yield farming opportunities on Arbitrum and Optimism"
75
+ Assistant: "I'll analyze yield farming opportunities on Arbitrum and Optimism."
76
+ // Triggers analyze_yield_farming action
77
+ ```
78
+
79
+ ### 3. research_mev
80
+
81
+ Researches MEV strategies and protection mechanisms.
82
+
83
+ ```typescript
84
+ // Example usage
85
+ User: "Research MEV protection strategies for DEX trading"
86
+ Assistant: "I'll research MEV protection strategies and their implementations."
87
+ // Triggers research_mev action
88
+ ```
89
+
90
+ ### 4. analyze_gas_optimization
91
+
92
+ Provides Solidity gas optimization techniques.
93
+
94
+ ```typescript
95
+ // Example usage
96
+ User: "Show me Solidity gas optimization techniques"
97
+ Assistant: "I'll research advanced gas optimization techniques for Solidity."
98
+ // Triggers analyze_gas_optimization action
99
+ ```
100
+
101
+ ### 5. analyze_bridge_security
102
+
103
+ Analyzes cross-chain bridge security.
104
+
105
+ ```typescript
106
+ // Example usage
107
+ User: "Analyze LayerZero bridge security architecture"
108
+ Assistant: "I'll analyze LayerZero's cross-chain bridge security architecture."
109
+ // Triggers analyze_bridge_security action
110
+ ```
111
+
112
+ ### 6. comprehensive_defi_analysis
113
+
114
+ Runs analysis across multiple DeFi areas.
115
+
116
+ ```typescript
117
+ // Example usage
118
+ User: "Do a comprehensive DeFi analysis covering security, yield, and MEV"
119
+ Assistant: "I'll conduct a comprehensive DeFi analysis across multiple areas."
120
+ // Triggers comprehensive_defi_analysis action
121
+ ```
122
+
123
+ ### 7. setup_defi_monitoring
124
+
125
+ Sets up real-time monitoring for DeFi events.
126
+
127
+ ```typescript
128
+ // Example usage
129
+ User: "Set up monitoring for DeFi security incidents"
130
+ Assistant: "I'll set up real-time monitoring for DeFi security incidents."
131
+ // Triggers setup_defi_monitoring action
132
+ ```
133
+
134
+ ## Advanced Implementation Examples
135
+
136
+ ### Custom Security Analysis with Report Generation
137
+
138
+ ```typescript
139
+ import {
140
+ executeDeFiScenario,
141
+ DEFI_SCENARIOS,
142
+ generateScenarioReport
143
+ } from '@elizaos/plugin-research/scenarios/defi-scenarios';
144
+
145
+ async function customSecurityAnalysis(runtime: IAgentRuntime) {
146
+ // Execute security research with custom query
147
+ const project = await executeDeFiScenario(
148
+ runtime,
149
+ DEFI_SCENARIOS.SMART_CONTRACT_SECURITY,
150
+ 'Flash loan reentrancy attacks Compound Finance 2024'
151
+ );
152
+
153
+ // Wait for research to complete
154
+ let completed = false;
155
+ while (!completed) {
156
+ await new Promise(resolve => setTimeout(resolve, 5000));
157
+ const status = await runtime.getService('research').getProject(project.id);
158
+ completed = status.status === 'completed';
159
+ }
160
+
161
+ // Generate specialized security report
162
+ const report = generateScenarioReport(
163
+ DEFI_SCENARIOS.SMART_CONTRACT_SECURITY,
164
+ project
165
+ );
166
+
167
+ // Extract critical findings
168
+ const criticalFindings = project.findings
169
+ .filter(f => f.relevance > 0.8)
170
+ .map(f => ({
171
+ content: f.content,
172
+ source: f.sourceId,
173
+ relevance: f.relevance
174
+ }));
175
+
176
+ return {
177
+ report,
178
+ criticalFindings,
179
+ vulnerabilitiesFound: criticalFindings.length
180
+ };
181
+ }
182
+ ```
183
+
184
+ ### Batch DeFi Research
185
+
186
+ ```typescript
187
+ import { executeDeFiScenarioBatch } from '@elizaos/plugin-research/scenarios/defi-scenarios';
188
+
189
+ async function batchDeFiResearch(runtime: IAgentRuntime) {
190
+ // Run multiple scenarios in batch
191
+ const scenarios = [
192
+ DEFI_SCENARIOS.SMART_CONTRACT_SECURITY,
193
+ DEFI_SCENARIOS.YIELD_FARMING_OPTIMIZATION,
194
+ DEFI_SCENARIOS.MEV_RESEARCH,
195
+ DEFI_SCENARIOS.GAS_OPTIMIZATION
196
+ ];
197
+
198
+ const results = await executeDeFiScenarioBatch(runtime, scenarios);
199
+
200
+ // Process results
201
+ for (const [scenario, project] of results) {
202
+ console.log(`Scenario: ${scenario}`);
203
+ console.log(`Findings: ${project.findings.length}`);
204
+ console.log(`Sources: ${project.sources.length}`);
205
+ }
206
+
207
+ return results;
208
+ }
209
+ ```
210
+
211
+ ### Real-Time DeFi Monitoring
212
+
213
+ ```typescript
214
+ import { setupDeFiMonitoring } from '@elizaos/plugin-research/scenarios/defi-scenarios';
215
+
216
+ async function monitorDeFiSecurity(runtime: IAgentRuntime) {
217
+ const monitoring = await setupDeFiMonitoring(runtime, {
218
+ scenarios: [
219
+ DEFI_SCENARIOS.SMART_CONTRACT_SECURITY,
220
+ DEFI_SCENARIOS.MEV_RESEARCH
221
+ ],
222
+ interval: 5 * 60 * 1000, // 5 minutes
223
+ alertThreshold: 0.8, // High relevance only
224
+ onAlert: (project, finding) => {
225
+ console.log('🚨 DEFI ALERT:', {
226
+ topic: project.query,
227
+ relevance: finding.relevance,
228
+ finding: finding.content.substring(0, 200)
229
+ });
230
+
231
+ // Send alert to Discord/Telegram/etc
232
+ notifySecurityTeam({
233
+ severity: 'high',
234
+ protocol: extractProtocolFromQuery(project.query),
235
+ finding: finding
236
+ });
237
+ }
238
+ });
239
+
240
+ // Stop monitoring after 24 hours
241
+ setTimeout(() => {
242
+ clearInterval(monitoring);
243
+ console.log('Monitoring stopped');
244
+ }, 24 * 60 * 60 * 1000);
245
+ }
246
+ ```
247
+
248
+ ### Comprehensive Report Generation
249
+
250
+ ```typescript
251
+ import { generateComprehensiveDeFiReport } from '@elizaos/plugin-research/scenarios/defi-scenarios';
252
+
253
+ async function generateFullReport(runtime: IAgentRuntime) {
254
+ const scenarios = [
255
+ DEFI_SCENARIOS.SMART_CONTRACT_SECURITY,
256
+ DEFI_SCENARIOS.YIELD_FARMING_OPTIMIZATION,
257
+ DEFI_SCENARIOS.MEV_RESEARCH,
258
+ DEFI_SCENARIOS.GAS_OPTIMIZATION,
259
+ DEFI_SCENARIOS.CROSS_CHAIN_BRIDGES
260
+ ];
261
+
262
+ const report = await generateComprehensiveDeFiReport(runtime, scenarios);
263
+
264
+ // Save report to file
265
+ const fs = require('fs');
266
+ fs.writeFileSync(
267
+ `defi-report-${new Date().toISOString()}.md`,
268
+ report
269
+ );
270
+
271
+ // Extract key metrics
272
+ const metrics = extractMetricsFromReport(report);
273
+ console.log('Report Metrics:', metrics);
274
+
275
+ return report;
276
+ }
277
+ ```
278
+
279
+ ## Integration with ElizaOS Agents
280
+
281
+ ### Agent Configuration
282
+
283
+ ```typescript
284
+ // agent-config.ts
285
+ import { researchPlugin } from '@elizaos/plugin-research';
286
+
287
+ export default {
288
+ name: 'DeFi Research Agent',
289
+ plugins: [researchPlugin],
290
+ settings: {
291
+ voice: {
292
+ model: 'en_US-male-medium'
293
+ }
294
+ },
295
+ bio: [
296
+ 'Expert in DeFi security analysis and research',
297
+ 'Specializes in smart contract vulnerabilities',
298
+ 'Provides yield farming optimization strategies',
299
+ 'Analyzes MEV and cross-chain bridge security'
300
+ ],
301
+ modelProvider: 'openai',
302
+ model: 'gpt-4-turbo-preview'
303
+ };
304
+ ```
305
+
306
+ ### Custom Agent Actions
307
+
308
+ ```typescript
309
+ // custom-defi-agent.ts
310
+ import { Agent } from '@elizaos/core';
311
+ import { researchPlugin } from '@elizaos/plugin-research';
312
+
313
+ class DeFiResearchAgent extends Agent {
314
+ async onMessage(message: Message) {
315
+ // Custom logic for DeFi-specific messages
316
+ if (message.content.includes('vulnerability') ||
317
+ message.content.includes('exploit')) {
318
+ // Automatically trigger security research
319
+ await this.runtime.processAction(
320
+ 'defi_security_research',
321
+ message
322
+ );
323
+ }
324
+
325
+ // Continue with normal processing
326
+ return super.onMessage(message);
327
+ }
328
+
329
+ async generateDailyReport() {
330
+ // Generate daily DeFi security report
331
+ const scenarios = [
332
+ DEFI_SCENARIOS.SMART_CONTRACT_SECURITY,
333
+ DEFI_SCENARIOS.MEV_RESEARCH
334
+ ];
335
+
336
+ const report = await generateComprehensiveDeFiReport(
337
+ this.runtime,
338
+ scenarios
339
+ );
340
+
341
+ // Post to Discord/Telegram
342
+ await this.postToChannel(report);
343
+ }
344
+ }
345
+ ```
346
+
347
+ ## Best Practices
348
+
349
+ ### 1. Query Optimization
350
+
351
+ ```typescript
352
+ // Good: Specific and targeted
353
+ const query = "Aave v3 flash loan reentrancy vulnerabilities 2024";
354
+
355
+ // Less effective: Too broad
356
+ const query = "DeFi vulnerabilities";
357
+ ```
358
+
359
+ ### 2. Error Handling
360
+
361
+ ```typescript
362
+ try {
363
+ const project = await executeDeFiScenario(
364
+ runtime,
365
+ DEFI_SCENARIOS.SMART_CONTRACT_SECURITY,
366
+ query
367
+ );
368
+ } catch (error) {
369
+ if (error.message.includes('rate limit')) {
370
+ // Wait and retry
371
+ await new Promise(resolve => setTimeout(resolve, 60000));
372
+ return retry();
373
+ }
374
+ throw error;
375
+ }
376
+ ```
377
+
378
+ ### 3. Resource Management
379
+
380
+ ```typescript
381
+ // Use batching for multiple scenarios
382
+ const results = await executeDeFiScenarioBatch(runtime, scenarios);
383
+
384
+ // Add delays between requests
385
+ for (const scenario of scenarios) {
386
+ await executeDeFiScenario(runtime, scenario);
387
+ await new Promise(resolve => setTimeout(resolve, 1000));
388
+ }
389
+ ```
390
+
391
+ ### 4. Result Caching
392
+
393
+ ```typescript
394
+ const cache = new Map();
395
+
396
+ async function getCachedOrResearch(scenario, query) {
397
+ const cacheKey = `${scenario}-${query}`;
398
+
399
+ if (cache.has(cacheKey)) {
400
+ const cached = cache.get(cacheKey);
401
+ if (Date.now() - cached.timestamp < 3600000) { // 1 hour
402
+ return cached.data;
403
+ }
404
+ }
405
+
406
+ const result = await executeDeFiScenario(runtime, scenario, query);
407
+ cache.set(cacheKey, {
408
+ data: result,
409
+ timestamp: Date.now()
410
+ });
411
+
412
+ return result;
413
+ }
414
+ ```
415
+
416
+ ## Troubleshooting
417
+
418
+ ### Common Issues
419
+
420
+ 1. **Rate Limiting**
421
+ - Add delays between requests
422
+ - Use batch operations
423
+ - Implement exponential backoff
424
+
425
+ 2. **Memory Usage**
426
+ - Process large reports in chunks
427
+ - Clear completed projects periodically
428
+ - Use streaming for real-time monitoring
429
+
430
+ 3. **Timeout Issues**
431
+ - Increase timeout for complex scenarios
432
+ - Break down large queries
433
+ - Use phase-based progress tracking
434
+
435
+ ### Debug Mode
436
+
437
+ ```typescript
438
+ // Enable debug logging
439
+ process.env.DEBUG = 'eliza:plugin-research:*';
440
+
441
+ // Track research progress
442
+ const service = runtime.getService('research');
443
+ service.on('phaseChange', (project, phase) => {
444
+ console.log(`Project ${project.id} entered phase: ${phase}`);
445
+ });
446
+ ```
447
+
448
+ ## API Reference
449
+
450
+ See the [API documentation](./api-integration.md) for detailed method signatures and parameters.
451
+
452
+ ## Examples Repository
453
+
454
+ For more examples, visit: https://github.com/elizaos/plugin-research-examples
@@ -0,0 +1,142 @@
1
+ /**
2
+ * Example: Using the Research Plugin with ElizaOS
3
+ *
4
+ * This example shows how the research plugin works within ElizaOS
5
+ */
6
+
7
+ // Example character configuration with research plugin
8
+ export const researchAgentConfig = {
9
+ name: 'ResearchBot',
10
+ description: 'An AI research assistant specialized in deep web research',
11
+ plugins: [
12
+ '@elizaos/plugin-sqlite',
13
+ '@elizaos/plugin-stagehand', // Optional but recommended
14
+ '@elizaos/plugin-research',
15
+ ],
16
+ settings: {
17
+ // Optional: Premium search providers (in order of preference)
18
+ TAVILY_API_KEY: process.env.TAVILY_API_KEY,
19
+ SERPER_API_KEY: process.env.SERPER_API_KEY,
20
+
21
+ // Optional: Premium content extraction
22
+ FIRECRAWL_API_KEY: process.env.FIRECRAWL_API_KEY,
23
+
24
+ // Optional but recommended: Browserbase for enhanced scraping
25
+ BROWSERBASE_API_KEY: process.env.BROWSERBASE_API_KEY,
26
+ BROWSERBASE_PROJECT_ID: process.env.BROWSERBASE_PROJECT_ID,
27
+ },
28
+ };
29
+
30
+ /**
31
+ * Example conversations with the research agent:
32
+ */
33
+
34
+ // 1. Start a research project
35
+ const example1 = {
36
+ user: 'Can you research the latest AI breakthroughs in 2024?',
37
+ agent:
38
+ "I'll start researching the latest AI breakthroughs in 2024 for you. Let me conduct a comprehensive search and analysis.",
39
+ // Agent internally calls: start_research action
40
+ result:
41
+ "Research project started with ID: abc-123. I'm now searching for information, analyzing sources, and will compile a detailed report.",
42
+ };
43
+
44
+ // 2. Check research status
45
+ const example2 = {
46
+ user: "How's the research going?",
47
+ agent: 'Let me check the status of your research project.',
48
+ // Agent internally calls: check_research_status action
49
+ result:
50
+ "Your research on 'latest AI breakthroughs in 2024' is 60% complete. Currently in the analyzing phase. I've found 15 sources and am processing the findings.",
51
+ };
52
+
53
+ // 3. Get research report
54
+ const example3 = {
55
+ user: 'Can I see the research report?',
56
+ agent: "I'll retrieve the research report for you.",
57
+ // Agent internally calls: get_research_report action
58
+ result: `# Research Report: Latest AI Breakthroughs in 2024
59
+
60
+ ## Executive Summary
61
+ 2024 has seen remarkable advances in AI, particularly in multimodal models, efficiency improvements, and reasoning capabilities...
62
+
63
+ ## Key Findings
64
+ 1. **GPT-5 and Claude 3**: Next-gen models with enhanced reasoning
65
+ 2. **Multimodal Integration**: Seamless text, image, and video understanding
66
+ 3. **Efficiency Gains**: 10x reduction in compute requirements...
67
+
68
+ ## Sources
69
+ - [1] "2024 AI Breakthroughs" - MIT Technology Review
70
+ - [2] "The Year in AI" - Nature Journal
71
+ ...`,
72
+ };
73
+
74
+ // 4. DeFi specialized research
75
+ const example4 = {
76
+ user: 'Research the best DeFi yield farming strategies',
77
+ agent: "I'll conduct specialized research on DeFi yield farming strategies for you.",
78
+ // Agent internally calls: research_defi_yield action
79
+ result:
80
+ "Starting DeFi-focused research on yield farming strategies. I'll analyze protocols, APYs, risks, and provide actionable insights.",
81
+ };
82
+
83
+ /**
84
+ * Behind the scenes, the plugin will:
85
+ *
86
+ * 1. Use the best available search provider:
87
+ * - Tavily (if API key provided) - AI-optimized search
88
+ * - Serper (if API key provided) - Google results
89
+ * - Stagehand/Google (if browserbase available) - Bypasses blocks
90
+ * - Academic providers (Semantic Scholar, arXiv) - For research papers
91
+ *
92
+ * 2. Use the best available content extractor:
93
+ * - Stagehand (if browserbase available) - AI extraction, bypasses blocks
94
+ * - Firecrawl (if API key provided) - Fast API-based extraction
95
+ * - Playwright (always available) - May get blocked
96
+ *
97
+ * 3. Process through research phases:
98
+ * - Planning: Create research strategy
99
+ * - Searching: Find relevant sources
100
+ * - Analyzing: Extract and rate content
101
+ * - Synthesizing: Combine findings
102
+ * - Reporting: Generate final report
103
+ */
104
+
105
+ /**
106
+ * Configuration Tips:
107
+ *
108
+ * 1. For best results, use browserbase:
109
+ * - Bypasses most anti-bot measures
110
+ * - Handles CAPTCHAs automatically
111
+ * - Uses Google via Stagehand
112
+ *
113
+ * 2. For faster results without browserbase:
114
+ * - Use Tavily or Serper for search
115
+ * - Use Firecrawl for content extraction
116
+ *
117
+ * 3. The free tier (no API keys) still works:
118
+ * - Mock provider returns empty results
119
+ * - Playwright for extraction
120
+ * - Limited functionality but no errors
121
+ */
122
+
123
+ /**
124
+ * Search Providers:
125
+ * - Tavily (if API key present) - Best overall quality
126
+ * - Serper (if API key present) - Good alternative
127
+ * - Semantic Scholar (if API key present) - Academic papers
128
+ * - Fallback mock provider if none configured
129
+ *
130
+ * Content Extractors:
131
+ * - Stagehand/Browserbase (if service available) - Most reliable
132
+ * - Firecrawl (if API key present) - Good cloud option
133
+ * - Playwright (always available) - Local fallback, may get blocked
134
+ *
135
+ * Result Quality:
136
+ * 3. Stagehand + Serper:
137
+ * - Uses Google via Serper
138
+ * - Browserbase for reliable extraction
139
+ * 4. Playwright + Tavily:
140
+ * - Tavily for search
141
+ * - Playwright for extraction (may encounter blocks)
142
+ */