The @onegenui/deep-research package provides state-of-the-art web research capabilities with three effort levels: Standard, Deep, and Max. It follows hexagonal architecture principles for clean separation of concerns and maximum testability.
- 3 Effort Levels: Standard (~3 min), Deep (~10 min), Max (~30 min)
- Multi-Source Search: Academic (Semantic Scholar, arXiv), News, General Web
- Parallel Execution: Concurrent source fetching with configurable limits
- Authentication Support: Cookie, API Key, OAuth for premium sources
- Rich Content Output: Structured reports with citations, knowledge graphs, mind maps
- Streaming Events: Real-time progress updates during research
pnpm add @onegenui/deep-researchsrc/
├── domain/ # Zod schemas for all data types
├── ports/ # Interface definitions
├── adapters/ # Port implementations
├── use-cases/ # Business logic orchestration
└── tools.ts # MCP tool definition
| Port | Purpose |
|---|---|
DeepSearchPort |
Web search operations |
ContentScraperPort |
Content extraction |
ContentAnalyzerPort |
LLM-based content analysis |
SourceRankerPort |
Credibility scoring |
KnowledgeGraphPort |
Entity relationships |
SynthesizerPort |
Report generation |
AuthPort |
Authentication management |
| Adapter | Description |
|---|---|
DeepSearchAdapter |
DuckDuckGo HTML search (no API key) |
AcademicSearchAdapter |
Semantic Scholar + arXiv |
NewsSearchAdapter |
Google News RSS |
LightweightScraperAdapter |
HTTP-only content extraction |
ContentAnalyzerAdapter |
LLM entity/claim extraction |
SynthesizerAdapter |
LLM report generation |
KnowledgeGraphAdapter |
Entity aggregation |
AuthManagerAdapter |
Unified auth coordination |
import { DeepResearchUseCase, EFFORT_PRESETS } from "@onegenui/deep-research";
const useCase = new DeepResearchUseCase({
search: new DeepSearchAdapter(),
scraper: new LightweightScraperAdapter(),
analyzer: new ContentAnalyzerAdapter(llmPort),
ranker: new SourceRankerAdapter(),
knowledgeGraph: new KnowledgeGraphAdapter(),
synthesizer: new SynthesizerAdapter(llmPort),
});
// Stream research events
for await (const event of useCase.research("Impact of AI on healthcare", {
effort: "deep",
})) {
console.log(event.type, event.data);
}const generator = useCase.research(query, { effort: "standard" });
for await (const event of generator) {
switch (event.type) {
case "phase_started":
console.log(`Starting: ${event.phase}`);
break;
case "source_found":
console.log(`Found: ${event.source.title}`);
break;
case "progress":
console.log(`Progress: ${event.progress}%`);
break;
case "completed":
console.log("Research complete!");
break;
}
}
// Get final result
const result = await generator.next();
console.log(result.value); // ResearchResultimport { AuthManagerAdapter } from "@onegenui/deep-research";
const authManager = new AuthManagerAdapter();
// Add API key for Semantic Scholar
authManager.getApiKeyAdapter().setApiKey("semantic_scholar", "your-api-key");
// Import cookies from browser export
const cookieAdapter = authManager.getCookieAdapter();
await cookieAdapter.importFromJson(cookieJson);
// Check authentication status
const isAuthed = await authManager.isAuthenticated("twitter");| Level | Max Steps | Timeout | Sources | Parallelism | Quality Threshold |
|---|---|---|---|---|---|
| Standard | 50 | 5 min | 25 | 10 | 0.75 |
| Deep | 100 | 15 min | 50 | 15 | 0.80 |
| Max | 200 | 45 min | 100 | 20 | 0.90 |
The package integrates with @onegenui/react via the DeepResearchSlice:
import { useDeepResearch } from "@onegenui/react";
function ResearchPanel() {
const { startResearch, stopResearch, isResearching, progress } = useDeepResearch();
return (
<div>
<button onClick={() => startResearch("my query")}>
Start Research
</button>
{isResearching && <p>Progress: {progress}%</p>}
</div>
);
}From @onegenui/chat:
DeepResearchSettings- Settings panel with effort level selectorDeepResearchProgress- Real-time progress indicatorDeepResearchReport- Structured research report display
-
HTTP-Only Scraping: The
LightweightScraperAdapteruses native fetch for maximum performance, avoiding browser overhead. -
LRU Caching: All adapters implement LRU caching with configurable TTLs to reduce redundant requests.
-
Parallel Execution: The orchestrator uses
p-limitfor controlled concurrency based on effort level. -
Early Stopping: Research stops early when quality threshold is reached, saving time and resources.
The package exports an MCP tool for integration with AI agents:
import { deepResearchTool } from "@onegenui/deep-research/tools";
// Register with your MCP server
mcpServer.registerTool(deepResearchTool);This package is cross-platform compatible with React Native with the following considerations:
-
uuidpolyfill required — Several adapters useuuidv4 which relies oncrypto.getRandomValues(). On React Native, install and import the polyfill before any other import from this package:npm install react-native-get-random-values
// Must be the very first import in your app entry point import "react-native-get-random-values"; import { createDeepResearch } from "@onegenui/deep-research";
-
@onegenui/web-searchdependency — Thedeep-research-agentimports from@onegenui/web-search. If web-search's barrel export pulls in Node-specific modules (e.g.,fs,child_process), the web-search package must provide React Native-safe exports. The specific adapters used (OneCrawlSearchAdapter,OneCrawlScraperAdapter) are themselves platform-agnostic. -
CLI excluded — The
cli.tsentry point uses Node APIs (process.argv) and is not exported from the library entry point. It is only available via thebinfield for command-line use. -
p-limitandlru-cache— Both are pure JavaScript, fully platform-agnostic.
MIT