Skip to content

Commit b0f4b91

Browse files
committed
ci(workflow): Run issue analysis using Antigravity Python SDK
Installs the public google-antigravity SDK via pip and executes a runner python script scripts/run_antigravity.py to run any antigravity prompts. This replaces the Node-based @google/antigravity CLI tool, and allows general executions via Python. Change-Id: Iade60816b4613567e261934a46285d7933adfc00
1 parent a86efa6 commit b0f4b91

3 files changed

Lines changed: 135 additions & 1 deletion

File tree

.agents/skills/adk-issue-analyze/SKILL.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ Search for any existing pull requests that attempt to resolve the issue:
6363
```
6464
- **Analyze progress**: Check if the PR is open, merged, or closed, and if it successfully fixes the issue according to the repository's testing patterns.
6565
- **Present the structured report**: Format and present your findings structured as a premium report following the **Report Template** below.
66-
- **Offer to create a fix**: If no existing PR is found, you MUST explicitly ask the user: "Would you like me to create and implement a fix for this issue in the workspace? (Note: The changes and tests will be created in a new branch but NOT committed, so you can review and iterate on them.)"
6766

6867
---
6968

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: ADK Issue Triage & Analysis
16+
17+
on:
18+
issues:
19+
types: [opened]
20+
issue_comment:
21+
types: [created]
22+
workflow_dispatch:
23+
inputs:
24+
issue_url:
25+
description: 'The URL of the GitHub issue to analyze'
26+
required: true
27+
type: string
28+
29+
jobs:
30+
issue-analyze:
31+
if: >-
32+
github.repository == 'google/adk-python' && (
33+
github.event_name == 'issues' ||
34+
github.event_name == 'workflow_dispatch' ||
35+
(github.event_name == 'issue_comment' &&
36+
!github.event.issue.pull_request &&
37+
startsWith(github.event.comment.body, '/adk-issue-analyze'))
38+
)
39+
runs-on: ubuntu-latest
40+
permissions:
41+
issues: write
42+
contents: read
43+
44+
steps:
45+
- name: Checkout repository
46+
uses: actions/checkout@v6
47+
48+
- name: Set up Python
49+
uses: actions/setup-python@v6
50+
with:
51+
python-version: '3.11'
52+
53+
- name: Authenticate to Google Cloud
54+
id: auth
55+
uses: 'google-github-actions/auth@v3'
56+
with:
57+
credentials_json: '${{ secrets.ADK_GCP_SA_KEY }}'
58+
59+
- name: Install Google Antigravity SDK
60+
run: pip install google-antigravity
61+
62+
- name: Run Antigravity Triage
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.ADK_TRIAGE_AGENT }}
65+
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
66+
run: python scripts/run_antigravity.py "/adk-issue-analyze ${{ github.event.issue.html_url || inputs.issue_url }}"

scripts/run_antigravity.py

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""Runner script to execute prompts/commands via the Antigravity SDK."""
16+
17+
import asyncio
18+
import os
19+
import sys
20+
21+
try:
22+
from google.antigravity import Agent
23+
from google.antigravity import CapabilitiesConfig
24+
from google.antigravity import LocalAgentConfig
25+
except ImportError:
26+
print(
27+
"Error: google-antigravity package is not installed. Run 'pip install"
28+
" google-antigravity'",
29+
file=sys.stderr,
30+
)
31+
sys.exit(1)
32+
33+
34+
async def main():
35+
if len(sys.argv) < 2:
36+
print("Usage: python run_antigravity.py <prompt>", file=sys.stderr)
37+
sys.exit(1)
38+
39+
prompt = " ".join(sys.argv[1:])
40+
41+
# Ensure GEMINI_API_KEY is set (using GOOGLE_API_KEY as fallback)
42+
if "GOOGLE_API_KEY" in os.environ and "GEMINI_API_KEY" not in os.environ:
43+
os.environ["GEMINI_API_KEY"] = os.environ["GOOGLE_API_KEY"]
44+
45+
if "GEMINI_API_KEY" not in os.environ:
46+
print(
47+
"Error: GEMINI_API_KEY environment variable is not set.",
48+
file=sys.stderr,
49+
)
50+
sys.exit(1)
51+
52+
config = LocalAgentConfig(
53+
capabilities=CapabilitiesConfig(),
54+
)
55+
56+
try:
57+
async with Agent(config) as agent:
58+
response = await agent.chat(prompt)
59+
async for token in response:
60+
sys.stdout.write(token)
61+
sys.stdout.flush()
62+
print()
63+
except Exception as e: # pylint: disable=broad-exception-caught
64+
print(f"\nError running Antigravity Agent: {e}", file=sys.stderr)
65+
sys.exit(1)
66+
67+
68+
if __name__ == "__main__":
69+
asyncio.run(main())

0 commit comments

Comments
 (0)