


from typing import Any, Optional, Annotated, Sequence, List, Dict
import operator

import pandas as pd
import os

from IPython.display import Markdown

from langchain_core.messages import BaseMessage, AIMessage

from langgraph.prebuilt import create_react_agent, ToolNode
from langgraph.prebuilt.chat_agent_executor import AgentState
from langgraph.graph import START, END, StateGraph

from ai_data_science_team.templates import BaseAgent
from ai_data_science_team.utils.regex import format_agent_name
from ai_data_science_team.tools.data_loader import (
    load_directory,
    load_file,
    list_directory_contents,
    list_directory_recursive,
    get_file_info,
    search_files_by_pattern,
)

AGENT_NAME = "data_loader_tools_agent"

tools = [
    load_directory,
    load_file,
    list_directory_contents,
    list_directory_recursive,
    get_file_info,
    search_files_by_pattern,
]



def make_data_loader_tools_agent(
    model: Any,
    directory: Optional[str] = os.getcwd(),
):
    """
    Creates a Data Loader Agent that can interact with data loading tools.
    
    Parameters:
    ----------
    model : langchain.llms.base.LLM
        The language model used to generate the tool calling agent.
    directory : str, optional
        The directory to search for files. Defaults to the current working directory.
    
    Returns:
    --------
    Data Loader Agent
        An agent that can interact with data loading tools.
    """
    
    class GraphState(AgentState):
        internal_messages: Annotated[Sequence[BaseMessage], operator.add]
        directory: str
        user_instructions: str
        data_artifacts: dict
    
    pass

