adk-recipes / deep-search
AGENTS.md10k starsChanged 2 months agoApache-2.0View on GitHub
A clone-and-study fullstack research agent built on ADK + Gemini. Unlike the RAG recipes, the interesting part is the agent: app/agent.py builds a multi-agent graph that plans (with a Human-in-the-Loop approval step), runs an iterative search → critique → refine loop until a quality bar is met, then composes a report with inline citations back to web sources. It ships a React frontend over an ADK-powered FastAPI backend. There is no datastore, no ingestion pipeline, and no Terraform — all…
- Reads credentials
Trending
More talk lately.thin dataabout the whole repository
Who's talking about google/adk-recipes
The biggest 1 of 1 mention linking to the repository that our crawl found. Each line is their own headline.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository28 other files it gives its agents.
- AGENTS.mdAGENTS.md
- contrib/kotlin/llm-auditor/AGENTS.mdAGENTS.md
- core/python/ambient-expense-agent/AGENTS.mdAGENTS.md
- core/python/cross-session-memory/AGENTS.mdAGENTS.md
- core/python/genmedia-for-commerce/AGENTS.mdAGENTS.md
- core/python/long-horizon-harness/AGENTS.mdAGENTS.md
- core/python/oauth-user-consent-flow/AGENTS.mdAGENTS.md
- core/python/rag-agent-search/AGENTS.mdAGENTS.md
- core/python/rag-vector-search/AGENTS.mdAGENTS.md
- core/python/safety-plugins/AGENTS.mdAGENTS.md
- align-recipe-pyprojectSkill
- extract-python-environment-variablesSkill
- generate-manifestSkill
- generate-python-runnability-testSkill
- github-pr-reviewSkill
- make-python-recipe-deployableSkill
- prepare-python-recipeSkill
- repo-oracleSkill
- scaffold-python-recipeSkill
- blog-writerSkill
- content-research-writerSkill
- bootstrap-google-toolsSkill
- find-skillsSkill
- google-workspaceSkill
- policySkill
- routinesSkill
- retail-product-searchSkill
- retail-virtual-tryonSkill
The file
We split this AGENTS.md into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 30
To add eval: create a tests/eval/ directory with datasets/ + an eval_config.yaml (see the RAG recipes for the agents-cli eval format) and …
- Very specific: line 113
No corpus, no embeddings, no ingestion: All information is fetched live via the built-in google_search tool.
- Very specific: line 134
must: update frontend/src/ (mainly App.tsx / ChatMessagesView.tsx).
- Very specific: line 159
no
make test: run uv run pytest tests/test_runnability.py directly.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Deep Search — Iterative Research Agent with Citations
Intent
A clone-and-study fullstack research agent built on ADK + Gemini. Unlike the
RAG recipes, the interesting part is the agent: app/agent.py builds a
multi-agent graph that plans (with a Human-in-the-Loop approval step),
runs an iterative search → critique → refine loop until a quality bar is met,
then composes a report with inline citations back to web sources. It ships a
React frontend over an ADK-powered FastAPI backend. There is no datastore, no
ingestion pipeline, and no Terraform — all "data" comes from the built-in
google_search tool at runtime.
When To Use
- The user wants a "deep research" agent that plans, searches, self-critiques, and refines iteratively rather than answering in one shot.
- The user wants human-in-the-loop plan approval before autonomous execution.
- The user wants inline source citations linking each claim back to a web URL.
- The user wants a fullstack (React + FastAPI) example with a custom research timeline UI, or a headless multi-agent ADK orchestration to copy.
Eval
- Scenarios Path: none — this recipe ships no eval datasets and no eval
config: no
tests/eval/, noeval_config.yaml, and no LLM-judge scoring. - The only test is
tests/test_runnability.py— a smoke test that importsapp.agent(patchinggoogle.auth.default) and assertsroot_agentandappare defined. It is not wired into amake testtarget. - To add eval: create a
tests/eval/directory withdatasets/+ aneval_config.yaml(see the RAG recipes for theagents-clieval format) and run it via the agents CLI. Nothing here does that today — do not assume an eval path exists.
End-to-end flow
user topic
-> interactive_planner_agent (root LlmAgent) # Phase 1: Plan & Refine (HITL)
calls plan_generator (AgentTool) to draft a plan
refines with user; waits for EXPLICIT approval
| (approved)
v
research_pipeline (SequentialAgent) # Phase 2: Autonomous research
1. section_planner -> markdown outline (state: report_sections)
2. section_researcher -> first-pass web research (state: section_research_findings)
3. iterative_refinement_loop (LoopAgent, max = max_search_iterations)
research_evaluator -> grade pass/fail + follow_up_queries (state: research_evaluation)
escalation_checker -> stop loop when grade == "pass"
enhanced_search_executor -> run follow-ups, merge findings
4. report_composer_with_citations -> report with <cite source="src-N"/> tags
citation_replacement_callback rewrites tags -> Markdown links (state: final_report_with_citations)The loop stops early when research_evaluator grades pass (the custom
EscalationChecker escalates), otherwise after max_search_iterations passes.
Most interesting files to study (in order)
Backend — the multi-agent orchestration (the bulk of the logic; read first)
app/agent.py— the heart of the recipe. Unlike the RAG recipes, this is not a thin wrapper; it defines the whole graph and all the interesting behavior:interactive_planner_agent(rootLlmAgent) — the HITL entry point. It never answers directly: it calls theplan_generatorAgentToolto draft a plan, refines it against user feedback, and only delegates toresearch_pipelineon explicit approval. Itsoutput_keyisresearch_plan.plan_generator— builds a 5-goal, tag-prefixed plan ([RESEARCH]/[DELIVERABLE], plus[MODIFIED]/[NEW]/[IMPLIED]refinement tags); search is strictly limited to topic disambiguation.research_pipeline(SequentialAgent) —section_planner→section_researcher→iterative_refinement_loop→report_composer.iterative_refinement_loop(LoopAgent,max_iterations=config.max_search_iterations) —research_evaluator(emits apass/failgrade +follow_up_queriesvia theFeedbackPydantic schema) →EscalationChecker→enhanced_search_executor.EscalationChecker— a customBaseAgentwhose only job is loop control: ityields anescalate=Trueevent when the last evaluation gradedpass. This is the key trick for terminating aLoopAgenton a data-driven condition.collect_research_sources_callback/citation_replacement_callback— the citation machinery. The first harvestsgrounding_metadata(URLs, titles, domains, confidence) intostate["sources"]+state["url_to_short_id"]; the second rewrites<cite source="src-N"/>tags into Markdown links and drops invalid ones.
app/config.py— theResearchConfigurationdataclass:worker_modelandcritic_model(both read from theMODEL_NAMEenv var) andmax_search_iterations(default5). Also the auth bootstrap — AI Studio viaGOOGLE_API_KEY, else fall back togoogle.auth.default()+ Vertex AI.
Frontend (custom research UI)
frontend/src/App.tsx— the backend↔UI contract. Consumes the ADK/api/run_ssestream and routes events by agent name:getEventTitle()maps each agent to a timeline label, website counts come fromsection_researcher/enhanced_search_executor, and the final report is captured fromreport_composer_with_citations. This is exactly why renaming agents inagent.pybreaks the UI.frontend/src/components/—ActivityTimeline.tsxrenders the live research timeline,ChatMessagesView.tsxrenders chat + the final cited report,WelcomeScreen.tsx/InputForm.tsxhandle input.ui/is Shadcn.
Plumbing (thin layer — read last)
app/__init__.py— env bootstrap: loads.env, resolves the GCP project, sets Vertex defaults, then importsroot_agent. The import is intentionally below the bootstrap because the agent reads env vars at import time.tests/test_runnability.py— the sole test: a smoke import assertingroot_agent/appexist (withgoogle.auth.defaultpatched so no ADC is needed).
Data handling
- No corpus, no embeddings, no ingestion. All information is fetched live via
the built-in
google_searchtool. There is nothing to provision. - Session state is the data bus. Agents communicate through state keys, not
return values — trace the flow by reading
output_keys and{state}template refs inagent.py:research_plan→report_sections→section_research_findings→research_evaluation→sources/url_to_short_id→final_cited_report→final_report_with_citations. - Citations are derived from Gemini grounding metadata:
collect_research_sources_callbackassigns each URL a short id (src-N), the composer references those ids with<cite source="src-N"/>, andcitation_replacement_callbackresolves them to Markdown links in-line (no separate "References" section). - Human-in-the-loop: nothing is researched until the user explicitly approves the plan in chat.
Gotchas / things to know
- Agent names are a public API. The frontend keys off exact names
(
plan_generator,section_planner,section_researcher,enhanced_search_executor,report_composer_with_citations,interactive_planner_agent). Rename any of them inapp/agent.pyand you must updatefrontend/src/(mainlyApp.tsx/ChatMessagesView.tsx). - Models come from
MODEL_NAME, not hardcoded..env.examplesetsMODEL_NAME=gemini-3.5-flash; bothworker_modelandcritic_modelread the same var. IfMODEL_NAMEis unset,config.pyreturnsNonefor the models — set it (the smoke test defaults it togemini-3.5-flash). Do not use deprecatedgemini-2.0-flash/gemini-2.5-flash. - AI Studio by default, Vertex optional. With
GOOGLE_API_KEYset it uses AI Studio; otherwise it falls back togoogle.auth.default()+ Vertex, so a credential-less import fails in Vertex mode. - The refinement loop is bounded. It stops early on a
passgrade (viaEscalationChecker) or aftermax_search_iterations(default5) — whichever comes first. Raising the cap raises latency and cost. - No
make testand no eval.make lintruns codespell + ruff + mypy; run the single smoke test manually withuv run pytest tests/test_runnability.py. make devruns two servers. It backgroundsdev-backend(ADKapi_serveron:8000) anddev-frontend(Vite on:5173); Vite proxies/api/*tohttp://127.0.0.1:8000(base path/app/).
Where to run things
Makefile targets: make install (uv sync + npm --prefix frontend install),
make dev (backend + frontend together), make dev-backend
(adk api_server app on :8000), make dev-frontend (Vite dev server on
:5173), make playground (adk web on :8501 — ADK's built-in UI, no React),
make lint (codespell + ruff check + ruff format --check + mypy). There is
no make test: run uv run pytest tests/test_runnability.py directly. There
is no eval.
Reuse (copy as-is)
app/is a self-contained ADK agent — copy the directory and the whole multi-agent graph, config, and citation callbacks travel together. Its only runtime inputs are env vars (MODEL_NAME, plus eitherGOOGLE_API_KEYor Vertex AI credentials). No datastore, ingestion, or Terraform to stand up.frontend/is an independent React + Vite app (its ownpackage.json) — copy it, but it is coupled to the backend by agent names and the ADK SSE contract (/api/run_sse,/api/apps/app/...). Keep those names in sync withapp/agent.py.- The agent also runs headless: point any ADK runtime at
app.agent:root_agent(that's exactly whatmake playgrounddoes viaadk web), no React required.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

