agents.document_loader.base.agent

Document Loader Agent implementation.

This module provides an agent implementation that uses the DocumentLoaderEngine to load documents from various sources and integrate with the Haive agent framework.

The agent handles document loading from various sources, including: - Local files and directories - Web pages and URLs - Databases - Cloud storage - API services

The agent can be integrated into more complex workflows and supports both synchronous and asynchronous operation modes.

Classes

DocumentLoaderAgent

Document Loader Agent that integrates the document loader engine with the agent framework.

Module Contents

class agents.document_loader.base.agent.DocumentLoaderAgent

Bases: haive.agents.base.agent.Agent

Document Loader Agent that integrates the document loader engine with the agent framework.

This agent provides a simple interface for loading documents from various sources through the agent framework. It can be used as a standalone agent or as part of a more complex agent workflow.

The agent supports loading from: - Local files and directories - Web pages and URLs - Databases (with proper credentials) - Cloud storage (with proper credentials)

name

Name of the agent

engine

The document loader engine to use

config

Configuration for the document loader engine

include_content

Whether to include document content in the output

include_metadata

Whether to include document metadata in the output

max_documents

Maximum number of documents to load (None for unlimited)

use_async

Whether to use async loading if available

build_graph()

Build the document loader agent graph.

Creates a simple linear graph that loads documents from the input source.

Returns:

A BaseGraph instance for document loading

Return type:

haive.core.graph.state_graph.base_graph2.BaseGraph

process_output(output)

Process the output from the document loader engine.

This method filters and formats the output based on the agent’s configuration.

Parameters:

output (haive.core.engine.document.DocumentOutput) – The raw output from the document loader engine

Returns:

A dictionary with processed document data

Return type:

dict[str, Any]

setup_agent()

Set up the agent by configuring the document loader engine.

This method is called during agent initialization to set up the engine with the agent’s configuration parameters.

Return type:

None