Deep Research Agent
Relevant source files
The following files were used as context for generating this wiki page:
The Deep Research Agent is a core component of the Chain-of-Ideas (CoI) framework designed to automate scientific discovery. Its primary purpose is to perform exhaustive literature reviews, identify research trends, and generate novel, feasible research ideas and experimental designs. By leveraging Large Language Models (LLMs) and semantic search engines, it simulates the reasoning patterns of human researchers to transition from existing methodologies to innovative future directions.
Sources: agents.py:101-131, prompts/deep_research_agent_prompts.py:177-219, README.md:5-10
Architecture and Core Logic
The Deep Research Agent operates through a multi-stage pipeline that includes paper discovery, idea chain construction, novelty checking, and experimental design. It utilizes a SementicSearcher to interact with external academic graphs (like Semantic Scholar) and multiple LLM instances (Main and Cheap) for complex reasoning and data extraction tasks respectively.
Deep Research Chain Workflow
The agent constructs a "research chain" by traversing paper citations (forward search) and references (backward search) to establish a historical context for a specific topic.
The diagram above illustrates the iterative process of building a research chain by traversing academic relationships.
Sources: agents.py:221-322, prompts/deep_research_agent_prompts.py:116-175
Key Components
1. Literature Search and Reranking
The agent uses semantic search to find relevant literature. If a query fails to yield results, the agent employs a re-writing logic to generate more concise or general queries. Results are often reranked using cosine similarity between query embeddings and paper content.
| Component | Function | File Reference |
|---|---|---|
get_search_query | Generates search strings based on topic and idea. | agents.py:133-145 |
SementicSearcher.search_async | Executes API calls to find papers and downloads PDFs. | searcher/sementic_search.py:141-180 |
rerank_papers | Reorders candidates based on LLM embeddings. | searcher/sementic_search.py:117-135 |
2. Idea Generation and Novelty Validation
The agent generates ideas by analyzing the "Idea Chain" and "Trend Summary." To ensure scientific integrity, it performs a strict novelty check against existing papers to avoid plagiarism.
Functional Implementation
Chain Construction Logic
The deep_research_paper_with_chain function is the primary driver for historical analysis. It maintains a list of idea_chain, experiments, and total_entities extracted from the literature.
- Forward Search: Uses
search_related_paper_asyncwithneed_reference=Falseto find papers citing the current anchor. - Backward Search: Iterates through extracted references and searches for them specifically.
- Relevance Judgment: Every discovered paper is passed through a judge prompt to ensure it contributes to the specified research topic.
Sources: agents.py:221-295, prompts/deep_research_agent_prompts.py:155-175
Experimental Design and Refinement
After an idea is finalized, the agent generates a detailed experimental plan. This plan includes:
- Initial Design: Created via
generate_experimentusing past related research experiments as context. - Review Feedback: A
ReviewAgentassesses the plan for feasibility and clarity. - Refinement: The agent uses
refine_experimentto incorporate suggestions, potentially searching for new technical information to solve specific implementation hurdles identified by the reviewer.
Sources: agents.py:377-407, prompts/deep_research_agent_prompts.py:327-362, prompts/review_agent_prompts.py:46-72
Data Structures and Configuration
The agent relies on a Result data structure to track paper metadata and a central configuration file for API management.
# From searcher/sementic_search.py:61-67
class Result:
def __init__(self,title="",abstract="",article=None,citations_conut = 0,year = None) -> None:
self.title = title
self.abstract = abstract
self.article = article
self.citations_conut = citations_conut
self.year = year
| Configuration Parameter | Description | Default |
|---|---|---|
MAIN_LLM_MODEL | Powerful model (e.g., GPT-4o) for reasoning. | gpt4o-0513 |
CHEAP_LLM_MODEL | Efficient model for summarization/extraction. | gpt-4o-mini |
max_chain_length | Maximum papers in a single research chain. | 5 |
improve_cnt | Number of refinement iterations for experiments. | 1 |
Sources: agents.py:12-25, main.py:31-41, searcher/sementic_search.py:61-67
The Deep Research Agent serves as the intellectual engine of the CoI-Agent repository, transforming raw academic data into structured research trajectories. By automating the transition from "what exists" to "what could be," it significantly reduces the manual labor required for the initial stages of the scientific process.