Skip to content

Commit c2db1b8

Browse files
authored
Merge branch 'main' into fix-transfer-to-agent-parameters-issue
2 parents d76ed24 + 9af2394 commit c2db1b8

File tree

70 files changed

+42836
-4398
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+42836
-4398
lines changed

.gemini/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"contextFileName": "AGENTS.md"
3+
}

.github/workflows/check-file-contents.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
7171
# Use grep -L to find files that DO NOT contain the pattern.
7272
# This command will output a list of non-compliant files.
73-
FILES_MISSING_IMPORT=$(grep -L 'from __future__ import annotations' $CHANGED_FILES)
73+
FILES_MISSING_IMPORT=$(grep -L 'from __future__ import annotations' $CHANGED_FILES || true)
7474
7575
# Check if the list of non-compliant files is empty
7676
if [ -z "$FILES_MISSING_IMPORT" ]; then

.github/workflows/pr-commit-check.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# .github/workflows/pr-commit-check.yml
2+
# This GitHub Action workflow checks if a pull request has more than one commit.
3+
# If it does, it fails the check and instructs the user to squash their commits.
4+
5+
name: 'PR Commit Check'
6+
7+
# This workflow runs on pull request events.
8+
# It's configured to run on any pull request that is opened or synchronized (new commits pushed).
9+
on:
10+
pull_request:
11+
types: [opened, synchronize]
12+
13+
# Defines the jobs that will run as part of the workflow.
14+
jobs:
15+
check-commit-count:
16+
# The type of runner that the job will run on. 'ubuntu-latest' is a good default.
17+
runs-on: ubuntu-latest
18+
19+
# The steps that will be executed as part of the job.
20+
steps:
21+
# Step 1: Check out the code
22+
# This action checks out your repository under $GITHUB_WORKSPACE, so your workflow can access it.
23+
- name: Checkout Code
24+
uses: actions/checkout@v4
25+
with:
26+
# We need to fetch all commits to accurately count them.
27+
# '0' means fetch all history for all branches and tags.
28+
fetch-depth: 0
29+
30+
# Step 2: Count the commits in the pull request
31+
# This step runs a script to get the number of commits in the PR.
32+
- name: Count Commits
33+
id: count_commits
34+
# We use `git rev-list --count` to count the commits.
35+
# ${{ github.event.pull_request.base.sha }} is the commit SHA of the base branch.
36+
# ${{ github.event.pull_request.head.sha }} is the commit SHA of the head branch (the PR branch).
37+
# The '..' syntax gives us the list of commits in the head branch that are not in the base branch.
38+
# The output of the command (the count) is stored in a step output variable named 'count'.
39+
run: |
40+
count=$(git rev-list --count ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }})
41+
echo "commit_count=$count" >> $GITHUB_OUTPUT
42+
43+
# Step 3: Check if the commit count is greater than 1
44+
# This step uses the output from the previous step to decide whether to pass or fail.
45+
- name: Check Commit Count
46+
# This step only runs if the 'commit_count' output from the 'count_commits' step is greater than 1.
47+
if: steps.count_commits.outputs.commit_count > 1
48+
# If the condition is met, the workflow will exit with a failure status.
49+
run: |
50+
echo "This pull request has ${{ steps.count_commits.outputs.commit_count }} commits."
51+
echo "Please squash them into a single commit before merging."
52+
echo "You can use git rebase -i HEAD~N"
53+
echo "...where N is the number of commits you want to squash together. The PR check conveniently tells you this number! For example, if the check says you have 3 commits, you would run: git rebase -i HEAD~3."
54+
echo "Because you have rewritten the commit history, you must use the --force flag to update the pull request: git push --force"
55+
exit 1
56+
57+
# Step 4: Success message
58+
# This step runs if the commit count is not greater than 1 (i.e., it's 1).
59+
- name: Success
60+
if: steps.count_commits.outputs.commit_count <= 1
61+
run: |
62+
echo "This pull request has a single commit. Great job!"

.github/workflows/triage.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@ jobs:
4040
ISSUE_TITLE: ${{ github.event.issue.title }}
4141
ISSUE_BODY: ${{ github.event.issue.body }}
4242
ISSUE_COUNT_TO_PROCESS: '3' # Process 3 issues at a time on schedule
43-
run: python contributing/samples/adk_triaging_agent/main.py
43+
PYTHONPATH: contributing/samples
44+
run: python -m adk_triaging_agent.main

