Main Agent
Main agent module for initializing and running the Talk2Scholars application.
This module sets up the hierarchical agent system using LangGraph and integrates various sub-agents for handling different tasks such as semantic scholar, zotero, PDF processing, and paper downloading.
Functions: - get_app: Initializes and returns the LangGraph-based hierarchical agent system.
            get_app(uniq_id, llm_model)
    Initializes and returns the LangGraph-based hierarchical agent system.
This function constructs the agent workflow by defining nodes for the supervisor
and sub-agents. It compiles the graph using StateGraph to enable structured
conversational workflows.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                thread_id
             | 
            
                  str
             | 
            
               A unique session identifier for tracking conversation state.  | 
            required | 
                llm_model
             | 
            
                  BaseChatModel
             | 
            
               The language model used for query processing.
Defaults to   | 
            required | 
Returns:
| Name | Type | Description | 
|---|---|---|
StateGraph |             
               A compiled LangGraph application that can process user queries.  | 
          
Example
app = get_app("thread_123") result = app.invoke(initial_state)
Source code in aiagents4pharma/talk2scholars/agents/main_agent.py
              33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89  |  |