Google's recipe for agents that know what they don't know
A reference fullstack app showing how Gemini can research, reflect, and iterate until it actually answers your question.

What it does
This is Google’s official quickstart for building a research agent with Gemini 2.5 and LangGraph. The backend agent takes a user query, generates search terms, hits Google Search, reflects on whether the results are sufficient, and loops back with follow-up queries if it finds knowledge gaps. Once satisfied, it synthesizes an answer with citations. A React frontend (Vite, Tailwind, Shadcn) provides the chat UI, and there’s also a CLI mode for quick one-off questions.
The interesting bit
The reflection step is the hook. Instead of trusting a single search pass, the agent explicitly critiques its own results and decides whether to keep digging—up to a configured loop limit. It’s a small but meaningful shift from “search once and hope” to structured self-correction, all wired through LangGraph’s state machine.
Key highlights
- Iterative research loop: generate queries → search → reflect → refine → answer with citations
- Fullstack reference architecture: React frontend, FastAPI/LangGraph backend, with hot-reloading dev setup
- CLI script (
backend/examples/cli_research.py) for testing without the UI - Production Docker Compose setup with Redis (pub-sub for streaming) and Postgres (state persistence, exactly-once queue semantics)
- Requires
GEMINI_API_KEY; production deploy also needsLANGSMITH_API_KEYfor the Docker Compose example
Caveats
- The README notes you must manually edit
frontend/src/App.tsxto updateapiUrlif not using the default localhost or Docker Compose setup - Production deployment leans on LangGraph’s opinionated infrastructure (Redis + Postgres required), which is more moving parts than a simple API server
Verdict
Worth cloning if you’re building RAG-adjacent agents and want to see how a major AI lab structures the loop-and-reflect pattern in code. Skip it if you just need a basic chatbot—this is scaffolding for research agents, not a drop-in component.