Skip to content

Commit d9980e6

Browse files
Merge branch 'main' into main
2 parents dcc6502 + 2e3d717 commit d9980e6

220 files changed

Lines changed: 5233 additions & 1756 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
name: adk-unit-design
3+
description: Creates or updates code unit design documents for source code documentation.
4+
---
5+
6+
# ADK Code Unit Design
7+
8+
This skill creates or updates a detailed software engineering design document for new or updated code file or specified code unit. The design document it generates is meant to explain the code to a developer who wants to modify or extend the code unit as part of the ADK development framework. Similar to a *unit test*, a *unit design* provides a generated software engineering design based on the *actual, implemented code* rather than any proposed code design or proposed software architecture.
9+
10+
## Input
11+
12+
- Code files containing new functionality
13+
- Names of new methods and classes (optional)
14+
- Code files for base classes or interfaces that the new functionality depends on (optional)
15+
- Code unit tests (optional)
16+
- Example code files (optional)
17+
18+
## Analysis
19+
20+
- Review specified code files for changes and named methods to determine:
21+
- Purpose and intended use of the new or updated code units
22+
- Any data flows handled by the new or updated code units
23+
- Dependencies required by the new or updated code units
24+
- Approaches for extending or customizing the code unit to add new capabilities
25+
- Classes that depend on the new or updated code units
26+
- Operational limitations of the new or updated code units
27+
28+
## Output
29+
30+
- Look for an existing design document in the `/docs/design/***` directory of this repository.
31+
- If a design already exists, update the existing design incrementally and prioritize preserving the previous content as much as possible.
32+
- If no design document exists, create a design file for the new code unit in the `/docs/design/***` directory of this repository, using the relative path of the code unit. For example, if the code unit is called `/topic/function/class.ext`, create a design document in the location `/docs/design/topic/function/class/index.md`.
33+
- Any links to local code files should be translated to URL links to the `google/adk-python` repository on GitHub. For example, if the local code unit path is `***/adk-python/topic/function/class.ext#L93`, the URL to the code file should be `https://github.com/google/adk-python/blob/main/topic/function/class.ext#L93`.
34+
35+
### Design document structure and content
36+
37+
Use the following structure and instructions to create the design document for the code unit:
38+
39+
```
40+
# (name of code unit or code file) - Code Unit Design
41+
42+
- 2-sentence summary of the code unit
43+
44+
## Introduction
45+
46+
- Paragraph(s) explaining:
47+
- The purpose and application of the code unit, including intended use cases
48+
- Developer problems solved by this code unit
49+
- Agent capabilities enabled by this code unit
50+
51+
## High-level architecture
52+
53+
- Describe the software architecture of this code unit and how it fits into the larger ADK framework
54+
- Explain general execution flow of this code unit
55+
- Describe any data flows handled by the code unit including inputs and outputs
56+
- Explain any cross-class dependencies of the code unit, including upstream dependencies and downstream dependencies
57+
58+
### Extension points
59+
60+
- Describe how the code unit could be extended or customized to add new features or capabilities
61+
- Note specific parts of the code unit that are designed to be extended or customized, including:
62+
- Abstract classes
63+
- Interfaces
64+
- Hooks
65+
- Callbacks
66+
- Configurable parameters
67+
- Plugin architecture
68+
- Other extension points
69+
70+
### Extension constraints
71+
72+
- Describe what parts of the code unit should not be modified, based on:
73+
- architectural constraints
74+
- implementation limitations
75+
- cross-class dependencies
76+
- other constraints
77+
78+
## Limitations
79+
80+
- Mention any limitations of the code unit, if known, such as:
81+
- input constraints
82+
- data structure constraints
83+
- output constraints
84+
- performance limitations
85+
- memory limitations
86+
- other limitations
87+
88+
```

.github/header-checker-lint.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# Copyright 2025 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.
114
allowedCopyrightHolders:
215
- 'Google LLC'
316
allowedLicenses:
@@ -9,5 +22,7 @@ sourceFileExtensions:
922
- 'js'
1023
- 'java'
1124
- 'py'
25+
- 'yaml'
26+
- 'yml'
1227
ignoreFiles:
1328
- 'src/google/adk/cli/browser/**'

.github/release-please-config-v1.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
},
2626
{
2727
"type": "refactor",
28-
"section": "Code Refactoring"
28+
"section": "Code Refactoring",
29+
"hidden": true
2930
},
3031
{
3132
"type": "docs",

.github/release-please-config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
},
2323
{
2424
"type": "refactor",
25-
"section": "Code Refactoring"
25+
"section": "Code Refactoring",
26+
"hidden": true
2627
},
2728
{
2829
"type": "docs",

.github/workflows/analyze-releases-for-adk-docs-updates.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2025 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+
115
name: Analyze New Release for ADK Docs Updates
216

317
on:

.github/workflows/check-file-contents.yml renamed to .github/workflows/continuous-integration.yml

Lines changed: 149 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,167 @@
1-
name: "Check file contents"
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: Continuous Integration
216

317
on:
18+
push:
19+
branches: [main, v1]
20+
paths:
21+
- '**.py'
22+
- '.pre-commit-config.yaml'
23+
- 'pyproject.toml'
24+
- 'tests/**'
425
pull_request:
26+
branches: [main, v1]
527
paths:
628
- '**.py'
29+
- '.pre-commit-config.yaml'
30+
- 'pyproject.toml'
31+
- 'tests/**'
732

833
permissions:
934
contents: read
1035

1136
jobs:
12-
check-file-contents:
37+
# 1. Code format and linting (Linter)
38+
lint:
39+
name: Pre-commit Linter
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Checkout Code
43+
uses: actions/checkout@v6
44+
45+
- name: Run pre-commit checks
46+
uses: pre-commit/action@v3.0.1
47+
48+
# 2. Static type analysis (Mypy Check with Matrix)
49+
# Compares new changes against the target base branch dynamically to support v1.
50+
type-check:
51+
name: Mypy Check (Python ${{ matrix.python-version }})
52+
runs-on: ubuntu-latest
53+
strategy:
54+
fail-fast: false
55+
matrix:
56+
python-version: ['3.10', '3.11', '3.12', '3.13']
57+
steps:
58+
- name: Checkout code
59+
uses: actions/checkout@v6
60+
with:
61+
fetch-depth: 0
62+
63+
- name: Set up Python
64+
uses: actions/setup-python@v6
65+
with:
66+
python-version: ${{ matrix.python-version }}
67+
68+
- name: Install uv
69+
uses: astral-sh/setup-uv@v7
70+
71+
- name: Generate Baseline
72+
env:
73+
TARGET_BRANCH: ${{ github.base_ref || github.ref_name }}
74+
run: |
75+
# Switch to target base branch to generate baseline
76+
git checkout origin/$TARGET_BRANCH
77+
78+
git checkout ${{ github.sha }} -- pyproject.toml
79+
80+
# Install dependencies for target branch
81+
uv venv .venv
82+
source .venv/bin/activate
83+
uv sync --all-extras
84+
85+
# Run mypy, filter for errors only, remove line numbers, and sort
86+
# We ignore exit code (|| true) because we expect errors on baseline
87+
uv run mypy . | grep "error:" | sed 's/:\([0-9]\+\):/::/g' | sort > baseline_errors.txt || true
88+
echo "Found $(wc -l < baseline_errors.txt) errors on $TARGET_BRANCH."
89+
90+
- name: Check PR Branch
91+
run: |
92+
# Switch back to the PR commit
93+
git checkout ${{ github.sha }}
94+
95+
# Re-sync dependencies in case the PR changed them
96+
source .venv/bin/activate
97+
uv sync --all-extras
98+
99+
# Run mypy on PR code, apply same processing
100+
uv run mypy . | grep "error:" | sed 's/:\([0-9]\+\):/::/g' | sort > pr_errors.txt || true
101+
echo "Found $(wc -l < pr_errors.txt) errors on PR branch."
102+
103+
- name: Compare and Fail on New Errors
104+
run: |
105+
# 'comm -13' suppresses unique lines in file1 (baseline) and common lines,
106+
# leaving only lines unique to file2 (PR) -> The new errors.
107+
comm -13 baseline_errors.txt pr_errors.txt > new_errors.txt
108+
109+
if [ -s new_errors.txt ]; then
110+
echo "::error::The following NEW mypy errors were introduced:"
111+
cat new_errors.txt
112+
exit 1
113+
else
114+
echo "Great job! No new mypy errors introduced."
115+
fi
116+
117+
# 3. Unit testing (Unit Tests with Matrix)
118+
unit-test:
119+
name: Unit Tests (Python ${{ matrix.python-version }})
120+
runs-on: ubuntu-latest
121+
strategy:
122+
fail-fast: false
123+
matrix:
124+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
125+
timeout-minutes: 10
126+
steps:
127+
- name: Checkout code
128+
uses: actions/checkout@v6
129+
130+
- name: Set up Python ${{ matrix.python-version }}
131+
uses: actions/setup-python@v6
132+
with:
133+
python-version: ${{ matrix.python-version }}
134+
135+
- name: Install the latest version of uv
136+
uses: astral-sh/setup-uv@v7
137+
138+
- name: Install dependencies
139+
run: |
140+
uv venv .venv
141+
source .venv/bin/activate
142+
uv sync --extra test
143+
144+
- name: Run unit tests with pytest
145+
run: |
146+
source .venv/bin/activate
147+
pytest tests/unittests \
148+
-n auto \
149+
--ignore=tests/unittests/artifacts/test_artifact_service.py \
150+
--ignore=tests/unittests/tools/google_api_tool/test_googleapi_to_openapi_converter.py
151+
152+
# 4. Custom file content compliance checks (PR only)
153+
compliance-check:
154+
name: File Content Compliance
13155
runs-on: ubuntu-latest
156+
if: github.event_name == 'pull_request'
14157
steps:
15158
- name: Checkout Code
16159
uses: actions/checkout@v6
17160
with:
18-
fetch-depth: 2
161+
# Fetch full history (depth: 0) instead of shallow clone (depth: 2) to ensure
162+
# git diff origin/${base_ref}...HEAD can reliably find the merge base,
163+
# preventing fatal git errors on deep PRs or when the target branch has progressed.
164+
fetch-depth: 0
19165

20166
- name: Check for logger pattern in all changed Python files
21167
run: |
@@ -27,15 +173,11 @@ jobs:
27173
echo ""
28174
29175
# Check for 'logger = logging.getLogger(__name__)' in changed .py files.
30-
# The grep command will exit with a non-zero status code if the pattern is not found.
31-
# We invert the exit code with ! so the step succeeds if the pattern is NOT found.
32176
set +e
33177
FILES_WITH_FORBIDDEN_LOGGER=$(grep -lE 'logger = logging\.getLogger\(__name__\)' $CHANGED_FILES)
34178
GREP_EXIT_CODE=$?
35179
set -e
36180
37-
# grep exits with 0 if matches are found, 1 if no matches are found.
38-
# A non-zero exit code other than 1 indicates an error.
39181
if [ $GREP_EXIT_CODE -eq 0 ]; then
40182
echo "❌ Found forbidden use of 'logger = logging.getLogger(__name__)'. Please use 'logger = logging.getLogger('google_adk.' + __name__)' instead."
41183
echo "The following files contain the forbidden pattern:"
@@ -58,10 +200,8 @@ jobs:
58200
echo ""
59201
60202
# Use grep -L to find files that DO NOT contain the pattern.
61-
# This command will output a list of non-compliant files.
62203
FILES_MISSING_IMPORT=$(grep -L 'from __future__ import annotations' $CHANGED_FILES || true)
63204
64-
# Check if the list of non-compliant files is empty
65205
if [ -z "$FILES_MISSING_IMPORT" ]; then
66206
echo "✅ All modified Python files include 'from __future__ import annotations'."
67207
exit 0

.github/workflows/copybara-pr-handler.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2025 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+
115
name: Copybara PR Handler
216

317
on:

.github/workflows/discussion_answering.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2025 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+
115
name: ADK Answering Agent for Discussions
216

317
on:

0 commit comments

Comments
 (0)