agentleFS
GoogleKnown publishergoogle/adk-samples/contrib/kotlin/llm-auditor/AGENTS.md

adk-samples / llm-auditor

AGENTS.md11k starsChanged 45 days agoApache-2.0View on GitHub

Show how to compose a SequentialAgent in ADK Kotlin: two LlmAgents that run in order, where the second consumes what the first produced. The domain task — fact-check an answer, then correct it — is a vehicle for three ADK concepts that are hard to demonstrate in isolation: 1. Sequential multi-agent composition with a shared model instance. 2. A built-in tool (GoogleSearchTool) grounding one sub-agent. 3. An AfterModelCallback post-processing a sub-agent's raw output before it reaches the user. This is…

  • Reads credentials

1 other project uses a version of this.

Trending

More talk lately.about the whole repository

Dec 2025: 1 mentionJan 2026: 1 mentionFeb 2026: 2 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 1 mentionJun 2026: 1 mentionJul 2026: 2 mentionsAug 2026: 0 mentionsSep 2026: 4 mentionsOct 2026: 4 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the google/adk-samples repository that our weekly crawl found. There is no adoption data for this file yet.

Most recently taken up by

Who's talking about google/adk-samples

The biggest 5 of 32 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 32

Talked about on GitHub, Bluesky, Hacker News and Stack Overflow (32 times).

On GitHub · 23

18 more on GitHub

On Bluesky · 4

The file

We split this AGENTS.md into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is 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.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All commands run from this directory (contrib/kotlin/llm-auditor).

    line 110

≈ “Common” is an estimate: at least 1 in 5 of the 40,246 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

LLM Auditor — Fact-Checking and Revision Pipeline (Kotlin)

Intent

Show how to compose a SequentialAgent in ADK Kotlin: two LlmAgents that run in order, where the second consumes what the first produced. The domain task — fact-check an answer, then correct it — is a vehicle for three ADK concepts that are hard to demonstrate in isolation:

  1. Sequential multi-agent composition with a shared model instance.
  2. A built-in tool (GoogleSearchTool) grounding one sub-agent.
  3. An AfterModelCallback post-processing a sub-agent's raw output before it reaches the user.

This is the Kotlin counterpart of the llm_auditor recipe in adk-python.

When To Use

Study this recipe when you need a pipeline where one agent's output is another's input, or when a sub-agent's raw response needs cleaning before it is surfaced. It is not the recipe for parallel fan-out, agent-to-agent delegation via transfer_to_agent, or tool authoring — it uses a built-in tool rather than defining one.

Eval

The only automated test is a runnability smoke test, src/test/kotlin/.../RunnabilityTest.kt: it builds rootAgent and checks its name and sub-agents without calling the model. build.gradle.kts gives it a placeholder GOOGLE_API_KEY, because Gemini() will not construct without a key; no real credentials are needed. CI runs it with gradle test, so CI verifies that the recipe compiles against the pinned adk-kotlin release and that the agent graph builds, not that it behaves correctly. Verify behaviour by hand:

export GOOGLE_API_KEY="..."
gradle run

Then paste a question-answer pair with a deliberate factual error, as in the README's example (Why is the sky blue? / Because the water is blue.). A correct run shows the critic listing each claim with a verdict, then the reviser emitting a corrected answer with no ---END-OF-EDIT--- marker visible — that marker leaking into output is the specific regression the after-model callback exists to prevent.

End-to-end flow

user: "Double check this: Question: ... Answer: ..."
  │
  ├─ critic_agent   ── GoogleSearchTool ──▶ web
  │    identifies each claim, verifies it, emits verdicts
  │
  └─ reviser_agent
       reads the original answer + the critic's findings,
       minimally edits the text, terminates with ---END-OF-EDIT---
       │
       └─ AfterModelCallback strips the marker and anything after it

SequentialAgent runs the two in declaration order and passes conversation state along; the reviser sees the critic's output as prior context.

Most interesting files to study (in order)

  • LlmAuditorAgent.kt — the whole composition, ~45 lines. One Gemini instance is built once and handed to both sub-agents, so the model is configured in a single place. rootAgent is @JvmField for Java callers.
  • ReviserAgent.kt — the most instructive file. removeEndOfEditMark is an AfterModelCallback that rewrites the LlmResponse before it is emitted: it walks content.parts, truncates the first part containing END_MARK, and drops every part after it. Note it uses copy() throughout — responses are immutable.
  • CriticAgent.kt — minimal by comparison; the interesting line is tools = listOf(GoogleSearchTool()), which is all that grounding requires.
  • CriticPrompt.kt / ReviserPrompt.kt — the prompts carry most of the behaviour. The reviser prompt is what instructs the model to end with ---END-OF-EDIT---; the callback and the prompt are a matched pair, so changing one without the other breaks the output.
  • Main.kt — three lines. ReplRunner supplies the interactive loop.
  • WebMain.kt — the same agent served over HTTP via AdkDevServer.

Data handling

Nothing is persisted. WebMain.kt uses AdkServerConfig.inMemory(), so session and artifact state live in the process and vanish on exit. The critic sends claim text to Google Search, so user input reaches an external service — do not paste confidential content into it.

Gotchas / things to know

  • The prompt and the callback are coupled. END_MARK is defined alongside the reviser prompt and matched by the callback. Edit the prompt's terminator and the marker will start appearing in user-visible output.
  • The callback stops at the first matching part (break), discarding later parts. That is deliberate — everything after the marker is scratch — but it means a response that legitimately continues after the marker loses content.
  • The dev server binds loopback. Since adk-kotlin 0.9.0, AdkDevServer listens on 127.0.0.1. Reaching it from a container or another machine needs an explicit host on AdkServerConfig; the README says how.
  • KSP is on the classpath but generates nothing. There are no @Tool annotations here — the critic uses a built-in tool. The ksp(...) line is inert and kept only for symmetry with recipes that do define tools.
  • No Gradle wrapper. CI falls back to the runner's gradle, so the build is not pinned to a Gradle version.

Where to run things

All commands run from this directory (contrib/kotlin/llm-auditor). Requires JDK 17+ and GOOGLE_API_KEY.

TaskCommand
Buildgradle build
CLI (REPL)gradle run
Dev UI on :8080gradle run -PmainClass=com.google.adk.samples.agents.llmauditor.WebMainKt
What CI runsgradle test (compiles, then runs the runnability test)

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.