agents.memory_reorganized.search.pro_search.agentΒΆ

Pro Search Agent implementation.

Provides deep, contextual search with user preferences and advanced reasoning. Similar to Perplexity’s Pro Search feature that goes deeper and considers user context.

ClassesΒΆ

ProSearchAgent

Agent for deep, contextual search with user preferences.

Module ContentsΒΆ

class agents.memory_reorganized.search.pro_search.agent.ProSearchAgent(name='pro_search_agent', engine=None, search_tools=None, **kwargs)ΒΆ

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

Agent for deep, contextual search with user preferences.

Provides comprehensive search responses that consider user context, preferences, and search history. Performs query refinement and multi-step reasoning for more accurate results.

Features: - Query refinement and expansion - User preference integration - Contextual insights from memory - Multi-step reasoning process - Follow-up question generation - Depth-based search levels

Examples

Basic usage:

agent = ProSearchAgent(
    name="pro_search",
    engine=AugLLMConfig(temperature=0.3)
)

response = await agent.process_search(
    "How can I improve my productivity?",
    context={"domain": "software_development"}
)

With custom depth level:

response = await agent.process_pro_search(
    "What are the best practices for ML deployment?",
    depth_level=4,
    use_preferences=True
)

Initialize the Pro Search Agent.

Parameters:
  • name (str) – Agent identifier

  • engine (Optional[haive.core.engine.aug_llm.AugLLMConfig]) – LLM configuration (defaults to optimized settings)

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

  • **kwargs – Additional arguments passed to parent

extract_contextual_insights(query, context)ΒΆ

Extract contextual insights from available context.

Parameters:
  • query (str) – Search query

  • context (dict[str, Any]) – Available context

Returns:

List of contextual insights

Return type:

list[haive.agents.memory.search.pro_search.models.ContextualInsight]

generate_follow_up_questions(query, response, context)ΒΆ

Generate relevant follow-up questions.

Parameters:
  • query (str) – Original search query

  • response (str) – Search response

  • context (dict[str, Any]) – Available context

Returns:

List of follow-up questions

Return type:

list[str]

generate_reasoning_steps(query, context)ΒΆ

Generate reasoning steps for the search process.

Parameters:
  • query (str) – Search query

  • context (dict[str, Any]) – Available context

Returns:

List of reasoning steps

Return type:

list[str]

get_response_model()ΒΆ

Get the response model for pro search.

Return type:

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

get_search_instructions()ΒΆ

Get specific search instructions for pro search.

Return type:

str

get_system_prompt()ΒΆ

Get the system prompt for pro search operations.

Return type:

str

Process a pro search query with advanced features.

Parameters:
  • query (str) – Search query

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

  • depth_level (int) – Search depth (1-5)

  • use_preferences (bool) – Whether to use user preferences

  • generate_follow_ups (bool) – Whether to generate follow-up questions

  • include_reasoning (bool) – Whether to include reasoning steps

  • save_to_memory (bool) – Whether to save to memory

Returns:

Pro search response

Return type:

haive.agents.memory.search.pro_search.models.ProSearchResponse

Process a search query with default pro search settings.

Parameters:
  • query (str) – Search query

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

  • save_to_memory (bool) – Whether to save to memory

Returns:

Pro search response

Return type:

haive.agents.memory.search.pro_search.models.ProSearchResponse

refine_query(query, context)ΒΆ

Refine the search query based on context and preferences.

Parameters:
  • query (str) – Original search query

  • context (dict[str, Any]) – Context including user preferences and history

Returns:

Search refinement with improved query

Return type:

haive.agents.memory.search.pro_search.models.SearchRefinement