Class AdkStaleAgent

java.lang.Object
com.example.adkstale.AdkStaleAgent

public final class AdkStaleAgent extends Object
ADK Stale Issue Auditor for google/adk-java.

This is the Java port of the Python adk_stale_agent/agent.py. Unlike a timestamp-only "stale bot", it reconstructs each issue's Unified History Trace from a single GraphQL query (comments, body edits, title renames, reopens, label events) and uses Gemini to reason about the intent of the last action:

  • If the author/user acted last → the issue is ACTIVE: the stale label is removed (and, for a silent description edit GitHub does not notify on, maintainers are alerted).
  • If a maintainer asked a question and the inactivity threshold has passed → the issue is marked stale; after a further threshold it is closed.
  • If a maintainer gave a status update (or is talking to another maintainer) → no action.

Reads (the GraphQL history, maintainer list) go through GitHubStaleClient; writes (comments, labels, closing) go through the shared GitHubTools so the dry-run and target-repository guards are applied uniformly. Tool methods are exposed as FunctionTools using snake_case via Annotations.Schema so the function declarations seen by the model match the Python implementation, and each returns a {"status": "success" | "error", ...} envelope.

  • Field Details

    • ROOT_AGENT

      public static final LlmAgent ROOT_AGENT
      Exposed for adk web / dev-UI agent loaders that look up a public static final BaseAgent ROOT_AGENT field on the class.
  • Method Details

    • rootAgent

      public static LlmAgent rootAgent()
      Builds the LlmAgent. Safe to call at class-init time: it only reads Settings accessors that never throw (no GITHUB_TOKEN is required to construct the agent), so the ROOT_AGENT field and adk web agent loaders work without a token configured.
    • getIssueState

      public static Map<String,Object> getIssueState(int itemNumber)
    • addLabelToIssue

      public static Map<String,Object> addLabelToIssue(int itemNumber, String labelName)
    • removeLabelFromIssue

      public static Map<String,Object> removeLabelFromIssue(int itemNumber, String labelName)
    • addStaleLabelAndComment

      public static Map<String,Object> addStaleLabelAndComment(int itemNumber)
    • alertMaintainerOfEdit

      public static Map<String,Object> alertMaintainerOfEdit(int itemNumber)
    • closeAsStale

      public static Map<String,Object> closeAsStale(int itemNumber)