Class AdkPrTriagingAgent
google/adk-java.
This is the Java port of the Python adk_pr_triaging_agent/agent.py, adapted to the
actual label taxonomy of google/adk-java. The Python agent applies one of ten adk-python
component labels (e.g. services, models, mcp); those labels do
not exist in adk-java, so — exactly as the sibling ADK Issue Triaging Agent does —
this port classifies PRs with adk-java's own labels (see ALLOWED_LABELS).
The agent uses Gemini to:
- recommend a single topic/kind label for each open pull request (e.g.
bug,enhancement,documentation), - check the PR against the repository's contribution guidelines and, when it falls short, post a single, polite comment asking the author for the missing context.
All GitHub access goes through the shared GitHubTools (backed by the
org.kohsuke:github-api client) that this sample reuses with the ADK Issue Triaging Agent and 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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.google.common.collect.ImmutableSet<String> The set of labels the agent is allowed to apply to a pull request.static final StringLabel rubric used in the agent's system instruction.static final LlmAgentExposed foradk web/ dev-UI agent loaders that look up apublic static final BaseAgent ROOT_AGENTfield on the class. -
Method Summary
Modifier and TypeMethodDescriptionaddCommentToPr(int prNumber, String comment) Posts the specified comment on a pull request.addLabelToPr(int prNumber, String label) Adds the specified label to a pull request, validating it is on the allowlist.getPullRequestDetails(int prNumber) Fetches the details of the specified pull request via the sharedGitHubTools.static LlmAgentBuilds theLlmAgent.
-
Field Details
-
ALLOWED_LABELS
The set of labels the agent is allowed to apply to a pull request. These are real labels ingoogle/adk-java. adk-python uses ten per-component labels that do not exist in adk-java, so this is a flat allowlist of topic/kind labels adapted to adk-java's taxonomy (the same approach the ADK Issue Triaging Agent takes).Insertion order is preserved (via
ImmutableSet) for deterministic enumeration. -
LABEL_GUIDELINES
Label rubric used in the agent's system instruction. Describes the realgoogle/adk-javalabels so the model classifies PRs using labels that exist in the repo.- See Also:
-
ROOT_AGENT
Exposed foradk web/ dev-UI agent loaders that look up apublic static final BaseAgent ROOT_AGENTfield on the class.
-
-
Method Details
-
rootAgent
Builds theLlmAgent. Safe to call at class-init time: it only readsSettingsaccessors that never throw (noGITHUB_TOKENis required to construct the agent), so theROOT_AGENTfield andadk webagent loaders work without a token configured. -
getPullRequestDetails
public static com.google.common.collect.ImmutableMap<String,Object> getPullRequestDetails(int prNumber) Fetches the details of the specified pull request via the sharedGitHubTools. Returns the{"status": "success", "pull_request": {...}}envelope on success. -
addLabelToPr
-
addCommentToPr
-