
Deep Research
STDIOAI-powered research assistant using Gemini LLMs for deep, iterative research exploration.
AI-powered research assistant using Gemini LLMs for deep, iterative research exploration.
Your AI-Powered Research Assistant. Conduct iterative, deep research using search engines, web scraping, and Gemini LLMs, all within a lightweight and understandable codebase.
This tool uses Firecrawl for efficient web data extraction and Gemini for advanced language understanding and report generation.
The goal of this project is to provide the simplest yet most effective implementation of a deep research agent. It's designed to be easily understood, modified, and extended, aiming for a codebase under 500 lines of code (LoC).
Key Features:
flowchart TB subgraph Input Q[User Query] B[Breadth Parameter] D[Depth Parameter] end DR[Deep Research] --> SQ[SERP Queries] --> PR[Process Results] subgraph Results[Results] direction TB NL((Learnings)) ND((Directions)) end PR --> NL PR --> ND DP{depth > 0?} RD["Next Direction: - Prior Goals - New Questions - Learnings"] MR[Markdown Report] %% Main Flow Q & B & D --> DR %% Results to Decision NL & ND --> DP %% Circular Flow DP -->|Yes| RD RD -->|New Context| DR %% Final Output DP -->|No| MR %% Styling classDef input fill:#7bed9f,stroke:#2ed573,color:black classDef process fill:#70a1ff,stroke:#1e90ff,color:black classDef recursive fill:#ffa502,stroke:#ff7f50,color:black classDef output fill:#ff4757,stroke:#ff6b81,color:black classDef results fill:#a8e6cf,stroke:#3b7a57,color:black class Q,B,D input class DR,SQ,PR process class DP,RD recursive class MR output class NL,ND results
What are Persona Agents?
In deep-research
, we utilize the concept of "persona agents" to guide the behavior of the Gemini language models. Instead of simply prompting the LLM with a task, we imbue it with a specific role, skills, personality, communication style, and values. This approach helps to:
Examples of Personas in use:
By leveraging persona agents, deep-research
aims to achieve more targeted, consistent, and high-quality research outcomes from the Gemini language models.
Clone the repository:
git clone [your-repo-link-here]
Install dependencies:
npm install
Set up environment variables: Create a .env.local
file in the project root and add your API keys:
GEMINI_API_KEY="your_gemini_key" FIRECRAWL_KEY="your_firecrawl_key" # Optional: If you want to use your self-hosted Firecrawl instance # FIRECRAWL_BASE_URL=http://localhost:3002
Build the project:
npm run build
To run deep-research
as an MCP tool, start the MCP server:
node --env-file .env.local dist/mcp-server.js
You can then invoke the deep-research
tool from any MCP-compatible agent using the following parameters:
query
(string, required): The research query.depth
(number, optional, 1-5): Research depth (default: moderate).breadth
(number, optional, 1-5): Research breadth (default: moderate).existingLearnings
(string[], optional): Pre-existing research findings to guide research.Example MCP Tool Invocation (TypeScript):
const mcp = new ModelContextProtocolClient(); // Assuming MCP client is initialized async function invokeDeepResearchTool() { try { const result = await mcp.invoke("deep-research", { query: "Explain the principles of blockchain technology", depth: 2, breadth: 4 }); if (result.isError) { console.error("MCP Tool Error:", result.content[0].text); } else { console.log("Research Report:\n", result.content[0].text); console.log("Sources:\n", result.metadata.sources); } } catch (error) { console.error("MCP Invoke Error:", error); } } invokeDeepResearchTool();
To run deep-research
directly from the command line:
npm run start "your research query"
Example:
npm run start "what are latest developments in ai research agents"
For interactive testing and debugging of the MCP server, use the MCP Inspector:
npx @modelcontextprotocol/inspector node --env-file .env.local dist/mcp-server.js
MIT License - Free and Open Source. Use it freely!
Enhanced Research Validation:
Gemini Integration Upgrades:
Code Quality Improvements:
New Features:
Performance: