The Story of Sarvagya
Our Inspiration In the age of information, the process of conducting comprehensive research is paradoxically more difficult than ever. Anyone who has deep-dived into a topic knows the tedious workflow: juggling dozens of tabs, sifting through search results, manually scraping (or copy-pasting) relevant data, and trying to reconcile conflicting or outdated information. Finally, after hours of work, you still have to synthesize it all into a coherent report.
We were inspired by the potential of large language models to automate this entire pipeline. We envisioned a "fire and forget" system: what if you could ask a complex research question and receive a complete, fact-checked, and professionally structured report minutes later? This vision led to the creation of Sarvagya, an intelligent research assistant built on a multi-agent AI system.
How We Built It :
The core idea was "division of labor." Instead of one massive AI trying to do everything, we designed a multi-agent architecture where each agent has one specialized job, coordinated by a central "manager."
The Brain (Main Orchestrator): This is the project manager. It takes the user's query from the Gradio Web UI and maps out a plan, telling each agent when to start, what to do with its results, and who to pass the baton to.
The Agents (The Team): We built six distinct agents, all powered by Python and the Google Gemini API:
Router Agent: The strategist. It first analyzes the query to decide the best plan of attack—what to search for, what to ignore.
Web Search Agent: The recon specialist. It uses SerpAPI (or DuckDuckGo as a fallback) to scour the internet for the most relevant sources.
Scraper Agent: The data extractor. It takes the URLs from the search agent and meticulously scrapes the actual content from those pages.
Vector Search Agent: The archivist. It searches our internal ChromaDB vector database. This lets Sarvagya learn from past research and recall relevant information instantly.
Fact Checker Agent: The quality control. This is arguably the most crucial agent. It takes all the raw, gathered data and critically reviews it, validating facts and—most importantly—detecting and removing contradictions.
Summarizer Agent: The writer. Once the facts are verified, this agent steps in to generate the final, professional report, complete with an executive summary, key findings, and citations for all the sources used.
Finally, to make the system truly useful, we integrated it with Google Sheets to automatically save a history of every research task performed.
Challenges We Faced:
This was far from simple. Our biggest challenges were:
Reliably Getting Data: Web scraping is notoriously fragile. We had to handle website-specific blocks, timeouts (leading to the SCRAPE_TIMEOUT config), and respecting robots.txt.
Managing "The Truth": The internet is full of conflicting information. Building the Fact Checker Agent was a significant challenge. We had to develop prompts and logic that allowed the AI to critically compare different sources and make a judgment call on what to include.
Workflow Coordination: Getting six different AI agents to work together seamlessly was complex. The Main Orchestrator became essential for managing the flow of data and handling errors. If one agent failed (like an API key error or a web scraper timing out), the whole system had to handle it gracefully—this is why we built it to be fault-tolerant.
API & Rate Limits: Juggling multiple external APIs (Gemini, SerpAPI, Google Sheets) meant carefully managing API keys, rate limits, and configuration. Our .env file and verify_setup.py script grew directly out of the need to make this manageable.
What We Learned :
Building Sarvagya taught us that the future of complex AI tasks isn't a single, monolithic model. It's a team of specialized, smaller models working in concert.
We learned that in any research system, the "garbage in, garbage out" problem is amplified. Without a dedicated validation and fact-checking step, an automated system just gathers noise faster. The Fact Checker Agent became the heart of the project, ensuring the final output is not just fast, but trustworthy.
Most importantly, we learned the power of building a modular, configurable, and observable system. By giving each agent a clear role and providing a UI for real-time progress, we created a tool that is not only powerful but also transparent and adaptable.
Built With
- ai/llm:
- and
- beautiful-soup
- chromadb
- duckduckgo
- gemini
- gradio
- primary)
- python
- selenium
- serpapi
- sheets
Log in or sign up for Devpost to join the conversation.