agents.memory_reorganized.search.labs.agent

Labs Agent implementation.

Provides interactive project automation with tools and workflows. Similar to Perplexity’s Labs feature that creates apps, dashboards, and automated workflows.

Classes

LabsAgent

Agent for interactive project automation with tools and workflows.

Module Contents

class agents.memory_reorganized.search.labs.agent.LabsAgent(name='labs_agent', engine=None, search_tools=None, enable_code_execution=True, **kwargs)

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

Agent for interactive project automation with tools and workflows.

Mimics Perplexity’s Labs feature by providing comprehensive project automation, including data analysis, visualization creation, app development, and workflow execution.

Features: - Multi-tool integration (Python, SQL, visualization libraries) - Interactive app creation (dashboards, websites, slideshows) - Code execution and data analysis - Asset management and organization - Workflow automation - Real-time collaboration tools

Capabilities: - Data analysis and visualization - Interactive dashboard creation - Basic web app development - Chart and image generation - CSV and data processing - Code execution and debugging

Examples

Basic usage:

agent = LabsAgent(
    name="labs",
    engine=AugLLMConfig(temperature=0.3)
)

response = await agent.process_labs_project(
    "Create a dashboard analyzing sales data",
    data_sources=["sales_data.csv"]
)

With specific tools:

response = await agent.process_labs_project(
    "Build an interactive chart showing trends",
    required_tools=["pandas", "plotly", "d3.js"],
    create_interactive_app=True
)

Initialize the Labs 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

  • enable_code_execution (bool) – Enable code execution capabilities

  • **kwargs – Additional arguments passed to parent

create_interactive_apps(workflow_steps)

Create interactive apps from workflow results.

Parameters:

workflow_steps (list[haive.agents.memory.search.labs.models.WorkflowStep]) – Completed workflow steps

Returns:

List of interactive apps

Return type:

list[haive.agents.memory.search.labs.models.InteractiveApp]

create_project_assets(workflow_steps)

Create project assets from workflow results.

Parameters:

workflow_steps (list[haive.agents.memory.search.labs.models.WorkflowStep]) – Completed workflow steps

Returns:

List of created assets

Return type:

list[haive.agents.memory.search.labs.models.ProjectAsset]

async execute_workflow_step(step_plan, step_index)

Execute a single workflow step.

Parameters:
  • step_plan (dict[str, Any]) – Planned step configuration

  • step_index (int) – Step index in workflow

Returns:

Executed workflow step

Return type:

haive.agents.memory.search.labs.models.WorkflowStep

get_response_model()

Get the response model for Labs.

Return type:

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

get_search_instructions()

Get specific search instructions for Labs operations.

Return type:

str

get_system_prompt()

Get the system prompt for Labs operations.

Return type:

str

plan_project_workflow(query, project_type, data_sources)

Plan the workflow steps for a project.

Parameters:
  • query (str) – Project description

  • project_type (str) – Type of project

  • data_sources (list[str]) – Available data sources

Returns:

List of planned workflow steps

Return type:

list[dict[str, Any]]

async process_labs_project(query, project_type='analysis', data_sources=None, required_tools=None, create_interactive_app=True, max_work_time=600, save_to_memory=True)

Process a Labs project with comprehensive automation.

Parameters:
  • query (str) – Project description

  • project_type (str) – Type of project

  • data_sources (list[str] | None) – Available data sources

  • required_tools (list[str] | None) – Required tools

  • create_interactive_app (bool) – Whether to create interactive app

  • max_work_time (int) – Maximum work time in seconds

  • save_to_memory (bool) – Whether to save to memory

Returns:

Labs response with project results

Return type:

haive.agents.memory.search.labs.models.LabsResponse

Process a search query with default Labs settings.

Parameters:
  • query (str) – Search query

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

  • save_to_memory (bool) – Whether to save to memory

Returns:

Labs response

Return type:

haive.agents.memory.search.labs.models.LabsResponse