Class AdkTriagingAgent

java.lang.Object
com.example.adktriaging.AdkTriagingAgent

public final class AdkTriagingAgent extends Object
ADK Issue Triaging Agent for google/adk-java.

This is the Java port of the Python adk_triaging_agent/agent.py, adapted to the actual label taxonomy of google/adk-java (which, unlike adk-python, does not use per-component labels). The agent uses Gemini to:

  • recommend a topic/kind label for each open issue (e.g. bug, enhancement, documentation, question),
  • round-robin assign owners from a configurable triager rotation.

All GitHub access goes through the shared GitHubTools (backed by the org.kohsuke:github-api client) that this sample reuses with the ADK Docs Release Analyzer. Tool methods are exposed as FunctionTools and use snake_case via Annotations.Schema so the function declarations seen by the model match the Python implementation. Each tool returns an ImmutableMap envelope — {"status": "success", ...} on success, {"status": "error", "message": "..."} on failure — matching the Python contract.

NOTE: COMPONENT_LABELS contains labels that actually exist in google/adk-java as of this writing. gtechRotation() cannot be derived from any public source (adk-java has no CODEOWNERS file), so it defaults to an obvious placeholder and must be supplied at runtime via the GTECH_ASSIGNEES environment variable (a comma-separated list of GitHub handles). Real triager handles never need to live in source.

  • Field Details

    • COMPONENT_LABELS

      public static final com.google.common.collect.ImmutableSet<String> COMPONENT_LABELS
      The set of labels the agent is allowed to apply. These are real labels in google/adk-java. Unlike adk-python, adk-java has no per-component labels, so this is a flat allowlist of topic/kind labels rather than a label→owner map.

      Insertion order is preserved (via ImmutableSet) for deterministic enumeration.

    • LABEL_GUIDELINES

      public static final String LABEL_GUIDELINES
      Label rubric used in the agent's system instruction. Describes the real google/adk-java labels so the model classifies issues using labels that exist in the repo.
      See Also:
    • 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

    • gtechRotation

      public static com.google.common.collect.ImmutableList<String> gtechRotation()
      Round-robin rotation of triagers. Issues are assigned via issue_number % N. Sourced from the GTECH_ASSIGNEES environment variable (comma-separated GitHub handles); falls back to PLACEHOLDER_ROTATION when unset.

      Read lazily (per call) rather than at class load, matching the lazy-accessor pattern in Settings: this keeps the class loadable in tests/agent loaders and lets the environment be overridden before the rotation is first consulted.

    • 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.
    • listUntriagedIssues

      public static com.google.common.collect.ImmutableMap<String,Object> listUntriagedIssues(int issueCount)
      Lists open issues that still need triaging. An issue is considered untriaged if it is missing a recognized label OR it has no assignee. Each returned entry is a compact map (number, title, body, url, labels, plus the triage flags) rather than the full GitHub issue payload, to keep the model's context small.
    • addLabelToIssue

      public static com.google.common.collect.ImmutableMap<String,Object> addLabelToIssue(int issueNumber, String label)
      Adds the specified label to a GitHub issue, validating it is on the allowlist.
    • assignGtechOwnerToIssue

      public static com.google.common.collect.ImmutableMap<String,Object> assignGtechOwnerToIssue(int issueNumber)
      Round-robin assigns a gTech triager to the issue using issue_number % N. This matches the Python implementation and keeps the assignment stable for a given issue number.