How the LangGraph research agent works
mainThe backend agent (defined in backend/src/agent/graph.py) performs iterative research using the following lifecycle:
- Generate Initial Queries: Uses Gemini to create search terms based on user input.
- Web Research: Uses the Google Search API via Gemini to find relevant web pages.
- Reflection & Knowledge Gap Analysis: Analyzes results to see if information is sufficient or if gaps exist.
- Iterative Refinement: If gaps are found, it generates follow-up queries and repeats the research (up to a configured maximum).
- Finalize Answer: Synthesizes findings into a coherent answer with citations from web sources.