Class SpamDetectionAgentRun

java.lang.Object
com.example.adkspam.SpamDetectionAgentRun

public final class SpamDetectionAgentRun extends Object
Entry point for the ADK Java issue monitoring (spam detection) agent. Mirrors main.py in the Python sample, and follows the *Run entry-point convention of the ADK Issue Triaging Agent and ADK Docs Release Analyzer samples.

The runtime mode is selected by environment variables:

  • GitHub Actions workflow mode (set INTERACTIVE=0): one-shot run.
    • If EVENT_NAME=issues and ISSUE_NUMBER is set → audit that single issue.
    • Otherwise → sweep open issues. With INITIAL_FULL_SCAN=1 the whole open backlog is audited; otherwise only issues updated in the last 24 hours.
  • Interactive console mode (default; INTERACTIVE=1): a Scanner-based REPL. The system instruction tells the agent to ask for confirmation before flagging. For a richer UI, the google-adk-maven-plugin's web goal can serve this agent (see this module's README for the exact command).

Following the Python design, cost-saving pre-filtering (skip maintainer/bot authors, strip code blocks, truncate, idempotency) happens here in code; the LLM is invoked only for threads that actually contain reviewable non-maintainer text. All GitHub access (reads and writes) goes through the shared GitHubTools, whose GitHubTools.dryRun/GitHubTools.writeRepoOwner /GitHubTools.writeRepoName guards are configured here so untrusted issue content cannot redirect writes to another repository.

  • Method Details

    • main

      public static void main(String[] args)