AGENTS.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Gemini CLI / Gemini Code Assist Context
2+
3+
This document provides context for the Gemini CLI and Gemini Code Assist to understand the project and assist with development.
4+
5+
## Project Overview
6+
7+
The Agent Development Kit (ADK) is an open-source, code-first Python toolkit for building, evaluating, and deploying sophisticated AI agents with flexibility and control. While optimized for Gemini and the Google ecosystem, ADK is model-agnostic, deployment-agnostic, and is built for compatibility with other frameworks. ADK was designed to make agent development feel more like software development, to make it easier for developers to create, deploy, and orchestrate agentic architectures that range from simple tasks to complex workflows.
8+
9+
## ADK: Style Guides
10+
11+
### Python Style Guide
12+
13+
The project follows the Google Python Style Guide. Key conventions are enforced using `pylint` with the provided `pylintrc` configuration file. Here are some of the key style points:
14+
15+
* **Indentation**: 2 spaces.
16+
* **Line Length**: Maximum 80 characters.
17+
* **Naming Conventions**:
18+
* `function_and_variable_names`: `snake_case`
19+
* `ClassNames`: `CamelCase`
20+
* `CONSTANTS`: `UPPERCASE_SNAKE_CASE`
21+
* **Docstrings**: Required for all public modules, functions, classes, and methods.
22+
* **Imports**: Organized and sorted.
23+
* **Error Handling**: Specific exceptions should be caught, not general ones like `Exception`.
24+
25+
### Autoformat
26+
27+
We have autoformat.sh to help solve import organize and formatting issues.
28+
29+
```bash
30+
# Run in open_source_workspace/
31+
$ ./autoformat.sh
32+
```
33+
34+
### In ADK source
35+
36+
Below styles applies to the ADK source code (under `src/` folder of the Github.
37+
repo).
38+
39+
#### Use relative imports
40+
41+
```python
42+
# DO
43+
from ..agents.llm_agent import LlmAgent
44+
45+
# DON'T
46+
from google.adk.agents.llm_agent import LlmAgent
47+
```
48+
49+
#### Import from module, not from `__init__.py`
50+
51+
```python
52+
# DO
53+
from ..agents.llm_agent import LlmAgent
54+
55+
# DON'T
56+
from ..agents import LlmAgent # import from agents/__init__.py
57+
```
58+
59+
#### Always do `from __future__ import annotations`
60+
61+
```python
62+
# DO THIS, right after the open-source header.
63+
from __future__ import annotations
64+
```
65+
66+
Like below:
67+
68+
```python
69+
# Copyright 2025 Google LLC
70+
#
71+
# Licensed under the Apache License, Version 2.0 (the "License");
72+
# you may not use this file except in compliance with the License.
73+
# You may obtain a copy of the License at
74+
#
75+
# http://www.apache.org/licenses/LICENSE-2.0
76+
#
77+
# Unless required by applicable law or agreed to in writing, software
78+
# distributed under the License is distributed on an "AS IS" BASIS,
79+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
80+
# See the License for the specific language governing permissions and
81+
# limitations under the License.
82+
83+
from __future__ import annotations
84+
85+
# ... the rest of the file.
86+
```
87+
88+
This allows us to forward-reference a class without quotes.
89+
90+
Check out go/pep563 for details.
91+
92+
### In ADK tests
93+
94+
#### Use absolute imports
95+
96+
In tests, we use `google.adk` same as how our users uses.
97+
98+
```python
99+
# DO
100+
from google.adk.agents.llm_agent import LlmAgent
101+
102+
# DON'T
103+
from ..agents.llm_agent import LlmAgent
104+
```
105+
106+
## ADK: Local testing
107+
108+
### Unit tests
109+
110+
Run below command:
111+
112+
```bash
113+
$ pytest tests/unittests
114+
```

CONTRIBUTING.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ This project follows
4949

5050
## Requirement for PRs
5151

52+
- Each PR should only have one commit. Please squash it if there are multiple PRs.
5253
- All PRs, other than small documentation or typo fixes, should have a Issue assoicated. If not, please create one.
5354
- Small, focused PRs. Keep changes minimal—one concern per PR.
5455
- For bug fixes or features, please provide logs or screenshot after the fix is applied to help reviewers better understand the fix.
@@ -147,11 +148,11 @@ For any changes that impact user-facing documentation (guides, API reference, tu
147148
pytest ./tests/unittests
148149
```
149150

150-
NOTE: for accurately repro test failure, only include `test` and `eval` as
151-
extra dependencies.
151+
NOTE: for accurate repro of test failure, only include `test`, `eval` and
152+
`a2a` as extra dependencies.
152153

153154
```shell
154-
uv sync --extra test --extra eval
155+
uv sync --extra test --extra eval --extra a2a
155156
pytest ./tests/unittests
156157
```
157158

0 commit comments

Comments
 (0)