agents.memory_reorganized.search.deep_research.agent

Deep Research Agent implementation.

Provides comprehensive research with multiple sources and detailed analysis. Similar to Perplexity’s Deep Research feature that performs dozens of searches and reads hundreds of sources.

Classes

DeepResearchAgent

Agent for comprehensive research with multiple sources and detailed analysis.

Module Contents

class agents.memory_reorganized.search.deep_research.agent.DeepResearchAgent(name='deep_research_agent', engine=None, search_tools=None, enable_kg=False, kg_transformer=None, **kwargs)

Bases: haive.agents.memory.search.base.BaseSearchAgent

Agent for comprehensive research with multiple sources and detailed analysis.

Mimics Perplexity’s Deep Research feature by performing multiple searches, analyzing hundreds of sources, and generating comprehensive reports.

Features: - Multi-stage research process - Comprehensive source analysis - Structured report generation - Knowledge graph integration - Fact checking and validation - Evidence synthesis

Research Process: 1. Query decomposition and planning 2. Background research queries 3. Specific deep-dive queries 4. Source evaluation and ranking 5. Content synthesis and analysis 6. Report generation and structuring

Examples

Basic usage:

agent = DeepResearchAgent(
    name="deep_research",
    engine=AugLLMConfig(temperature=0.2)
)

response = await agent.process_deep_research(
    "What are the environmental impacts of electric vehicles?",
    research_depth=4
)

With knowledge graph integration:

agent = DeepResearchAgent(
    name="deep_research",
    enable_kg=True,
    kg_transformer=IterativeGraphTransformer()
)

response = await agent.process_deep_research(
    "Impact of AI on healthcare outcomes",
    focus_areas=["diagnostic accuracy", "treatment efficiency"]
)

Initialize the Deep Research Agent.

Parameters:
  • name (str) – Agent identifier

  • engine (haive.core.engine.aug_llm.AugLLMConfig | None) – LLM configuration (defaults to optimized settings)

  • search_tools (list[langchain_core.tools.Tool] | None) – Optional search tools

  • enable_kg (bool) – Enable knowledge graph integration

  • kg_transformer (Any | None) – Knowledge graph transformer instance (optional)

  • **kwargs – Additional arguments passed to parent

decompose_research_query(query, focus_areas=None)

Decompose a complex research query into specific sub-queries.

Parameters:
  • query (str) – Main research query

  • focus_areas (list[str] | None) – Specific areas to focus on

Returns:

List of specific research queries

Return type:

list[str]

evaluate_source_credibility(source)

Evaluate the credibility of a source.

Parameters:

source (dict[str, Any]) – Source information

Returns:

Credibility score (0.0-1.0)

Return type:

float

async execute_research_query(query, query_type='general')

Execute a single research query and track results.

Parameters:
  • query (str) – Research query to execute

  • query_type (str) – Type of query (background, specific, validation)

Returns:

Research query result with metadata

Return type:

haive.agents.memory.search.deep_research.models.ResearchQuery

generate_executive_summary(sections)

Generate an executive summary from research sections.

Parameters:

sections (list[haive.agents.memory.search.deep_research.models.ResearchSection]) – Research sections

Returns:

Executive summary text

Return type:

str

get_response_model()

Get the response model for deep research.

Return type:

type[haive.agents.memory.search.base.SearchResponse]

get_search_instructions()

Get specific search instructions for deep research.

Return type:

str

get_system_prompt()

Get the system prompt for deep research operations.

Return type:

str

organize_findings_by_theme(findings)

Organize research findings into thematic sections.

Parameters:

findings (list[dict[str, Any]]) – List of research findings

Returns:

List of organized research sections

Return type:

list[haive.agents.memory.search.deep_research.models.ResearchSection]

async process_deep_research(query, research_depth=3, focus_areas=None, max_sources=50, include_fact_checking=True, save_to_memory=True)

Process a deep research query with comprehensive analysis.

Parameters:
  • query (str) – Research query

  • research_depth (int) – Research depth level (1-5)

  • focus_areas (list[str] | None) – Specific areas to focus on

  • max_sources (int) – Maximum sources to examine

  • include_fact_checking (bool) – Include fact checking

  • save_to_memory (bool) – Save results to memory

Returns:

Deep research response

Return type:

haive.agents.memory.search.deep_research.models.DeepResearchResponse

Process a search query with default deep research settings.

Parameters:
  • query (str) – Search query

  • context (dict[str, Any] | None) – Optional context

  • save_to_memory (bool) – Whether to save to memory

Returns:

Deep research response

Return type:

haive.agents.memory.search.deep_research.models.DeepResearchResponse